36 public :: fileio_write
41 public :: fileio_write_var
49 end interface fileio_read
51 interface fileio_write
57 end interface fileio_write
59 interface fileio_write_var
65 end interface fileio_write_var
80 real(RP),
private,
allocatable :: axis_lon (:,:)
81 real(RP),
private,
allocatable :: axis_lonx(:,:)
82 real(RP),
private,
allocatable :: axis_lony(:,:)
83 real(RP),
private,
allocatable :: axis_lonxy(:,:)
84 real(RP),
private,
allocatable :: axis_lat (:,:)
85 real(RP),
private,
allocatable :: axis_latx(:,:)
86 real(RP),
private,
allocatable :: axis_laty(:,:)
87 real(RP),
private,
allocatable :: axis_latxy(:,:)
89 integer,
private,
parameter :: file_nfile_max = 512
91 logical,
private,
save :: file_axes_written(0:file_nfile_max-1)
94 logical,
private,
save :: file_nozcoord(0:file_nfile_max-1)
106 if(
io_l )
write(
io_fid_log,*)
'++++++ Module[FIELIO] / Categ[ATMOS-RM IO] / Origin[SCALElib]' 109 if(
io_l )
write(
io_fid_log,*)
'*** NetCDF header information ***' 142 real(RP),
intent(in) :: LON (
ia,
ja)
143 real(RP),
intent(in) :: LONX(
ia,
ja)
144 real(RP),
intent(in) :: LONY(
ia,
ja)
145 real(RP),
intent(in) :: LONXY(
ia,
ja)
146 real(RP),
intent(in) :: LAT (
ia,
ja)
147 real(RP),
intent(in) :: LATX(
ia,
ja)
148 real(RP),
intent(in) :: LATY(
ia,
ja)
149 real(RP),
intent(in) :: LATXY(
ia,
ja)
150 real(RP),
intent(in) :: CZ (
ka,
ia,
ja)
151 real(RP),
intent(in) :: FZ (0:
ka,
ia,
ja)
175 fileputassociatedcoordinates
211 integer,
intent(in) :: fid
212 integer,
intent(in) :: dtype
213 logical,
intent(in),
optional :: xy
215 character(len=2) :: AXIS_name(2)
219 if (
present(xy) )
then 225 if ( .NOT. xy_ )
then 226 call fileputaxis( fid,
'z',
'Z',
'm',
'z', dtype,
grid_cz(
ks:
ke) )
228 call fileputaxis( fid,
'x',
'X',
'm',
'x', dtype,
grid_cx(
isb:
ieb) )
229 call fileputaxis( fid,
'y',
'Y',
'm',
'y', dtype,
grid_cy(
jsb:
jeb) )
230 if ( .NOT. xy_ )
then 231 call fileputaxis( fid,
'zh',
'Z (half level)',
'm',
'zh', dtype,
grid_fz(
ks:
ke) )
233 call fileputaxis( fid,
'xh',
'X (half level)',
'm',
'xh', dtype,
grid_fx(
isb:
ieb) )
234 call fileputaxis( fid,
'yh',
'Y (half level)',
'm',
'yh', dtype,
grid_fy(
jsb:
jeb) )
236 if ( .NOT. xy_ )
then 237 call fileputaxis( fid,
'lz',
'LZ',
'm',
'lz', dtype,
grid_lcz(
lks:
lke) )
238 call fileputaxis( fid,
'lzh',
'LZ (half level)',
'm',
'lzh', dtype,
grid_lfz(
lks:
lke) )
239 call fileputaxis( fid,
'uz',
'UZ',
'm',
'uz', dtype,
grid_ucz(
uks:
uke) )
240 call fileputaxis( fid,
'uzh',
'UZ (half level)',
'm',
'uzh', dtype,
grid_ufz(
uks:
uke) )
243 if ( .NOT. xy_ )
then 244 call fileputaxis( fid,
'CZ',
'Atmos Grid Center Position Z',
'm',
'CZ', dtype,
grid_cz )
246 call fileputaxis( fid,
'CX',
'Atmos Grid Center Position X',
'm',
'CX', dtype,
grid_cx )
247 call fileputaxis( fid,
'CY',
'Atmos Grid Center Position Y',
'm',
'CY', dtype,
grid_cy )
248 if ( .NOT. xy_ )
then 249 call fileputaxis( fid,
'FZ',
'Atmos Grid Face Position Z',
'm',
'FZ', dtype,
grid_fz )
251 call fileputaxis( fid,
'FX',
'Atmos Grid Face Position X',
'm',
'FX', dtype,
grid_fx )
252 call fileputaxis( fid,
'FY',
'Atmos Grid Face Position Y',
'm',
'FY', dtype,
grid_fy )
254 if ( .NOT. xy_ )
then 255 call fileputaxis( fid,
'CDZ',
'Grid Cell length Z',
'm',
'CZ', dtype,
grid_cdz )
257 call fileputaxis( fid,
'CDX',
'Grid Cell length X',
'm',
'CX', dtype,
grid_cdx )
258 call fileputaxis( fid,
'CDY',
'Grid Cell length Y',
'm',
'CY', dtype,
grid_cdy )
259 if ( .NOT. xy_ )
then 260 call fileputaxis( fid,
'FDZ',
'Grid distance Z',
'm',
'FDZ', dtype,
grid_fdz )
262 call fileputaxis( fid,
'FDX',
'Grid distance X',
'm',
'FDX', dtype,
grid_fdx )
263 call fileputaxis( fid,
'FDY',
'Grid distance Y',
'm',
'FDY', dtype,
grid_fdy )
265 if ( .NOT. xy_ )
then 266 call fileputaxis( fid,
'LCZ',
'Land Grid Center Position Z',
'm',
'LCZ', dtype,
grid_lcz )
267 call fileputaxis( fid,
'LFZ',
'Land Grid Face Position Z',
'm',
'LFZ', dtype,
grid_lfz )
268 call fileputaxis( fid,
'LCDZ',
'Land Grid Cell length Z',
'm',
'LCZ', dtype,
grid_lcz )
270 call fileputaxis( fid,
'UCZ',
'Urban Grid Center Position Z',
'm',
'UCZ', dtype,
grid_ucz )
271 call fileputaxis( fid,
'UFZ',
'Urban Grid Face Position Z',
'm',
'UFZ', dtype,
grid_ufz )
272 call fileputaxis( fid,
'UCDZ',
'Urban Grid Cell length Z',
'm',
'UCZ', dtype,
grid_ucz )
275 if ( .NOT. xy_ )
then 276 call fileputaxis( fid,
'CBFZ',
'Boundary factor Center Z',
'1',
'CZ', dtype,
grid_cbfz )
278 call fileputaxis( fid,
'CBFX',
'Boundary factor Center X',
'1',
'CX', dtype,
grid_cbfx )
279 call fileputaxis( fid,
'CBFY',
'Boundary factor Center Y',
'1',
'CY', dtype,
grid_cbfy )
280 if ( .NOT. xy_ )
then 281 call fileputaxis( fid,
'FBFZ',
'Boundary factor Face Z',
'1',
'CZ', dtype,
grid_fbfz )
283 call fileputaxis( fid,
'FBFX',
'Boundary factor Face X',
'1',
'CX', dtype,
grid_fbfx )
284 call fileputaxis( fid,
'FBFY',
'Boundary factor Face Y',
'1',
'CY', dtype,
grid_fbfy )
286 call fileputaxis( fid,
'CXG',
'Grid Center Position X (global)',
'm',
'CXG', dtype,
grid_cxg )
287 call fileputaxis( fid,
'CYG',
'Grid Center Position Y (global)',
'm',
'CYG', dtype,
grid_cyg )
288 call fileputaxis( fid,
'FXG',
'Grid Face Position X (global)',
'm',
'FXG', dtype,
grid_fxg )
289 call fileputaxis( fid,
'FYG',
'Grid Face Position Y (global)',
'm',
'FYG', dtype,
grid_fyg )
291 call fileputaxis( fid,
'CBFXG',
'Boundary factor Center X (global)',
'1',
'CXG', dtype,
grid_cbfxg )
292 call fileputaxis( fid,
'CBFYG',
'Boundary factor Center Y (global)',
'1',
'CYG', dtype,
grid_cbfyg )
293 call fileputaxis( fid,
'FBFXG',
'Boundary factor Face X (global)',
'1',
'CXG', dtype,
grid_fbfxg )
294 call fileputaxis( fid,
'FBFYG',
'Boundary factor Face Y (global)',
'1',
'CYG', dtype,
grid_fbfyg )
297 axis_name = (/
'x ',
'y '/)
298 call fileputassociatedcoordinates( fid,
'lon' ,
'longitude' , &
299 'degrees_east' , axis_name, dtype, axis_lon(:,:) )
300 axis_name = (/
'xh',
'y '/)
301 call fileputassociatedcoordinates( fid,
'lon_uy',
'longitude (half level uy)', &
302 'degrees_east' , axis_name, dtype, axis_lonx(:,:) )
303 axis_name = (/
'x ',
'yh'/)
304 call fileputassociatedcoordinates( fid,
'lon_xv',
'longitude (half level xv)', &
305 'degrees_east' , axis_name, dtype, axis_lony(:,:) )
306 axis_name = (/
'xh',
'yh'/)
307 call fileputassociatedcoordinates( fid,
'lon_uv',
'longitude (half level uv)', &
308 'degrees_east' , axis_name, dtype, axis_lonxy(:,:) )
309 axis_name = (/
'x ',
'y '/)
310 call fileputassociatedcoordinates( fid,
'lat' ,
'latitude' , &
311 'degrees_north', axis_name, dtype, axis_lat(:,:) )
312 axis_name = (/
'xh',
'y '/)
313 call fileputassociatedcoordinates( fid,
'lat_uy',
'latitude (half level uy)' , &
314 'degrees_north', axis_name, dtype, axis_latx(:,:) )
315 axis_name = (/
'x ',
'yh'/)
316 call fileputassociatedcoordinates( fid,
'lat_xv',
'latitude (half level xv)' , &
317 'degrees_north', axis_name, dtype, axis_laty(:,:) )
318 axis_name = (/
'xh',
'yh'/)
319 call fileputassociatedcoordinates( fid,
'lat_uv',
'latitude (half level uv)' , &
320 'degrees_north', axis_name, dtype, axis_latxy(:,:) )
323 if ( .NOT. xy_ )
then 352 real(RP),
intent(out) :: var(:)
353 character(len=*),
intent(in) :: basename
354 character(len=*),
intent(in) :: varname
355 character(len=*),
intent(in) :: axistype
356 integer,
intent(in) :: step
358 integer :: dim1_max, dim1_S, dim1_E
359 real(RP),
allocatable :: var1D(:)
364 if(
io_l )
write(
io_fid_log,
'(1x,A,A15)')
'*** Read 1D var: ', trim(varname)
366 if ( axistype ==
'Z' )
then 370 elseif( axistype ==
'X' )
then 374 elseif( axistype ==
'Y' )
then 379 write(*,*)
'xxx unsupported axis type. Check!', trim(axistype),
' item:',trim(varname)
383 allocate( var1d(dim1_max) )
385 call fileread( var1d(:), basename, varname, step,
prc_myrank )
386 var(dim1_s:dim1_e) = var1d(1:dim1_max)
410 real(RP),
intent(out) :: var(:,:)
411 character(len=*),
intent(in) :: basename
412 character(len=*),
intent(in) :: varname
413 character(len=*),
intent(in) :: axistype
414 integer,
intent(in) :: step
416 integer :: dim1_max, dim1_S, dim1_E
417 integer :: dim2_max, dim2_S, dim2_E
418 real(RP),
allocatable :: var2D(:,:)
423 if(
io_l )
write(
io_fid_log,
'(1x,A,A15)')
'*** Read 2D var: ', trim(varname)
425 if ( axistype ==
'XY' )
then 432 elseif( axistype ==
'ZX' )
then 440 write(*,*)
'xxx unsupported axis type. Check!', trim(axistype),
' item:',trim(varname)
444 allocate( var2d(dim1_max,dim2_max) )
446 call fileread( var2d(:,:), basename, varname, step,
prc_myrank )
447 var(dim1_s:dim1_e,dim2_s:dim2_e) = var2d(1:dim1_max,1:dim2_max)
471 real(RP),
intent(out) :: var(:,:,:)
472 character(len=*),
intent(in) :: basename
473 character(len=*),
intent(in) :: varname
474 character(len=*),
intent(in) :: axistype
475 integer,
intent(in) :: step
477 integer :: dim1_max, dim1_S, dim1_E
478 integer :: dim2_max, dim2_S, dim2_E
479 integer :: dim3_max, dim3_S, dim3_E
480 real(RP),
allocatable :: var3D(:,:,:)
485 if(
io_l )
write(
io_fid_log,
'(1x,A,A15)')
'*** Read 3D var: ', trim(varname)
487 if ( axistype ==
'ZXY' )
then 497 else if ( axistype ==
'XYT' )
then 507 else if ( axistype ==
'Land' )
then 517 else if ( axistype ==
'Urban' )
then 528 write(*,*)
'xxx unsupported axis type. Check!', trim(axistype),
' item:',trim(varname)
532 allocate( var3d(dim1_max,dim2_max,dim3_max) )
534 call fileread( var3d(:,:,:), basename, varname, step,
prc_myrank )
535 var(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e) = var3d(1:dim1_max,1:dim2_max,1:dim3_max)
559 real(RP),
intent(out) :: var(:,:,:,:)
560 character(len=*),
intent(in) :: basename
561 character(len=*),
intent(in) :: varname
562 character(len=*),
intent(in) :: axistype
563 integer,
intent(in) :: step
565 integer :: dim1_max, dim1_S, dim1_E
566 integer :: dim2_max, dim2_S, dim2_E
567 integer :: dim3_max, dim3_S, dim3_E
568 integer :: dim4_max, dim4_S, dim4_E
569 real(RP),
allocatable :: var4D(:,:,:,:)
574 if(
io_l )
write(
io_fid_log,
'(1x,A,A15)')
'*** Read 4D var: ', trim(varname)
576 if ( axistype ==
'ZXYT' )
then 590 write(*,*)
'xxx unsupported axis type. Check!', trim(axistype),
' item:',trim(varname)
594 allocate( var4d(dim1_max,dim2_max,dim3_max,dim4_max) )
596 call fileread( var4d(:,:,:,:), basename, varname, step,
prc_myrank )
597 var(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e,dim4_s:dim4_e) = var4d(1:dim1_max,1:dim2_max,1:dim3_max,1:dim4_max)
626 filesetglobalattribute, &
640 real(RP),
intent(in) :: var(:)
641 character(len=*),
intent(in) :: basename
642 character(len=*),
intent(in) :: title
643 character(len=*),
intent(in) :: varname
644 character(len=*),
intent(in) :: desc
645 character(len=*),
intent(in) :: unit
646 character(len=*),
intent(in) :: axistype
647 character(len=*),
intent(in) :: datatype
649 integer,
optional,
intent(in) :: date(6)
650 real(DP),
optional,
intent(in) :: subsec
651 logical,
optional,
intent(in) :: append
654 character(len=2) :: dims(1)
655 integer :: dim1_max, dim1_S, dim1_E
656 real(RP),
allocatable :: var1D(:)
658 integer :: rankidx(2)
659 logical :: fileexisted
661 character(len=34) :: tunits
669 if ( datatype ==
'REAL8' )
then 671 elseif( datatype ==
'REAL4' )
then 676 elseif(
rp == 4 )
then 679 write(*,*)
'xxx unsupported data type. Check!', trim(datatype),
' item:',trim(varname)
695 if ( .NOT. fileexisted )
then 697 if (
present( subsec ) )
then 698 call filesetglobalattribute( fid,
"time", (/subsec/) )
700 call filesetglobalattribute( fid,
"time", (/nowms/) )
702 if (
present( date ) )
then 707 call filesetglobalattribute( fid,
"time_units", tunits )
710 if ( axistype ==
'Z' )
then 715 elseif( axistype ==
'X' )
then 720 elseif( axistype ==
'Y' )
then 726 write(*,*)
'xxx unsupported axis type. Check!', trim(axistype),
' item:',trim(varname)
730 call fileaddvariable( vid, fid, varname, desc, unit, dims, dtype )
732 allocate( var1d(dim1_max) )
734 var1d(1:dim1_max) = var(dim1_s:dim1_e)
735 call filewrite( fid, vid, var1d(:), nowsec, nowsec )
768 filesetglobalattribute, &
782 real(RP),
intent(in) :: var(:,:)
783 character(len=*),
intent(in) :: basename
784 character(len=*),
intent(in) :: title
785 character(len=*),
intent(in) :: varname
786 character(len=*),
intent(in) :: desc
787 character(len=*),
intent(in) :: unit
788 character(len=*),
intent(in) :: axistype
789 character(len=*),
intent(in) :: datatype
790 integer,
optional,
intent(in) :: date(6)
791 real(DP),
optional,
intent(in) :: subsec
792 logical,
optional,
intent(in) :: append
793 logical,
optional,
intent(in) :: nohalo
794 logical,
optional,
intent(in) :: nozcoord
796 real(RP) :: varhalo( size(var(:,1)), size(var(1,:)) )
799 character(len=2) :: dims(2)
800 integer :: dim1_max, dim1_S, dim1_E
801 integer :: dim2_max, dim2_S, dim2_E
802 real(RP),
allocatable :: var2D(:,:)
804 integer :: rankidx(2)
805 logical :: fileexisted
809 character(len=34) :: tunits
815 if (
present(nohalo) ) nohalo_ = nohalo
820 if ( datatype ==
'REAL8' )
then 822 elseif( datatype ==
'REAL4' )
then 827 elseif(
rp == 4 )
then 830 write(*,*)
'xxx unsupported data type. Check!', trim(datatype),
' item:',trim(varname)
846 if ( axistype ==
'XY' )
then 854 elseif ( axistype ==
'UY' )
then 862 elseif ( axistype ==
'XV' )
then 870 elseif ( axistype ==
'UV' )
then 878 elseif( axistype ==
'ZX' )
then 887 write(*,*)
'xxx unsupported axis type. Check!', trim(axistype),
' item:',trim(varname)
891 if ( .NOT. fileexisted )
then 893 if (
present( subsec ) )
then 894 call filesetglobalattribute( fid,
"time", (/subsec/) )
896 call filesetglobalattribute( fid,
"time", (/nowms/) )
898 if (
present( date ) )
then 903 call filesetglobalattribute( fid,
"time_units", tunits )
906 varhalo(:,:) = var(:,:)
935 call fileaddvariable( vid, fid, varname, desc, unit, dims, dtype )
937 allocate( var2d(dim1_max,dim2_max) )
939 var2d(1:dim1_max,1:dim2_max) = varhalo(dim1_s:dim1_e,dim2_s:dim2_e)
940 call filewrite( fid, vid, var2d(:,:), nowsec, nowsec )
972 filesetglobalattribute, &
986 real(RP),
intent(in) :: var(:,:,:)
987 character(len=*),
intent(in) :: basename
988 character(len=*),
intent(in) :: title
989 character(len=*),
intent(in) :: varname
990 character(len=*),
intent(in) :: desc
991 character(len=*),
intent(in) :: unit
992 character(len=*),
intent(in) :: axistype
993 character(len=*),
intent(in) :: datatype
994 integer,
optional,
intent(in) :: date(6)
995 real(DP),
optional,
intent(in) :: subsec
996 logical,
optional,
intent(in) :: append
997 logical,
optional,
intent(in) :: nohalo
999 real(RP) :: varhalo( size(var(:,1,1)), size(var(1,:,1)), size(var(1,1,:)) )
1002 character(len=2) :: dims(3)
1003 integer :: dim1_max, dim1_S, dim1_E
1004 integer :: dim2_max, dim2_S, dim2_E
1005 integer :: dim3_max, dim3_S, dim3_E
1007 real(RP),
allocatable :: var3D(:,:,:)
1009 integer :: rankidx(2)
1010 logical :: append_sw
1011 logical :: fileexisted
1015 character(len=34) :: tunits
1021 if (
present(nohalo) ) nohalo_ = nohalo
1026 if ( datatype ==
'REAL8' )
then 1028 elseif( datatype ==
'REAL4' )
then 1033 elseif(
rp == 4 )
then 1036 write(*,*)
'xxx unsupported data type. Check!', trim(datatype),
' item:',trim(varname)
1042 if (
present(append) )
then 1055 append = append_sw )
1057 if ( .NOT. fileexisted )
then 1059 if (
present( subsec ) )
then 1060 call filesetglobalattribute( fid,
"time", (/subsec/) )
1062 call filesetglobalattribute( fid,
"time", (/nowms/) )
1064 if (
present( date ) )
then 1069 call filesetglobalattribute( fid,
"time_units", tunits )
1072 if ( axistype ==
'ZXY' )
then 1073 dims = (/
'z',
'x',
'y'/)
1083 elseif( axistype ==
'ZHXY' )
then 1084 dims = (/
'zh',
'x ',
'y '/)
1094 elseif( axistype ==
'ZXHY' )
then 1095 dims = (/
'z ',
'xh',
'y '/)
1105 elseif( axistype ==
'ZXYH' )
then 1106 dims = (/
'z ',
'x ',
'yh'/)
1116 elseif( axistype ==
'Land' )
then 1117 dims = (/
'lz',
'x ',
'y '/)
1127 elseif( axistype ==
'Urban' )
then 1128 dims = (/
'uz',
'x ',
'y '/)
1139 write(*,*)
'xxx unsupported axis type. Check!', trim(axistype),
' item:',trim(varname)
1143 varhalo(:,:,:) = var(:,:,:)
1150 varhalo(k,i,j) = rmiss
1158 varhalo(k,i,j) = rmiss
1166 varhalo(k,i,j) = rmiss
1174 varhalo(k,i,j) = rmiss
1180 call fileaddvariable( vid, fid, varname, desc, unit, dims, dtype )
1182 allocate( var3d(dim1_max,dim2_max,dim3_max) )
1184 var3d(1:dim1_max,1:dim2_max,1:dim3_max) = varhalo(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e)
1185 call filewrite( fid, vid, var3d(:,:,:), nowsec, nowsec )
1228 real(RP),
intent(in) :: var(:,:,:)
1229 character(len=*),
intent(in) :: basename
1230 character(len=*),
intent(in) :: title
1231 character(len=*),
intent(in) :: varname
1232 character(len=*),
intent(in) :: desc
1233 character(len=*),
intent(in) :: unit
1234 character(len=*),
intent(in) :: axistype
1235 character(len=*),
intent(in) :: datatype
1236 real(RP),
intent(in) :: timeintv
1237 integer ,
intent(in) :: tsince(6)
1238 logical,
optional,
intent(in) :: append
1239 integer,
optional,
intent(in) :: timetarg
1240 logical,
optional,
intent(in) :: nohalo
1242 real(RP) :: varhalo( size(var(:,1,1)), size(var(1,:,1)) )
1245 character(len=2) :: dims(2)
1246 integer :: dim1_max, dim1_S, dim1_E
1247 integer :: dim2_max, dim2_S, dim2_E
1249 real(RP),
allocatable :: var2D(:,:)
1250 real(DP) :: time_interval, nowtime
1252 character(len=34) :: tunits
1254 integer :: rankidx(2)
1255 logical :: append_sw
1256 logical :: fileexisted
1266 if (
present(nohalo) ) nohalo_ = nohalo
1268 time_interval = timeintv
1269 step =
size(var(
isb,
jsb,:))
1274 if ( datatype ==
'REAL8' )
then 1276 elseif( datatype ==
'REAL4' )
then 1281 elseif(
rp == 4 )
then 1284 write(*,*)
'xxx unsupported data type. Check!', trim(datatype),
' item:',trim(varname)
1290 if (
present(append) )
then 1294 write(tunits,
'(a,i4.4,"-",i2.2,"-",i2.2," ",i2.2,":",i2.2,":",i2.2)')
'seconds since ', tsince
1305 time_units = tunits, &
1306 append = append_sw )
1308 if ( .NOT. fileexisted )
then 1312 if ( axistype ==
'XYT' )
then 1321 write(*,*)
'xxx unsupported axis type. Check!', trim(axistype),
' item:',trim(varname)
1325 call fileaddvariable( vid, fid, varname, desc, unit, dims, dtype, time_interval )
1326 allocate( var2d(dim1_max,dim2_max) )
1328 if (
present(timetarg) )
then 1329 varhalo(:,:) = var(:,:,timetarg)
1335 varhalo(i,j) = rmiss
1341 varhalo(i,j) = rmiss
1347 varhalo(i,j) = rmiss
1353 varhalo(i,j) = rmiss
1358 nowtime = (timetarg-1) * time_interval
1359 var2d(1:dim1_max,1:dim2_max) = varhalo(dim1_s:dim1_e,dim2_s:dim2_e)
1360 call filewrite( fid, vid, var2d(:,:), nowtime, nowtime )
1364 varhalo(:,:) = var(:,:,n)
1370 varhalo(i,j) = rmiss
1376 varhalo(i,j) = rmiss
1382 varhalo(i,j) = rmiss
1388 varhalo(i,j) = rmiss
1393 var2d(1:dim1_max,1:dim2_max) = varhalo(dim1_s:dim1_e,dim2_s:dim2_e)
1394 call filewrite( fid, vid, var2d(:,:), nowtime, nowtime )
1395 nowtime = nowtime + time_interval
1440 real(RP),
intent(in) :: var(:,:,:,:)
1441 character(len=*),
intent(in) :: basename
1442 character(len=*),
intent(in) :: title
1443 character(len=*),
intent(in) :: varname
1444 character(len=*),
intent(in) :: desc
1445 character(len=*),
intent(in) :: unit
1446 character(len=*),
intent(in) :: axistype
1447 character(len=*),
intent(in) :: datatype
1448 real(RP),
intent(in) :: timeintv
1449 integer ,
intent(in) :: tsince(6)
1450 logical,
optional,
intent(in) :: append
1451 integer,
optional,
intent(in) :: timetarg
1452 logical,
optional,
intent(in) :: nohalo
1454 real(RP) :: varhalo( size(var(:,1,1,1)), size(var(1,:,1,1)), size(var(1,1,:,1)) )
1457 character(len=2) :: dims(3)
1458 integer :: dim1_max, dim1_S, dim1_E
1459 integer :: dim2_max, dim2_S, dim2_E
1460 integer :: dim3_max, dim3_S, dim3_E
1462 real(RP),
allocatable :: var3D(:,:,:)
1463 real(DP) :: time_interval, nowtime
1465 character(len=34) :: tunits
1467 integer :: rankidx(2)
1468 logical :: append_sw
1469 logical :: fileexisted
1472 integer :: i, j, k, n
1479 if (
present(nohalo) ) nohalo_ = nohalo
1481 time_interval = timeintv
1487 if ( datatype ==
'REAL8' )
then 1489 elseif( datatype ==
'REAL4' )
then 1494 elseif(
rp == 4 )
then 1497 write(*,*)
'xxx unsupported data type. Check!', trim(datatype),
' item:',trim(varname)
1503 if (
present(append) )
then 1518 time_units = tunits, &
1519 append = append_sw )
1521 if ( .NOT. fileexisted )
then 1525 if ( axistype ==
'ZXYT' )
then 1526 dims = (/
'z',
'x',
'y'/)
1537 write(*,*)
'xxx unsupported axis type. Check!', trim(axistype),
' item:',trim(varname)
1541 call fileaddvariable( vid, fid, varname, desc, unit, dims, dtype, time_interval )
1542 allocate( var3d(dim1_max,dim2_max,dim3_max) )
1544 if (
present(timetarg) )
then 1545 varhalo(:,:,:) = var(:,:,:,timetarg)
1552 varhalo(k,i,j) = rmiss
1560 varhalo(k,i,j) = rmiss
1568 varhalo(k,i,j) = rmiss
1576 varhalo(k,i,j) = rmiss
1582 nowtime = (timetarg-1) * time_interval
1583 var3d(1:dim1_max,1:dim2_max,1:dim3_max) = varhalo(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e)
1584 call filewrite( fid, vid, var3d(:,:,:), nowtime, nowtime )
1588 varhalo(:,:,:) = var(:,:,:,n)
1595 varhalo(k,i,j) = rmiss
1603 varhalo(k,i,j) = rmiss
1611 varhalo(k,i,j) = rmiss
1619 varhalo(k,i,j) = rmiss
1625 var3d(1:dim1_max,1:dim2_max,1:dim3_max) = varhalo(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e)
1626 call filewrite( fid, vid, var3d(:,:,:), nowtime, nowtime )
1627 nowtime = nowtime + time_interval
1641 character(len=34),
intent(out) :: tunits
1642 integer,
intent(in) :: date(6)
1644 write(tunits,
'(a,i4.4,"-",i2.2,"-",i2.2," ",i2.2,":",i2.2,":",i2.2)')
'seconds since ', date
1665 filesetglobalattribute
1678 integer,
intent(out) :: fid
1679 character(len=*),
intent(in) :: basename
1680 character(len=*),
intent(in) :: title
1681 character(len=*),
intent(in) :: datatype
1682 integer,
optional,
intent(in) :: date(6)
1683 real(DP),
optional,
intent(in) :: subsec
1684 logical,
optional,
intent(in) :: append
1685 logical,
optional,
intent(in) :: nozcoord
1687 integer :: rankidx(2)
1689 logical :: append_sw
1690 logical :: fileexisted
1691 character(len=34) :: tunits
1700 if ( datatype ==
'REAL8' )
then 1702 elseif( datatype ==
'REAL4' )
then 1707 elseif(
rp == 4 )
then 1710 write(*,*)
'xxx unsupported data type. Check!', trim(datatype)
1716 if (
present(append) )
then 1721 if (
present(date) )
then 1733 time_units = tunits, &
1734 append = append_sw )
1745 append = append_sw )
1748 if ( .NOT. fileexisted )
then 1750 file_axes_written(fid) = .false.
1751 if (
present( nozcoord ) )
then 1752 file_nozcoord(fid) = nozcoord
1754 file_nozcoord(fid) = .false.
1757 if (
present( subsec ) )
then 1758 call filesetglobalattribute( fid,
"time", (/subsec/) )
1760 call filesetglobalattribute( fid,
"time", (/nowms/) )
1762 if (
present( date ) )
then 1767 call filesetglobalattribute( fid,
"time_units", tunits )
1783 integer,
intent(in) :: fid
1792 if ( .NOT. file_axes_written(fid) )
then 1794 file_axes_written(fid) = .true.
1810 integer,
intent(in) :: fid
1838 integer,
intent(in) :: fid
1839 integer,
intent(in) :: dtype
1840 logical,
intent(in),
optional :: xy
1842 character(len=2) :: AXIS_name(2)
1851 if (
present(xy) )
then 1857 if ( .NOT. xy_ )
then 1862 if ( .NOT. xy_ )
then 1863 call filedefaxis( fid,
'zh',
'Z (half level)',
'm',
'zh', dtype,
ke-
ks+1 )
1868 if ( .NOT. xy_ )
then 1876 if ( .NOT. xy_ )
then 1877 call filedefaxis( fid,
'CZ',
'Atmos Grid Center Position Z',
'm',
'CZ', dtype,
ka )
1879 call filedefaxis( fid,
'CX',
'Atmos Grid Center Position X',
'm',
'CX', dtype,
ia )
1880 call filedefaxis( fid,
'CY',
'Atmos Grid Center Position Y',
'm',
'CY', dtype,
ja )
1881 if ( .NOT. xy_ )
then 1882 call filedefaxis( fid,
'FZ',
'Atmos Grid Face Position Z',
'm',
'FZ', dtype,
ka+1 )
1884 call filedefaxis( fid,
'FX',
'Atmos Grid Face Position X',
'm',
'FX', dtype,
ia+1 )
1885 call filedefaxis( fid,
'FY',
'Atmos Grid Face Position Y',
'm',
'FY', dtype,
ja+1 )
1887 if ( .NOT. xy_ )
then 1888 call filedefaxis( fid,
'CDZ',
'Grid Cell length Z',
'm',
'CZ', dtype,
ka )
1890 call filedefaxis( fid,
'CDX',
'Grid Cell length X',
'm',
'CX', dtype,
ia )
1891 call filedefaxis( fid,
'CDY',
'Grid Cell length Y',
'm',
'CY', dtype,
ja )
1892 if ( .NOT. xy_ )
then 1893 call filedefaxis( fid,
'FDZ',
'Grid distance Z',
'm',
'FDZ', dtype,
ka-1 )
1895 call filedefaxis( fid,
'FDX',
'Grid distance X',
'm',
'FDX', dtype,
ia-1 )
1896 call filedefaxis( fid,
'FDY',
'Grid distance Y',
'm',
'FDY', dtype,
ja-1 )
1898 if ( .NOT. xy_ )
then 1899 call filedefaxis( fid,
'LCZ',
'Land Grid Center Position Z',
'm',
'LCZ', dtype,
lke-
lks+1 )
1900 call filedefaxis( fid,
'LFZ',
'Land Grid Face Position Z',
'm',
'LFZ', dtype,
lke-
lks+2 )
1901 call filedefaxis( fid,
'LCDZ',
'Land Grid Cell length Z',
'm',
'LCZ', dtype,
lke-
lks+1 )
1903 call filedefaxis( fid,
'UCZ',
'Urban Grid Center Position Z',
'm',
'UCZ', dtype,
uke-
uks+1 )
1904 call filedefaxis( fid,
'UFZ',
'Urban Grid Face Position Z',
'm',
'UFZ', dtype,
uke-
uks+2 )
1905 call filedefaxis( fid,
'UCDZ',
'Urban Grid Cell length Z',
'm',
'UCZ', dtype,
uke-
uks+1 )
1908 if ( .NOT. xy_ )
then 1909 call filedefaxis( fid,
'CBFZ',
'Boundary factor Center Z',
'1',
'CZ', dtype,
ka )
1911 call filedefaxis( fid,
'CBFX',
'Boundary factor Center X',
'1',
'CX', dtype,
ia )
1912 call filedefaxis( fid,
'CBFY',
'Boundary factor Center Y',
'1',
'CY', dtype,
ja )
1913 if ( .NOT. xy_ )
then 1914 call filedefaxis( fid,
'FBFZ',
'Boundary factor Face Z',
'1',
'CZ', dtype,
ka )
1916 call filedefaxis( fid,
'FBFX',
'Boundary factor Face X',
'1',
'CX', dtype,
ia )
1917 call filedefaxis( fid,
'FBFY',
'Boundary factor Face Y',
'1',
'CY', dtype,
ja )
1919 call filedefaxis( fid,
'CXG',
'Grid Center Position X (global)',
'm',
'CXG', dtype, iag )
1920 call filedefaxis( fid,
'CYG',
'Grid Center Position Y (global)',
'm',
'CYG', dtype, jag )
1921 call filedefaxis( fid,
'FXG',
'Grid Face Position X (global)',
'm',
'FXG', dtype, iag+1 )
1922 call filedefaxis( fid,
'FYG',
'Grid Face Position Y (global)',
'm',
'FYG', dtype, jag+1 )
1924 call filedefaxis( fid,
'CBFXG',
'Boundary factor Center X (global)',
'1',
'CXG', dtype, iag )
1925 call filedefaxis( fid,
'CBFYG',
'Boundary factor Center Y (global)',
'1',
'CYG', dtype, jag )
1926 call filedefaxis( fid,
'FBFXG',
'Boundary factor Face X (global)',
'1',
'CXG', dtype, iag )
1927 call filedefaxis( fid,
'FBFYG',
'Boundary factor Face Y (global)',
'1',
'CYG', dtype, jag )
1930 axis_name = (/
'x ',
'y '/)
1932 'degrees_east' , axis_name, dtype )
1933 axis_name = (/
'xh',
'y '/)
1935 'degrees_east' , axis_name, dtype )
1936 axis_name = (/
'x ',
'yh'/)
1938 'degrees_east' , axis_name, dtype )
1939 axis_name = (/
'xh',
'yh'/)
1941 'degrees_east' , axis_name, dtype )
1942 axis_name = (/
'x ',
'y '/)
1944 'degrees_north', axis_name, dtype )
1945 axis_name = (/
'xh',
'y '/)
1947 'degrees_north', axis_name, dtype )
1948 axis_name = (/
'x ',
'yh'/)
1950 'degrees_north', axis_name, dtype )
1951 axis_name = (/
'xh',
'yh'/)
1953 'degrees_north', axis_name, dtype )
1956 if ( .NOT. xy_ )
then 1977 filewriteassociatedcoordinates
2013 integer,
intent(in) :: fid
2014 logical,
intent(in),
optional :: xy
2019 if (
present(xy) )
then 2025 if ( .NOT. xy_ )
then 2030 if ( .NOT. xy_ )
then 2036 if ( .NOT. xy_ )
then 2043 if ( .NOT. xy_ )
then 2044 call filewriteaxis( fid,
'CZ',
grid_cz )
2046 call filewriteaxis( fid,
'CX',
grid_cx )
2047 call filewriteaxis( fid,
'CY',
grid_cy )
2048 if ( .NOT. xy_ )
then 2049 call filewriteaxis( fid,
'FZ',
grid_fz )
2051 call filewriteaxis( fid,
'FX',
grid_fx )
2052 call filewriteaxis( fid,
'FY',
grid_fy )
2054 if ( .NOT. xy_ )
then 2055 call filewriteaxis( fid,
'CDZ',
grid_cdz )
2057 call filewriteaxis( fid,
'CDX',
grid_cdx )
2058 call filewriteaxis( fid,
'CDY',
grid_cdy )
2059 if ( .NOT. xy_ )
then 2060 call filewriteaxis( fid,
'FDZ',
grid_fdz )
2062 call filewriteaxis( fid,
'FDX',
grid_fdx )
2063 call filewriteaxis( fid,
'FDY',
grid_fdy )
2065 if ( .NOT. xy_ )
then 2066 call filewriteaxis( fid,
'LCZ',
grid_lcz )
2067 call filewriteaxis( fid,
'LFZ',
grid_lfz )
2068 call filewriteaxis( fid,
'LCDZ',
grid_lcz )
2070 call filewriteaxis( fid,
'UCZ',
grid_ucz )
2071 call filewriteaxis( fid,
'UFZ',
grid_ufz )
2072 call filewriteaxis( fid,
'UCDZ',
grid_ucz )
2075 if ( .NOT. xy_ )
then 2076 call filewriteaxis( fid,
'CBFZ',
grid_cbfz )
2078 call filewriteaxis( fid,
'CBFX',
grid_cbfx )
2079 call filewriteaxis( fid,
'CBFY',
grid_cbfy )
2080 if ( .NOT. xy_ )
then 2081 call filewriteaxis( fid,
'FBFZ',
grid_fbfz )
2083 call filewriteaxis( fid,
'FBFX',
grid_fbfx )
2084 call filewriteaxis( fid,
'FBFY',
grid_fbfy )
2086 call filewriteaxis( fid,
'CXG',
grid_cxg )
2087 call filewriteaxis( fid,
'CYG',
grid_cyg )
2088 call filewriteaxis( fid,
'FXG',
grid_fxg )
2089 call filewriteaxis( fid,
'FYG',
grid_fyg )
2091 call filewriteaxis( fid,
'CBFXG',
grid_cbfxg )
2092 call filewriteaxis( fid,
'CBFYG',
grid_cbfyg )
2093 call filewriteaxis( fid,
'FBFXG',
grid_fbfxg )
2094 call filewriteaxis( fid,
'FBFYG',
grid_fbfyg )
2098 call filewriteassociatedcoordinates( fid,
'lon' , axis_lon(:,:) )
2099 call filewriteassociatedcoordinates( fid,
'lon_uy', axis_lonx(:,:) )
2100 call filewriteassociatedcoordinates( fid,
'lon_xv', axis_lony(:,:) )
2101 call filewriteassociatedcoordinates( fid,
'lon_uv', axis_lonxy(:,:) )
2102 call filewriteassociatedcoordinates( fid,
'lat' , axis_lat(:,:) )
2103 call filewriteassociatedcoordinates( fid,
'lat_uy', axis_latx(:,:) )
2104 call filewriteassociatedcoordinates( fid,
'lat_xv', axis_laty(:,:) )
2105 call filewriteassociatedcoordinates( fid,
'lat_uv', axis_latxy(:,:) )
2130 integer,
intent(in) :: fid
2131 integer,
intent(out) :: vid
2132 character(len=*),
intent(in) :: varname
2133 character(len=*),
intent(in) :: desc
2134 character(len=*),
intent(in) :: unit
2135 character(len=*),
intent(in) :: axistype
2136 character(len=*),
intent(in) :: datatype
2137 real(RP),
optional,
intent(in) :: timeintv
2139 integer :: dtype, ndims
2140 character(len=2) :: dims(3)
2141 real(DP) :: time_interval
2146 if ( datatype ==
'REAL8' )
then 2148 elseif( datatype ==
'REAL4' )
then 2153 elseif(
rp == 4 )
then 2156 write(*,*)
'xxx unsupported data type. Check!', trim(datatype),
' item:',trim(varname)
2161 if ( axistype ==
'Z' )
then 2164 elseif( axistype ==
'X' )
then 2167 elseif( axistype ==
'Y' )
then 2170 elseif ( axistype ==
'XY' )
then 2174 elseif ( axistype ==
'UY' )
then 2178 elseif ( axistype ==
'XV' )
then 2182 elseif ( axistype ==
'UV' )
then 2186 elseif( axistype ==
'ZX' )
then 2190 elseif ( axistype ==
'ZXY' )
then 2192 dims = (/
'z',
'x',
'y'/)
2193 elseif( axistype ==
'ZHXY' )
then 2195 dims = (/
'zh',
'x ',
'y '/)
2196 elseif( axistype ==
'ZXHY' )
then 2198 dims = (/
'z ',
'xh',
'y '/)
2199 elseif( axistype ==
'ZXYH' )
then 2201 dims = (/
'z ',
'x ',
'yh'/)
2202 elseif( axistype ==
'Land' )
then 2204 dims = (/
'lz',
'x ',
'y '/)
2205 elseif( axistype ==
'Urban' )
then 2207 dims = (/
'uz',
'x ',
'y '/)
2208 elseif ( axistype ==
'XYT' )
then 2212 elseif ( axistype ==
'ZXYT' )
then 2214 dims = (/
'z',
'x',
'y'/)
2216 write(*,*)
'xxx unsupported axis type. Check!', trim(axistype),
' item:',trim(varname)
2220 if (
present(timeintv) )
then 2221 time_interval = timeintv
2223 tint=time_interval )
2249 integer,
intent(in) :: fid
2250 integer,
intent(in) :: vid
2251 real(RP),
intent(in) :: var(:)
2252 character(len=*),
intent(in) :: varname
2253 character(len=*),
intent(in) :: axistype
2255 integer :: dim1_max, dim1_S, dim1_E
2256 real(RP),
allocatable :: var1D(:)
2262 if ( axistype ==
'Z' )
then 2266 elseif( axistype ==
'X' )
then 2270 elseif( axistype ==
'Y' )
then 2275 write(*,*)
'xxx unsupported axis type. Check!', trim(axistype),
' item:',trim(varname)
2279 allocate( var1d(dim1_max) )
2281 var1d(1:dim1_max) = var(dim1_s:dim1_e)
2282 call filewritevar( vid, var1d(:), nowsec, nowsec )
2310 integer,
intent(in) :: fid
2311 integer,
intent(in) :: vid
2312 real(RP),
intent(in) :: var(:,:)
2313 character(len=*),
intent(in) :: varname
2314 character(len=*),
intent(in) :: axistype
2315 logical,
optional,
intent(in) :: nohalo
2317 real(RP) :: varhalo( size(var(:,1)), size(var(1,:)) )
2319 integer :: dim1_max, dim1_S, dim1_E
2320 integer :: dim2_max, dim2_S, dim2_E
2321 real(RP),
allocatable :: var2D(:,:)
2330 if (
present(nohalo) ) nohalo_ = nohalo
2332 if ( axistype ==
'XY' )
then 2339 elseif ( axistype ==
'UY' )
then 2346 elseif ( axistype ==
'XV' )
then 2353 elseif ( axistype ==
'UV' )
then 2360 elseif( axistype ==
'ZX' )
then 2368 write(*,*)
'xxx unsupported axis type. Check!', trim(axistype),
' item:',trim(varname)
2372 varhalo(:,:) = var(:,:)
2378 varhalo(i,j) = rmiss
2384 varhalo(i,j) = rmiss
2390 varhalo(i,j) = rmiss
2396 varhalo(i,j) = rmiss
2401 allocate( var2d(dim1_max,dim2_max) )
2403 var2d(1:dim1_max,1:dim2_max) = varhalo(dim1_s:dim1_e,dim2_s:dim2_e)
2404 call filewritevar( vid, var2d(:,:), nowsec, nowsec )
2432 integer,
intent(in) :: fid
2433 integer,
intent(in) :: vid
2434 real(RP),
intent(in) :: var(:,:,:)
2435 character(len=*),
intent(in) :: varname
2436 character(len=*),
intent(in) :: axistype
2437 logical,
optional,
intent(in) :: nohalo
2439 real(RP) :: varhalo( size(var(:,1,1)), size(var(1,:,1)), size(var(1,1,:)) )
2441 integer :: dim1_max, dim1_S, dim1_E
2442 integer :: dim2_max, dim2_S, dim2_E
2443 integer :: dim3_max, dim3_S, dim3_E
2445 real(RP),
allocatable :: var3D(:,:,:)
2454 if (
present(nohalo) ) nohalo_ = nohalo
2456 if ( axistype ==
'ZXY' )
then 2466 elseif( axistype ==
'ZHXY' )
then 2476 elseif( axistype ==
'ZXHY' )
then 2486 elseif( axistype ==
'ZXYH' )
then 2496 elseif( axistype ==
'Land' )
then 2506 elseif( axistype ==
'Urban' )
then 2517 write(*,*)
'xxx unsupported axis type. Check!', trim(axistype),
' item:',trim(varname)
2521 varhalo(:,:,:) = var(:,:,:)
2528 varhalo(k,i,j) = rmiss
2536 varhalo(k,i,j) = rmiss
2544 varhalo(k,i,j) = rmiss
2552 varhalo(k,i,j) = rmiss
2558 allocate( var3d(dim1_max,dim2_max,dim3_max) )
2560 var3d(1:dim1_max,1:dim2_max,1:dim3_max) = varhalo(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e)
2561 call filewritevar( vid, var3d(:,:,:), nowsec, nowsec )
2589 integer,
intent(in) :: fid
2590 integer,
intent(in) :: vid
2591 real(RP),
intent(in) :: var(:,:,:)
2592 character(len=*),
intent(in) :: varname
2593 character(len=*),
intent(in) :: axistype
2594 real(RP),
intent(in) :: timeintv
2595 integer,
optional,
intent(in) :: timetarg
2596 logical,
optional,
intent(in) :: nohalo
2598 real(RP) :: varhalo( size(var(:,1,1)), size(var(1,:,1)) )
2600 integer :: dim1_max, dim1_S, dim1_E
2601 integer :: dim2_max, dim2_S, dim2_E
2603 real(RP),
allocatable :: var2D(:,:)
2604 real(DP) :: time_interval, nowtime
2614 if (
present(nohalo) ) nohalo_ = nohalo
2616 time_interval = timeintv
2617 step =
size(var(
isb,
jsb,:))
2619 if ( axistype ==
'XYT' )
then 2627 write(*,*)
'xxx unsupported axis type. Check!', trim(axistype),
' item:',trim(varname)
2631 allocate( var2d(dim1_max,dim2_max) )
2633 if (
present(timetarg) )
then 2634 varhalo(:,:) = var(:,:,timetarg)
2640 varhalo(i,j) = rmiss
2646 varhalo(i,j) = rmiss
2652 varhalo(i,j) = rmiss
2658 varhalo(i,j) = rmiss
2663 nowtime = (timetarg-1) * time_interval
2664 var2d(1:dim1_max,1:dim2_max) = varhalo(dim1_s:dim1_e,dim2_s:dim2_e)
2665 call filewritevar( vid, var2d(:,:), nowtime, nowtime )
2669 varhalo(:,:) = var(:,:,n)
2675 varhalo(i,j) = rmiss
2681 varhalo(i,j) = rmiss
2687 varhalo(i,j) = rmiss
2693 varhalo(i,j) = rmiss
2698 var2d(1:dim1_max,1:dim2_max) = varhalo(dim1_s:dim1_e,dim2_s:dim2_e)
2699 call filewritevar( vid, var2d(:,:), nowtime, nowtime )
2700 nowtime = nowtime + time_interval
2730 integer,
intent(in) :: fid
2731 integer,
intent(in) :: vid
2732 real(RP),
intent(in) :: var(:,:,:,:)
2733 character(len=*),
intent(in) :: varname
2734 character(len=*),
intent(in) :: axistype
2735 real(RP),
intent(in) :: timeintv
2736 integer,
optional,
intent(in) :: timetarg
2737 logical,
optional,
intent(in) :: nohalo
2739 real(RP) :: varhalo( size(var(:,1,1,1)), size(var(1,:,1,1)), size(var(1,1,:,1)) )
2741 integer :: dim1_max, dim1_S, dim1_E
2742 integer :: dim2_max, dim2_S, dim2_E
2743 integer :: dim3_max, dim3_S, dim3_E
2745 real(RP),
allocatable :: var3D(:,:,:)
2746 real(DP) :: time_interval, nowtime
2750 integer :: i, j, k, n
2757 if (
present(nohalo) ) nohalo_ = nohalo
2759 time_interval = timeintv
2762 if ( axistype ==
'ZXYT' )
then 2773 write(*,*)
'xxx unsupported axis type. Check!', trim(axistype),
' item:',trim(varname)
2777 allocate( var3d(dim1_max,dim2_max,dim3_max) )
2779 if (
present(timetarg) )
then 2780 varhalo(:,:,:) = var(:,:,:,timetarg)
2787 varhalo(k,i,j) = rmiss
2795 varhalo(k,i,j) = rmiss
2803 varhalo(k,i,j) = rmiss
2811 varhalo(k,i,j) = rmiss
2817 nowtime = (timetarg-1) * time_interval
2818 var3d(1:dim1_max,1:dim2_max,1:dim3_max) = varhalo(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e)
2819 call filewritevar( vid, var3d(:,:,:), nowtime, nowtime )
2823 varhalo(:,:,:) = var(:,:,:,n)
2830 varhalo(k,i,j) = rmiss
2838 varhalo(k,i,j) = rmiss
2846 varhalo(k,i,j) = rmiss
2854 varhalo(k,i,j) = rmiss
2860 var3d(1:dim1_max,1:dim2_max,1:dim3_max) = varhalo(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e)
2861 call filewritevar( vid, var3d(:,:,:), nowtime, nowtime )
2862 nowtime = nowtime + time_interval
integer, public imax
of computational cells: x
integer, public prc_num_x
x length of 2D processor topology
integer, public is
start point of inner domain: x, local
integer, public je
end point of inner domain: y, local
subroutine fileio_read_1d(var, basename, varname, axistype, step)
Read 1D data from file.
real(rp), dimension(:), allocatable, public grid_cyg
center coordinate [m]: y, global
subroutine, public prc_mpistop
Abort MPI.
real(rp), dimension(:), allocatable, public grid_cbfyg
center buffer factor [0-1]: y, global
real(dp), public time_nowms
subsecond part of current time [millisec]
real(rp), dimension(:), allocatable, public grid_cxg
center coordinate [m]: x, global
real(rp), dimension(:), allocatable, public grid_fdy
y-length of grid(j+1) to grid(j) [m]
logical, public io_l
output log or not? (this process)
subroutine fileio_def_axes(fid, dtype, xy)
define axis variables in the file
real(rp), dimension(:), allocatable, public grid_cz
center coordinate [m]: z, local=global
real(rp), dimension(:), allocatable, public grid_fxg
face coordinate [m]: x, global
subroutine fileio_write_var_3d(fid, vid, var, varname, axistype, nohalo)
Write 3D data to file.
real(rp), dimension(:), allocatable, public grid_fbfy
face buffer factor [0-1]: y
subroutine, public fileio_setup
Setup.
real(dp), public time_nowdaysec
second of current time [sec]
integer, public ke
end point of inner domain: z, local
subroutine fileio_write_3d_t(var, basename, title, varname, desc, unit, axistype, datatype, timeintv, tsince, append, timetarg, nohalo)
Write 3D data with time dimension to file.
real(rp), public const_d2r
degree to radian
subroutine fileio_write_4d(var, basename, title, varname, desc, unit, axistype, datatype, timeintv, tsince, append, timetarg, nohalo)
Write 4D data to file.
module GRID (cartesian) for land
subroutine fileio_write_axes(fid, xy)
write axis to the file
subroutine fileio_write_var_4d(fid, vid, var, varname, axistype, timeintv, timetarg, nohalo)
Write 4D data to file.
subroutine fileio_read_4d(var, basename, varname, axistype, step)
Read 4D data from file.
real(rp), dimension(:), allocatable, public grid_fx
face coordinate [m]: x, local
subroutine fileio_write_var_1d(fid, vid, var, varname, axistype)
Write 1D data to file.
real(rp), dimension(:), allocatable, public grid_lfz
face coordinate [m]: z, local=global
integer, public prc_num_y
y length of 2D processor topology
subroutine, public fileio_def_var(fid, vid, varname, desc, unit, axistype, datatype, timeintv)
Define a variable to file.
integer, public ia
of x whole cells (local, with HALO)
character(len=h_mid), public h_source
for file header
module GRID (cartesian) for urban
real(rp), dimension(:), allocatable, public grid_fbfx
face buffer factor [0-1]: x
real(rp), dimension(:), allocatable, public grid_fdz
z-length of grid(k+1) to grid(k) [m]
real(rp), dimension(:), allocatable, public grid_ufz
face coordinate [m]: z, local=global
integer, public ka
of z whole cells (local, with HALO)
real(rp), dimension(:), allocatable, public grid_fbfxg
face buffer factor [0-1]: x, global
subroutine fileio_write_2d(var, basename, title, varname, desc, unit, axistype, datatype, date, subsec, append, nohalo, nozcoord)
Write 2D data to file.
integer, public kmax
of computational cells: z
real(rp), dimension(:), allocatable, public grid_fz
face coordinate [m]: z, local=global
real(rp), dimension(:), allocatable, public grid_fbfz
face buffer factor [0-1]: z
subroutine fileio_write_3d(var, basename, title, varname, desc, unit, axistype, datatype, date, subsec, append, nohalo)
Write 3D data to file.
subroutine fileio_write_var_3d_t(fid, vid, var, varname, axistype, timeintv, timetarg, nohalo)
Write 3D data with time dimension to file.
subroutine, public fileio_create(fid, basename, title, datatype, date, subsec, append, nozcoord)
Create/open a netCDF file.
integer, public jhalo
of halo cells: y
integer, public js
start point of inner domain: y, local
real(rp), dimension(:), allocatable, public grid_cbfx
center buffer factor [0-1]: x
real(rp), dimension(:), allocatable, public grid_fbfyg
face buffer factor [0-1]: y, global
real(rp), dimension(:), allocatable, public grid_ucz
center coordinate [m]: z, local=global
integer, parameter, public prc_masterrank
master process in each communicator
integer, public ks
start point of inner domain: z, local
real(rp), dimension(:), allocatable, public grid_cbfz
center buffer factor [0-1]: z
integer, public prc_myrank
process num in local communicator
real(rp), dimension(:), allocatable, public grid_cx
center coordinate [m]: x, local
subroutine, public fileio_enddef(fid)
Exit netCDF file define mode.
subroutine, public prof_rapstart(rapname_base, level)
Start raptime.
integer, public ie
end point of inner domain: x, local
subroutine getcftunits(tunits, date)
character(len=h_mid), public h_institute
for file header
integer, dimension(:,:), allocatable, public prc_2drank
node index in 2D topology
real(rp), dimension(:), allocatable, public grid_cdz
z-length of control volume [m]
real(rp), dimension(:), allocatable, public grid_fdx
x-length of grid(i+1) to grid(i) [m]
real(rp), dimension(:), allocatable, public grid_lcz
center coordinate [m]: z, local=global
real(rp), dimension(:), allocatable, public grid_cdy
y-length of control volume [m]
real(rp), dimension(:), allocatable, public grid_cbfy
center buffer factor [0-1]: y
integer, dimension(6), public time_nowdate
current time [YYYY MM DD HH MM SS]
subroutine, public fileio_close(fid)
Close a netCDF file.
subroutine, public fileio_set_coordinates(LON, LONX, LONY, LONXY, LAT, LATX, LATY, LATXY, CZ, FZ)
set latlon and z
integer, public io_fid_log
Log file ID.
subroutine, public fileio_set_axes(fid, dtype, xy)
write axis to the file
subroutine, public prof_rapend(rapname_base, level)
Save raptime.
integer, parameter, public rp
real(rp), dimension(:), allocatable, public grid_cdx
x-length of control volume [m]
integer, public jmax
of computational cells: y
subroutine fileio_write_var_2d(fid, vid, var, varname, axistype, nohalo)
Write 2D data to file.
real(rp), dimension(:), allocatable, public grid_fyg
face coordinate [m]: y, global
real(rp), dimension(:), allocatable, public grid_cy
center coordinate [m]: y, local
subroutine fileio_read_2d(var, basename, varname, axistype, step)
Read 2D data from file.
real(rp), dimension(:), allocatable, public grid_cbfxg
center buffer factor [0-1]: x, global
subroutine fileio_read_3d(var, basename, varname, axistype, step)
Read 3D data from file.
integer, public ihalo
of halo cells: x
subroutine fileio_write_1d(var, basename, title, varname, desc, unit, axistype, datatype, date, subsec, append)
Write 1D data to file.
integer, public ja
of y whole cells (local, with HALO)
real(rp), dimension(:), allocatable, public grid_fy
face coordinate [m]: y, local