38 public :: file_cartesc_check_coordinates
40 public :: file_cartesc_get_size
46 public :: file_cartesc_write_var
47 public :: file_cartesc_read
48 public :: file_cartesc_write
52 interface file_cartesc_check_coordinates
53 module procedure file_cartesc_check_coordinates_name
54 module procedure file_cartesc_check_coordinates_id
55 end interface file_cartesc_check_coordinates
57 interface file_cartesc_get_size
59 module procedure file_cartesc_get_size_name
60 end interface file_cartesc_get_size
62 interface file_cartesc_read
64 module procedure file_cartesc_read_2d
65 module procedure file_cartesc_read_3d
66 module procedure file_cartesc_read_4d
67 module procedure file_cartesc_read_var_1d
73 end interface file_cartesc_read
75 interface file_cartesc_write
77 module procedure file_cartesc_write_2d
78 module procedure file_cartesc_write_3d
79 module procedure file_cartesc_write_3d_t
80 module procedure file_cartesc_write_4d
81 end interface file_cartesc_write
83 interface file_cartesc_write_var
89 end interface file_cartesc_write_var
96 integer :: size_global (1)
97 integer :: start_global(1)
98 integer :: halo_global (2)
99 integer :: halo_local (2)
104 character(len=H_SHORT) :: mapping_name
105 real(DP) :: false_easting (1)
106 real(DP) :: false_northing (1)
107 real(DP) :: longitude_of_central_meridian (1)
108 real(DP) :: longitude_of_projection_origin (1)
109 real(DP) :: latitude_of_projection_origin (1)
110 real(DP) :: straight_vertical_longitude_from_pole(1)
111 real(DP) :: standard_parallel (2)
127 real(RP),
private :: file_cartesc_datacheck_criteria
130 character(len=H_SHORT) :: name
132 character(len=H_SHORT) :: dims(3)
135 character(len=H_SHORT) :: area
136 character(len=H_SHORT) :: area_x
137 character(len=H_SHORT) :: area_y
138 character(len=H_SHORT) :: volume
139 character(len=H_SHORT) :: location
140 character(len=H_SHORT) :: grid
142 integer,
parameter :: file_cartesc_ndims = 40
143 type(dims) :: file_cartesc_dims(file_cartesc_ndims)
149 real(RP),
private,
allocatable :: axis_hgt (:,:,:)
150 real(RP),
private,
allocatable :: axis_hgtwxy(:,:,:)
152 real(RP),
private,
allocatable :: axis_lon (:,:)
153 real(RP),
private,
allocatable :: axis_lonuy(:,:)
154 real(RP),
private,
allocatable :: axis_lonxv(:,:)
155 real(RP),
private,
allocatable :: axis_lonuv(:,:)
156 real(RP),
private,
allocatable :: axis_lat (:,:)
157 real(RP),
private,
allocatable :: axis_latuy(:,:)
158 real(RP),
private,
allocatable :: axis_latxv(:,:)
159 real(RP),
private,
allocatable :: axis_latuv(:,:)
161 real(RP),
private,
allocatable :: axis_topo (:,:)
162 real(RP),
private,
allocatable :: axis_lsmask(:,:)
164 real(RP),
private,
allocatable :: axis_area (:,:)
165 real(RP),
private,
allocatable :: axis_areazuy_x(:,:,:)
166 real(RP),
private,
allocatable :: axis_areazxv_y(:,:,:)
167 real(RP),
private,
allocatable :: axis_areawuy_x(:,:,:)
168 real(RP),
private,
allocatable :: axis_areawxv_y(:,:,:)
169 real(RP),
private,
allocatable :: axis_areauy (:,:)
170 real(RP),
private,
allocatable :: axis_areazxy_x(:,:,:)
171 real(RP),
private,
allocatable :: axis_areazuv_y(:,:,:)
172 real(RP),
private,
allocatable :: axis_areaxv (:,:)
173 real(RP),
private,
allocatable :: axis_areazuv_x(:,:,:)
174 real(RP),
private,
allocatable :: axis_areazxy_y(:,:,:)
176 real(RP),
private,
allocatable :: axis_vol (:,:,:)
177 real(RP),
private,
allocatable :: axis_volwxy(:,:,:)
178 real(RP),
private,
allocatable :: axis_volzuy(:,:,:)
179 real(RP),
private,
allocatable :: axis_volzxv(:,:,:)
181 real(RP),
private,
allocatable :: axis_volo(:,:,:)
182 real(RP),
private,
allocatable :: axis_voll(:,:,:)
183 real(RP),
private,
allocatable :: axis_volu(:,:,:)
191 integer,
private :: startxy (3), countxy (3)
192 integer,
private :: startzx (2), countzx (2)
193 integer,
private :: startzxy (4), countzxy (4)
194 integer,
private :: startzhxy (4), countzhxy (4)
195 integer,
private :: startocean(3), countocean(3)
196 integer,
private :: startland (3), countland (3)
197 integer,
private :: starturban(3), counturban(3)
199 integer,
private :: isb2, ieb2, jsb2, jeb2
202 integer,
private :: etype
205 integer,
private :: centertypexy
206 integer,
private :: centertypezx
207 integer,
private :: centertypezxy
208 integer,
private :: centertypezhxy
209 integer,
private :: centertypeocean
210 integer,
private :: centertypeland
211 integer,
private :: centertypeurban
213 logical,
private :: set_coordinates = .false.
233 namelist / param_file_cartesc / &
234 file_cartesc_datacheck_criteria
244 log_info(
"FILE_CARTESC_setup",*)
'Setup' 246 file_cartesc_datacheck_criteria = eps * 10.0_rp
250 read(
io_fid_conf,nml=param_file_cartesc,iostat=ierr)
252 log_info(
"FILE_CARTESC_setup",*)
'Not found namelist. Default used.' 253 elseif( ierr > 0 )
then 254 log_error(
"FILE_CARTESC_setup",*)
'Not appropriate names in namelist PARAM_FILE_CARTESC. Check!' 257 log_nml(param_file_cartesc)
260 log_info(
"FILE_CARTESC_setup",*)
'NetCDF header information ' 261 log_info_cont(*)
'Data source : ', trim(
h_source)
265 log_info(
"FILE_CARTESC_setup",*)
'Data consistency criteria : ', &
266 '(file-internal)/internal = ', file_cartesc_datacheck_criteria
281 allocate( axis_hgt(
kmax ,im,jm) )
282 allocate( axis_hgtwxy(
kmax+1,im,jm) )
284 allocate( axis_lon(im,jm) )
285 allocate( axis_lonuy(im,jm) )
286 allocate( axis_lonxv(im,jm) )
287 allocate( axis_lonuv(im,jm) )
288 allocate( axis_lat(im,jm) )
289 allocate( axis_latuy(im,jm) )
290 allocate( axis_latxv(im,jm) )
291 allocate( axis_latuv(im,jm) )
293 allocate( axis_topo(im,jm) )
294 allocate( axis_lsmask(im,jm) )
296 allocate( axis_area( im,jm) )
297 allocate( axis_areazuy_x(
kmax, im,jm) )
298 allocate( axis_areazxv_y(
kmax, im,jm) )
299 allocate( axis_areawuy_x(
kmax+1,im,jm) )
300 allocate( axis_areawxv_y(
kmax+1,im,jm) )
301 allocate( axis_areauy( im,jm) )
302 allocate( axis_areazxy_x(
kmax, im,jm) )
303 allocate( axis_areazuv_y(
kmax, im,jm) )
304 allocate( axis_areaxv( im,jm) )
305 allocate( axis_areazuv_x(
kmax, im,jm) )
306 allocate( axis_areazxy_y(
kmax, im,jm) )
308 allocate( axis_vol(
kmax ,im,jm) )
309 allocate( axis_volwxy(
kmax+1,im,jm) )
310 allocate( axis_volzuy(
kmax ,im,jm) )
311 allocate( axis_volzxv(
kmax ,im,jm) )
313 allocate( axis_volo(
okmax,im,jm) )
314 allocate( axis_voll(
lkmax,im,jm) )
315 allocate( axis_volu(
ukmax,im,jm) )
319 write_buf_amount(:) = 0
330 deallocate( axis_hgt )
331 deallocate( axis_hgtwxy )
333 deallocate( axis_lon )
334 deallocate( axis_lonuy )
335 deallocate( axis_lonxv )
336 deallocate( axis_lonuv )
337 deallocate( axis_lat )
338 deallocate( axis_latuy )
339 deallocate( axis_latxv )
340 deallocate( axis_latuv )
342 deallocate( axis_topo )
343 deallocate( axis_lsmask )
345 deallocate( axis_area )
346 deallocate( axis_areazuy_x )
347 deallocate( axis_areazxv_y )
348 deallocate( axis_areawuy_x )
349 deallocate( axis_areawxv_y )
350 deallocate( axis_areauy )
351 deallocate( axis_areazxy_x )
352 deallocate( axis_areazuv_y )
353 deallocate( axis_areaxv )
354 deallocate( axis_areazuv_x )
355 deallocate( axis_areazxy_y )
357 deallocate( axis_vol )
358 deallocate( axis_volwxy )
359 deallocate( axis_volzuy )
360 deallocate( axis_volzxv )
362 deallocate( axis_volo )
363 deallocate( axis_voll )
364 deallocate( axis_volu )
378 subroutine file_cartesc_get_size_name( &
380 KMAX, OKMAX, LKMAX, UKMAX, &
382 KHALO, IHALO, JHALO, &
386 character(len=*),
intent(in) :: basename
388 integer,
intent(out) :: KMAX, OKMAX, LKMAX, UKMAX
389 integer,
intent(out) :: IMAXG, JMAXG
390 integer,
intent(out) :: KHALO, IHALO, JHALO
392 logical,
intent(in),
optional :: aggregate
398 aggregate=aggregate )
401 kmax, okmax, lkmax, ukmax, &
403 khalo, ihalo, jhalo )
406 end subroutine file_cartesc_get_size_name
409 KMAX, OKMAX, LKMAX, UKMAX, &
411 KHALO, IHALO, JHALO )
415 integer,
intent(in) :: fid
417 integer,
intent(out) :: KMAX, OKMAX, LKMAX, UKMAX
418 integer,
intent(out) :: IMAXG, JMAXG
419 integer,
intent(out) :: KHALO, IHALO, JHALO
424 call file_get_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_kmax", buf(:) )
426 call file_get_attribute( fid,
"global",
"scale_ocean_grid_cartesC_index_kmax", buf(:), existed=existed )
432 call file_get_attribute( fid,
"global",
"scale_land_grid_cartesC_index_kmax", buf(:), existed=existed )
438 call file_get_attribute( fid,
"global",
"scale_urban_grid_cartesC_index_kmax", buf(:), existed=existed )
445 call file_get_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_imaxg", buf(:) )
447 call file_get_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_jmaxg", buf(:) )
450 call file_get_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_khalo", buf(:) )
452 call file_get_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_ihalo", buf(:) )
454 call file_get_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_jhalo", buf(:) )
464 LON, LONUY, LONXV, LONUV, &
465 LAT, LATUY, LATXV, LATUV, &
467 AREA, AREAZUY_X, AREAZXV_Y, &
468 AREAWUY_X, AREAWXV_Y, &
469 AREAUY, AREAZXY_X, AREAZUV_Y, &
470 AREAXV, AREAZUV_X, AREAZXY_Y, &
471 VOL, VOLWXY, VOLZUY, VOLZXV )
477 real(RP),
intent(in) :: CZ(
ka,
ia,
ja)
478 real(RP),
intent(in) :: FZ(0:
ka,
ia,
ja)
479 real(RP),
intent(in) :: LON (
ia,
ja)
480 real(RP),
intent(in) :: LONUY(0:
ia,
ja)
481 real(RP),
intent(in) :: LONXV(
ia,0:
ja)
482 real(RP),
intent(in) :: LONUV(0:
ia,0:
ja)
483 real(RP),
intent(in) :: LAT (
ia,
ja)
484 real(RP),
intent(in) :: LATUY(0:
ia,
ja)
485 real(RP),
intent(in) :: LATXV(
ia,0:
ja)
486 real(RP),
intent(in) :: LATUV(0:
ia,0:
ja)
487 real(RP),
intent(in) :: TOPO (
ia,
ja)
488 real(RP),
intent(in) :: LSMASK(
ia,
ja)
489 real(RP),
intent(in) :: AREA (
ia,
ja)
490 real(RP),
intent(in) :: AREAZUY_X(
ka,
ia,
ja)
491 real(RP),
intent(in) :: AREAZXV_Y(
ka,
ia,
ja)
492 real(RP),
intent(in) :: AREAWUY_X(0:
ka,
ia,
ja)
493 real(RP),
intent(in) :: AREAWXV_Y(0:
ka,
ia,
ja)
494 real(RP),
intent(in) :: AREAUY (
ia,
ja)
495 real(RP),
intent(in) :: AREAZXY_X(
ka,
ia,
ja)
496 real(RP),
intent(in) :: AREAZUV_Y(
ka,
ia,
ja)
497 real(RP),
intent(in) :: AREAXV (
ia,
ja)
498 real(RP),
intent(in) :: AREAZUV_X(
ka,
ia,
ja)
499 real(RP),
intent(in) :: AREAZXY_Y(
ka,
ia,
ja)
500 real(RP),
intent(in) :: VOL (
ka,
ia,
ja)
501 real(RP),
intent(in) :: VOLWXY(0:
ka,
ia,
ja)
502 real(RP),
intent(in) :: VOLZUY(
ka,
ia,
ja)
503 real(RP),
intent(in) :: VOLZXV(
ka,
ia,
ja)
506 axis_hgt(:,:,:) = cz(
ks :
ke,isb2:ieb2,jsb2:jeb2)
507 axis_hgtwxy(:,:,:) = fz(
ks-1:
ke,isb2:ieb2,jsb2:jeb2)
509 axis_lon(:,:) = lon(isb2:ieb2,jsb2:jeb2) / d2r
510 axis_lonuy(:,:) = lonuy(isb2:ieb2,jsb2:jeb2) / d2r
511 axis_lonxv(:,:) = lonxv(isb2:ieb2,jsb2:jeb2) / d2r
512 axis_lonuv(:,:) = lonuv(isb2:ieb2,jsb2:jeb2) / d2r
513 axis_lat(:,:) = lat(isb2:ieb2,jsb2:jeb2) / d2r
514 axis_latuy(:,:) = latuy(isb2:ieb2,jsb2:jeb2) / d2r
515 axis_latxv(:,:) = latxv(isb2:ieb2,jsb2:jeb2) / d2r
516 axis_latuv(:,:) = latuv(isb2:ieb2,jsb2:jeb2) / d2r
518 axis_topo(:,:) = topo(isb2:ieb2,jsb2:jeb2)
519 axis_lsmask(:,:) = lsmask(isb2:ieb2,jsb2:jeb2)
521 axis_area(:,:) = area( isb2:ieb2,jsb2:jeb2)
522 axis_areazuy_x(:,:,:) = areazuy_x(
ks :
ke,isb2:ieb2,jsb2:jeb2)
523 axis_areazxv_y(:,:,:) = areazxv_y(
ks :
ke,isb2:ieb2,jsb2:jeb2)
524 axis_areawuy_x(:,:,:) = areazuy_x(
ks-1:
ke,isb2:ieb2,jsb2:jeb2)
525 axis_areawxv_y(:,:,:) = areazxv_y(
ks-1:
ke,isb2:ieb2,jsb2:jeb2)
526 axis_areauy(:,:) = areauy( isb2:ieb2,jsb2:jeb2)
527 axis_areazxy_x(:,:,:) = areazxy_x(
ks :
ke,isb2:ieb2,jsb2:jeb2)
528 axis_areazuv_y(:,:,:) = areazuv_y(
ks :
ke,isb2:ieb2,jsb2:jeb2)
529 axis_areaxv(:,:) = areaxv( isb2:ieb2,jsb2:jeb2)
530 axis_areazuv_x(:,:,:) = areazuv_x(
ks :
ke,isb2:ieb2,jsb2:jeb2)
531 axis_areazxy_y(:,:,:) = areazxy_y(
ks :
ke,isb2:ieb2,jsb2:jeb2)
533 axis_vol(:,:,:) = vol(
ks :
ke,isb2:ieb2,jsb2:jeb2)
534 axis_volwxy(:,:,:) = volwxy(
ks-1:
ke,isb2:ieb2,jsb2:jeb2)
535 axis_volzuy(:,:,:) = volzuy(
ks :
ke,isb2:ieb2,jsb2:jeb2)
536 axis_volzxv(:,:,:) = volzxv(
ks :
ke,isb2:ieb2,jsb2:jeb2)
538 set_coordinates = .true.
552 axis_volo(:,:,:) = vol(
oks:
oke,isb2:ieb2,jsb2:jeb2)
566 axis_voll(:,:,:) = vol(
lks:
lke,isb2:ieb2,jsb2:jeb2)
580 axis_volu(:,:,:) = vol(
uks:
uke,isb2:ieb2,jsb2:jeb2)
587 subroutine file_cartesc_check_coordinates_name( &
589 atmos, ocean, land, urban, &
593 character(len=*),
intent(in) :: basename
594 logical,
intent(in),
optional :: atmos
595 logical,
intent(in),
optional :: ocean
596 logical,
intent(in),
optional :: land
597 logical,
intent(in),
optional :: urban
598 logical,
intent(in),
optional :: transpose
604 logical :: transpose_
615 if(
present(atmos) ) atmos_ = atmos
616 if(
present(ocean) ) ocean_ = ocean
617 if(
present(land ) ) land_ = land
618 if(
present(urban) ) urban_ = urban
619 if(
present(transpose) ) transpose_ = transpose
624 call file_cartesc_check_coordinates_id( fid, &
625 atmos_, ocean_, land_, urban_, &
629 end subroutine file_cartesc_check_coordinates_name
633 subroutine file_cartesc_check_coordinates_id( &
635 atmos, ocean, land, urban, &
649 integer,
intent(in) :: fid
650 logical,
intent(in),
optional :: atmos
651 logical,
intent(in),
optional :: ocean
652 logical,
intent(in),
optional :: land
653 logical,
intent(in),
optional :: urban
654 logical,
intent(in),
optional :: transpose
660 logical :: transpose_
662 real(RP) :: buffer_z (
ka)
663 real(RP) :: buffer_x (
ia)
664 real(RP) :: buffer_y (
ja)
665 real(RP) :: buffer_xy (
ia,
ja)
666 real(RP) :: buffer_zxy(
ka,
ia,
ja)
667 real(RP) :: buffer_o (
okmax)
668 real(RP) :: buffer_l (
lkmax)
669 real(RP) :: buffer_u (
ukmax)
671 integer :: XSB, XEB, YSB, YEB
675 log_info(
"FILE_CARTESC_check_coordinates_id",*)
'Check consistency of axis ' 683 if(
present(atmos) ) atmos_ = atmos
684 if(
present(ocean) ) ocean_ = ocean
685 if(
present(land ) ) land_ = land
686 if(
present(urban) ) urban_ = urban
687 if(
present(transpose) ) transpose_ = transpose
695 call file_cartesc_read_var_1d( fid,
'x',
'X', buffer_x(:) )
696 call file_cartesc_read_var_1d( fid,
'y',
'Y', buffer_y(:) )
701 if ( set_coordinates )
then 704 call check_2d( axis_lon(xsb:xeb,ysb:yeb), buffer_xy(
isb:
ieb,
jsb:
jeb),
'lon' )
708 call check_2d( axis_lat(xsb:xeb,ysb:yeb), buffer_xy(
isb:
ieb,
jsb:
jeb),
'lat' )
712 call file_cartesc_read_var_1d( fid,
'z',
'Z', buffer_z(:) )
713 if ( .not. transpose_ )
then 718 if ( .not. transpose_ )
then 719 call check_3d( axis_hgt(:,xsb:xeb,ysb:yeb), buffer_zxy(
ks:
ke,
isb:
ieb,
jsb:
jeb),
'height', transpose_ )
724 call file_cartesc_read_var_1d( fid,
'oz',
'OZ', buffer_o(:) )
730 call file_cartesc_read_var_1d( fid,
'lz',
'LZ', buffer_l(:) )
736 call file_cartesc_read_var_1d( fid,
'uz',
'UZ', buffer_u(:) )
742 end subroutine file_cartesc_check_coordinates_id
759 character(len=*),
intent(in) :: basename
760 integer,
intent(out) :: fid
761 logical,
intent(in),
optional :: aggregate
768 aggregate=aggregate, &
779 basename, title, datatype, &
783 append, aggregate, single )
807 character(len=*),
intent(in) :: basename
808 character(len=*),
intent(in) :: title
809 character(len=*),
intent(in) :: datatype
810 integer,
intent(out) :: fid
811 integer,
intent(in),
optional :: date(6)
812 real(DP),
intent(in),
optional :: subsec
813 logical,
intent(in),
optional :: append
814 logical,
intent(in),
optional :: haszcoord
815 logical,
intent(in),
optional :: aggregate
816 logical,
intent(in),
optional :: single
820 character(len=34) :: tunits
821 character(len=H_SHORT) :: calendar
823 integer :: rank_x, rank_y
824 integer :: num_x, num_y
825 logical :: fileexisted
826 logical :: aggregate_
832 if (
present(single) )
then 839 if ( datatype ==
'REAL8' )
then 841 elseif( datatype ==
'REAL4' )
then 846 elseif(
rp == 4 )
then 849 log_error(
"FILE_CARTESC_create",*)
'unsupported data type. Check!', trim(datatype)
855 if (
present(append) )
then 860 if (
present(date) )
then 863 else if ( nowdate(1) > 0 )
then 873 if (
present(aggregate) )
then 874 aggregate_ = aggregate
887 aggregate = aggregate_, &
888 time_units = tunits, &
889 calendar = calendar, &
895 else if ( .not. fileexisted )
then 897 file_axes_written(fid) = .false.
899 if (
present( haszcoord ) )
then 900 file_haszcoord(fid) = haszcoord
902 file_haszcoord(fid) = .true.
905 if ( aggregate_ )
then 917 if (
present( subsec ) )
then 930 subsec_, tunits, calendar )
934 file_haszcoord(fid) )
954 integer,
intent(in) :: fid
966 if ( .NOT. file_axes_written(fid) )
then 979 file_haszcoord(fid), &
988 file_axes_written(fid) = .true.
1005 integer,
intent(in) :: fid
1032 integer,
intent(in) :: fid
1041 if ( write_buf_amount(fid) > 0 )
then 1043 write_buf_amount(fid) = 0
1061 basename, varname, &
1066 character(len=*),
intent(in) :: basename
1067 character(len=*),
intent(in) :: varname
1068 character(len=*),
intent(in) :: dim_type
1070 real(RP),
intent(out) :: var(:)
1072 integer,
intent(in),
optional :: step
1073 logical,
intent(in),
optional :: aggregate
1082 call file_cartesc_read_var_1d( fid, varname, dim_type, &
1093 subroutine file_cartesc_read_2d( &
1094 basename, varname, &
1099 character(len=*),
intent(in) :: basename
1100 character(len=*),
intent(in) :: varname
1101 character(len=*),
intent(in) :: dim_type
1103 real(RP),
intent(out) :: var(:,:)
1105 integer,
intent(in),
optional :: step
1106 logical,
intent(in),
optional :: aggregate
1122 end subroutine file_cartesc_read_2d
1126 subroutine file_cartesc_read_3d( &
1127 basename, varname, &
1132 character(len=*),
intent(in) :: basename
1133 character(len=*),
intent(in) :: varname
1134 character(len=*),
intent(in) :: dim_type
1136 real(RP),
intent(out) :: var(:,:,:)
1138 integer,
intent(in),
optional :: step
1139 logical,
intent(in),
optional :: aggregate
1155 end subroutine file_cartesc_read_3d
1159 subroutine file_cartesc_read_4d( &
1160 basename, varname, &
1165 character(len=*),
intent(in) :: basename
1166 character(len=*),
intent(in) :: varname
1167 character(len=*),
intent(in) :: dim_type
1169 real(RP),
intent(out) :: var(:,:,:,:)
1171 integer,
intent(in),
optional :: step
1172 logical,
intent(in),
optional :: aggregate
1188 end subroutine file_cartesc_read_4d
1192 subroutine file_cartesc_read_var_1d( &
1208 integer,
intent(in) :: fid
1209 character(len=*),
intent(in) :: varname
1210 character(len=*),
intent(in) :: dim_type
1212 real(RP),
intent(out) :: var(:)
1214 integer,
intent(in),
optional :: step
1216 integer :: dim1_S, dim1_E
1225 log_info(
"FILE_CARTESC_read_var_1D",
'(1x,2A)')
'Read from file (1D), name : ', trim(varname)
1229 if ( dim_type ==
'Z' )
then 1232 call file_read( fid, varname, &
1234 step=step, ntypes=
kmax, dtype=etype, start=start, count=count )
1235 elseif( dim_type ==
'OZ' )
then 1238 call file_read( fid, varname, &
1240 step=step, ntypes=
okmax, dtype=etype, start=start, count=count )
1241 elseif( dim_type ==
'LZ' )
then 1244 call file_read( fid, varname, &
1246 step=step, ntypes=
lkmax, dtype=etype, start=start, count=count )
1247 elseif( dim_type ==
'UZ' )
then 1250 call file_read( fid, varname, &
1252 step=step, ntypes=
ukmax, dtype=etype, start=start, count=count )
1253 elseif( dim_type ==
'X' .OR. dim_type ==
'CX' )
then 1256 call file_read( fid, varname, &
1258 step=step, ntypes=
ia, dtype=etype, start=start, count=count )
1259 elseif( dim_type ==
'Y' .OR. dim_type ==
'CY' )
then 1262 call file_read( fid, varname, &
1264 step=step, ntypes=
ja, dtype=etype, start=start, count=count )
1266 log_error(
"FILE_CARTESC_read_var_1D",*)
'unsupported dimension type. Check! dim_type:', trim(dim_type),
', item:',trim(varname)
1270 if ( dim_type ==
'Z' )
then 1273 elseif( dim_type ==
'OZ' )
then 1276 elseif( dim_type ==
'LZ' )
then 1279 elseif( dim_type ==
'UZ' )
then 1282 elseif( dim_type ==
'X' )
then 1285 elseif( dim_type ==
'CX' )
then 1288 elseif( dim_type ==
'Y' )
then 1291 elseif( dim_type ==
'CY' )
then 1295 log_error(
"FILE_CARTESC_read_var_1D",*)
'unsupported dimension type. Check! dim_type:', trim(dim_type),
', item:',trim(varname)
1299 call file_read( fid, varname, var(dim1_s:dim1_e), step=step )
1305 end subroutine file_cartesc_read_var_1d
1321 integer,
intent(in) :: fid
1322 character(len=*),
intent(in) :: varname
1323 character(len=*),
intent(in) :: dim_type
1325 real(RP),
intent(out) :: var(:,:)
1327 integer,
intent(in),
optional :: step
1329 integer :: dim1_S, dim1_E
1330 integer :: dim2_S, dim2_E
1337 log_info(
"FILE_CARTESC_read_var_2D",
'(1x,2A)')
'Read from file (2D), name : ', trim(varname)
1341 if ( dim_type ==
'XY' )
then 1342 call file_read( fid, varname, &
1344 step=step, ntypes=
ia*
ja, dtype=etype, start=startxy, count=countxy )
1345 elseif( dim_type ==
'ZX' )
then 1348 call file_read( fid, varname, &
1350 step=step, ntypes=1, dtype=centertypezx, start=startzx, count=countzx )
1352 log_error(
"FILE_CARTESC_read_var_2D",*)
'unsupported dimension type. Check! dim_type:', trim(dim_type),
', item:',trim(varname)
1356 if ( dim_type ==
'XY' )
then 1361 elseif( dim_type ==
'ZX' )
then 1367 log_error(
"FILE_CARTESC_read_var_2D",*)
'unsupported dimension type. Check! dim_type:', trim(dim_type),
', item:',trim(varname)
1371 call file_read( fid, varname, var(dim1_s:dim1_e,dim2_s:dim2_e), step=step )
1396 integer,
intent(in) :: fid
1397 character(len=*),
intent(in) :: varname
1398 character(len=*),
intent(in) :: dim_type
1400 real(RP),
intent(out) :: var(:,:,:)
1402 integer,
intent(in),
optional :: step
1404 integer :: dim1_S, dim1_E
1405 integer :: dim2_S, dim2_E
1406 integer :: dim3_S, dim3_E
1413 log_info(
"FILE_CARTESC_read_var_3D",
'(1x,2A)')
'Read from file (3D), name : ', trim(varname)
1419 if( dim_type ==
'ZXY' &
1420 .or. dim_type ==
'ZXHY' &
1421 .or. dim_type ==
'ZXYH' )
then 1422 call file_read( fid, varname, &
1424 step=step, ntypes=1, dtype=centertypezxy, start=startzxy, count=countzxy )
1425 elseif( dim_type ==
'ZHXY' )
then 1426 call file_read( fid, varname, &
1428 step=step, ntypes=1, dtype=centertypezhxy, start=startzhxy, count=countzhxy )
1429 elseif( dim_type ==
'XYT' )
then 1432 call file_read( fid, varname, &
1434 step=step, ntypes=step*
ia*
ja, dtype=etype, start=startxy, count=countxy )
1435 elseif( dim_type ==
'OXY' )
then 1436 call file_read( fid, varname, &
1438 step=step, ntypes=1, dtype=centertypeocean, start=startocean, count=countocean )
1439 elseif( dim_type ==
'LXY' )
then 1440 call file_read( fid, varname, &
1442 step=step, ntypes=1, dtype=centertypeland, start=startland, count=countland )
1443 elseif( dim_type ==
'UXY' )
then 1444 call file_read( fid, varname, &
1446 step=step, ntypes=1, dtype=centertypeurban, start=starturban, count=counturban )
1448 log_error(
"FILE_CARTESC_read_var_3D",*)
'unsupported dimension type. Check! dim_type:', trim(dim_type),
', item:',trim(varname)
1452 if( dim_type ==
'ZXY' &
1453 .or. dim_type ==
'ZXHY' &
1454 .or. dim_type ==
'ZXYH' )
then 1461 elseif( dim_type ==
'ZHXY' )
then 1468 elseif( dim_type ==
'XYT' )
then 1475 elseif( dim_type ==
'OXY' )
then 1482 elseif( dim_type ==
'LXY' )
then 1489 elseif( dim_type ==
'UXY' )
then 1497 log_error(
"FILE_CARTESC_read_var_3D",*)
'unsupported dimension type. Check! dim_type:', trim(dim_type),
', item:',trim(varname)
1501 call file_read( fid, varname, var(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e), step=step )
1527 integer,
intent(in) :: fid
1528 character(len=*),
intent(in) :: varname
1529 character(len=*),
intent(in) :: dim_type
1531 real(RP),
intent(out) :: var(:,:,:,:)
1533 integer,
intent(in),
optional :: step
1535 integer :: dim1_S, dim1_E
1536 integer :: dim2_S, dim2_E
1537 integer :: dim3_S, dim3_E
1538 integer :: dim4_S, dim4_E
1545 log_info(
"FILE_CARTESC_read_var_4D",
'(1x,2A)')
'Read from file (4D), name : ', trim(varname)
1549 if ( dim_type ==
'ZXYT' &
1550 .or. dim_type ==
'ZXHYT' &
1551 .or. dim_type ==
'ZXYHT' )
then 1554 call file_read( fid, varname, &
1556 step=step, ntypes=step, dtype=centertypezxy, start=startzxy, count=countzxy )
1557 elseif ( dim_type ==
'ZHXYT' )
then 1560 call file_read( fid, varname, &
1562 step=step, ntypes=step, dtype=centertypezhxy, start=startzhxy, count=countzhxy )
1564 log_error(
"FILE_CARTESC_read_var_4D",*)
'unsupported dimension type. Check! dim_type:', trim(dim_type),
', item:',trim(varname)
1568 if ( dim_type ==
'ZXYT' &
1569 .or. dim_type ==
'ZXHYT' &
1570 .or. dim_type ==
'ZXYHT' )
then 1579 elseif ( dim_type ==
'ZHXYT' )
then 1588 elseif ( dim_type ==
'OXYT' )
then 1598 log_error(
"FILE_CARTESC_read_var_4D",*)
'unsupported dimension type. Check! dim_type:', trim(dim_type),
', item:',trim(varname)
1602 call file_read( fid, varname, &
1603 var(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e,dim4_s:dim4_e), &
1621 file_get_datainfo, &
1622 file_get_attribute, &
1627 integer,
intent(in) :: fid
1628 character(len=*),
intent(in) :: varname
1630 real(RP),
intent(out) :: var(:,:)
1632 integer,
intent(in),
optional :: step
1634 logical,
intent(out),
optional :: existed
1640 character(len=H_SHORT) :: dnames(2)
1654 log_info(
"FILE_CARTESC_read_auto_2D",
'(1x,2A)')
'Read from file (2D), name : ', trim(varname)
1656 call file_get_datainfo( fid, varname, dim_name=dnames(:), existed=existed2 )
1658 if (
present( existed ) )
then 1660 if ( .not. existed2 )
return 1663 if ( .not. existed2 )
then 1664 log_error(
"FILE_CARTESC_read_auto_2D",*)
'variable not found: ', trim(varname)
1668 call file_get_shape( fid, varname, dims(:) )
1672 if ( nx==dims(1) .and. ny==dims(2) )
then 1676 call file_get_attribute( fid, dnames(n),
"halo_local", halos(:), existed=existed2 )
1677 if ( existed2 )
then 1678 start(n) = halos(1) + 1
1684 count(:) = (/nx,ny/)
1686 call file_read( fid, varname, var(:,:), step=step, start=start(:), count=count(:) )
1702 file_get_datainfo, &
1703 file_get_attribute, &
1708 integer,
intent(in) :: fid
1709 character(len=*),
intent(in) :: varname
1711 real(RP),
intent(out) :: var(:,:,:)
1713 integer,
intent(in),
optional :: step
1715 logical,
intent(out),
optional :: existed
1721 character(len=H_SHORT) :: dnames(3)
1725 real(RP),
allocatable :: buf(:,:,:)
1726 integer :: nx, ny, nz
1737 log_info(
"FILE_CARTESC_read_auto_3D",
'(1x,2A)')
'Read from file (3D), name : ', trim(varname)
1739 call file_get_datainfo( fid, varname, dim_name=dnames(:), existed=existed2 )
1741 if (
present(existed) )
then 1743 if ( .not. existed2 )
return 1746 if ( .not. existed2 )
then 1747 log_error(
"FILE_CARTESC_read_auto_3D",*)
'variable not found: ', trim(varname)
1751 call file_get_shape( fid, varname, dims(:) )
1756 if ( ( dnames(1)(1:1)==
"z" .or. dnames(1)(2:2)==
"z" ) .and. dnames(2)(1:1)==
"x" .and. dnames(3)(1:1)==
"y" )
then 1757 if ( nz==dims(1) .and. nx==dims(2) .and. ny==dims(3) )
then 1758 start(:) = (/1,1,1/)
1759 else if ( dnames(1)==
"zh" .and. nz+1==dims(1) .and. nx==dims(2) .and. ny==dims(3) )
then 1760 start(:) = (/2,1,1/)
1763 call file_get_attribute( fid, dnames(n),
"halo_local", halos(:), existed=existed2 )
1764 if ( existed2 )
then 1765 start(n) = halos(1) + 1
1766 else if ( dnames(n)==
"zh" )
then 1773 count(:) = (/nz,nx,ny/)
1774 call file_read( fid, varname, var(:,:,:), step=step, start=start(:), count=count(:) )
1775 else if ( dnames(1)(1:1)==
"x" .and. dnames(2)(1:1)==
"y" .and. ( dnames(3)(1:1)==
"z" .or. dnames(3)(2:2)==
"z" ) )
then 1776 allocate( buf(nx,ny,nz) )
1777 if ( nx==dims(1) .and. ny==dims(2) .and. nz==dims(3) )
then 1778 start(:) = (/1,1,1/)
1779 else if ( nx==dims(1) .and. ny==dims(2) .and. nz+1==dims(3) .and. dnames(3)==
"zh" )
then 1780 start(:) = (/1,1,2/)
1783 call file_get_attribute( fid, dnames(n),
"halo_local", halos(:), existed=existed2 )
1784 if ( existed2 )
then 1785 start(n) = halos(1) + 1
1786 else if ( dnames(n)==
"zh" )
then 1793 count(:) = (/nx,ny,nz/)
1794 call file_read( fid, varname, buf(:,:,:), step=step, start=start(:), count=count(:) )
1799 var(k,i,j) = buf(i,j,k)
1805 log_error(
"FILE_CARTESC_read_auto_3D",*)
'invalid dimension' 1823 varname, desc, unit, &
1824 dim_type, datatype, &
1826 append, aggregate, &
1831 real(RP),
intent(in) :: var(:)
1832 character(len=*),
intent(in) :: basename
1833 character(len=*),
intent(in) :: title
1834 character(len=*),
intent(in) :: varname
1835 character(len=*),
intent(in) :: desc
1836 character(len=*),
intent(in) :: unit
1837 character(len=*),
intent(in) :: dim_type
1838 character(len=*),
intent(in) :: datatype
1840 integer,
intent(in),
optional :: date(6)
1841 real(DP),
intent(in),
optional :: subsec
1842 logical,
intent(in),
optional :: append
1843 logical,
intent(in),
optional :: aggregate
1844 character(len=*),
intent(in),
optional :: standard_name
1845 character(len=*),
intent(in),
optional :: cell_measures
1850 log_info(
"FILE_CARTESC_write_1D",
'(1x,2A)')
'Write to file (1D), name : ', trim(varname)
1854 date=date, subsec=subsec, &
1855 append=append, aggregate=aggregate, single=.true. )
1859 standard_name=standard_name, &
1860 cell_measures=cell_measures )
1871 subroutine file_cartesc_write_2d( &
1874 varname, desc, unit, &
1875 dim_type, datatype, &
1877 fill_halo, haszcoord, &
1878 append, aggregate, &
1883 real(RP),
intent(in) :: var(:,:)
1884 character(len=*),
intent(in) :: basename
1885 character(len=*),
intent(in) :: title
1886 character(len=*),
intent(in) :: varname
1887 character(len=*),
intent(in) :: desc
1888 character(len=*),
intent(in) :: unit
1889 character(len=*),
intent(in) :: dim_type
1890 character(len=*),
intent(in) :: datatype
1892 integer,
intent(in),
optional :: date(6)
1893 real(DP),
intent(in),
optional :: subsec
1894 logical,
intent(in),
optional :: fill_halo
1895 logical,
intent(in),
optional :: haszcoord
1896 logical,
intent(in),
optional :: append
1897 logical,
intent(in),
optional :: aggregate
1898 character(len=*),
intent(in),
optional :: standard_name
1899 character(len=*),
intent(in),
optional :: cell_measures
1904 log_info(
"FILE_CARTESC_write_2D",
'(1x,2A)')
'Write to file (2D), name : ', trim(varname)
1908 date=date, subsec=subsec, &
1909 haszcoord=haszcoord, &
1910 append=append, aggregate=aggregate )
1914 standard_name=standard_name, &
1915 cell_measures=cell_measures )
1922 end subroutine file_cartesc_write_2d
1926 subroutine file_cartesc_write_3d( &
1929 varname, desc, unit, &
1930 dim_type, datatype, &
1933 append, aggregate, &
1938 real(RP),
intent(in) :: var(:,:,:)
1939 character(len=*),
intent(in) :: basename
1940 character(len=*),
intent(in) :: title
1941 character(len=*),
intent(in) :: varname
1942 character(len=*),
intent(in) :: desc
1943 character(len=*),
intent(in) :: unit
1944 character(len=*),
intent(in) :: dim_type
1945 character(len=*),
intent(in) :: datatype
1947 integer,
intent(in),
optional :: date(6)
1948 real(DP),
intent(in),
optional :: subsec
1949 logical,
intent(in),
optional :: fill_halo
1950 logical,
intent(in),
optional :: append
1951 logical,
intent(in),
optional :: aggregate
1952 character(len=*),
intent(in),
optional :: standard_name
1953 character(len=*),
intent(in),
optional :: cell_measures
1958 log_info(
"FILE_CARTESC_write_3D",
'(1x,2A)')
'Write to file (3D), name : ', trim(varname)
1962 date=date, subsec=subsec, &
1963 append=append, aggregate=aggregate )
1967 standard_name=standard_name, &
1968 cell_measures=cell_measures )
1976 end subroutine file_cartesc_write_3d
1980 subroutine file_cartesc_write_3d_t( &
1983 varname, desc, unit, &
1984 dim_type, datatype, &
1986 timetarg, timeofs, &
1988 append, aggregate, &
1993 real(RP),
intent(in) :: var(:,:,:)
1994 character(len=*),
intent(in) :: basename
1995 character(len=*),
intent(in) :: title
1996 character(len=*),
intent(in) :: varname
1997 character(len=*),
intent(in) :: desc
1998 character(len=*),
intent(in) :: unit
1999 character(len=*),
intent(in) :: dim_type
2000 character(len=*),
intent(in) :: datatype
2001 real(DP),
intent(in) :: timeintv
2002 integer ,
intent(in) :: tsince(6)
2004 integer,
intent(in),
optional :: timetarg
2005 real(DP),
intent(in),
optional :: timeofs
2006 logical,
intent(in),
optional :: fill_halo
2007 logical,
intent(in),
optional :: append
2008 logical,
intent(in),
optional :: aggregate
2009 character(len=*),
intent(in),
optional :: standard_name
2010 character(len=*),
intent(in),
optional :: cell_measures
2018 log_info(
"FILE_CARTESC_write_3D_t",
'(1x,3A)')
'Write to file (3D), name : ', trim(varname),
'with time dimension' 2023 append=append, aggregate=aggregate )
2025 if (
present(timetarg) )
then 2028 nsteps =
size(var,3)
2032 standard_name=standard_name, &
2033 cell_measures=cell_measures, &
2034 timeintv=timeintv, nsteps=nsteps )
2039 timetarg, timeofs, fill_halo )
2042 end subroutine file_cartesc_write_3d_t
2046 subroutine file_cartesc_write_4d( &
2049 varname, desc, unit, &
2050 dim_type, datatype, &
2052 timetarg, timeofs, &
2054 append, aggregate, &
2059 real(RP),
intent(in) :: var(:,:,:,:)
2060 character(len=*),
intent(in) :: basename
2061 character(len=*),
intent(in) :: title
2062 character(len=*),
intent(in) :: varname
2063 character(len=*),
intent(in) :: desc
2064 character(len=*),
intent(in) :: unit
2065 character(len=*),
intent(in) :: dim_type
2066 character(len=*),
intent(in) :: datatype
2067 real(DP),
intent(in) :: timeintv
2068 integer,
intent(in) :: tsince(6)
2070 integer,
intent(in),
optional :: timetarg
2071 real(DP),
intent(in),
optional :: timeofs
2072 logical,
intent(in),
optional :: fill_halo
2073 logical,
intent(in),
optional :: append
2074 logical,
intent(in),
optional :: aggregate
2075 character(len=*),
intent(in),
optional :: standard_name
2076 character(len=*),
intent(in),
optional :: cell_measures
2084 log_info(
"FILE_CARTESC_write_4D",
'(1x,2A)')
'Write to file (4D), name : ', trim(varname)
2089 append=append, aggregate=aggregate )
2091 if (
present(timetarg) )
then 2094 nsteps =
size(var,3)
2098 standard_name=standard_name, &
2099 cell_measures=cell_measures, &
2100 timeintv=timeintv, nsteps=nsteps )
2105 timetarg, timeofs, fill_halo )
2108 end subroutine file_cartesc_write_4d
2114 prc_rank_x, prc_rank_y, &
2115 prc_num_x, prc_num_y, &
2116 prc_periodic_x, prc_periodic_y, &
2117 kmax, okmax, lkmax, ukmax, &
2119 khalo, ihalo, jhalo, &
2120 time, tunits, calendar )
2127 integer,
intent(in) :: fid
2128 integer,
intent(in) :: prc_rank_x, prc_rank_y
2129 integer,
intent(in) :: prc_num_x, prc_num_y
2130 logical,
intent(in) :: prc_periodic_x, prc_periodic_y
2131 integer,
intent(in) :: kmax, okmax, lkmax, ukmax
2132 integer,
intent(in) :: imaxg, jmaxg
2133 integer,
intent(in) :: khalo, ihalo, jhalo
2134 real(DP),
intent(in) :: time
2135 character(len=*),
intent(in) :: tunits
2136 character(len=*),
intent(in) :: calendar
2143 call file_set_attribute( fid,
"global",
"Conventions",
"CF-1.6" )
2147 call file_set_attribute( fid,
"global",
"scale_cartesC_prc_rank_x", (/prc_rank_x/) )
2148 call file_set_attribute( fid,
"global",
"scale_cartesC_prc_rank_y", (/prc_rank_y/) )
2150 call file_set_attribute( fid,
"global",
"scale_cartesC_prc_num_x", (/prc_num_x/) )
2151 call file_set_attribute( fid,
"global",
"scale_cartesC_prc_num_y", (/prc_num_y/) )
2153 call file_set_attribute( fid,
"global",
"scale_cartesC_prc_periodic_z", .false. )
2154 call file_set_attribute( fid,
"global",
"scale_cartesC_prc_periodic_x", prc_periodic_x )
2155 call file_set_attribute( fid,
"global",
"scale_cartesC_prc_periodic_y", prc_periodic_y )
2157 call file_set_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_imaxg", (/imaxg/) )
2158 call file_set_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_jmaxg", (/jmaxg/) )
2160 call file_set_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_kmax", (/kmax/) )
2161 if ( okmax > 0 )
call file_set_attribute( fid,
"global",
"scale_ocean_grid_cartesC_index_kmax", (/okmax/) )
2162 if ( lkmax > 0 )
call file_set_attribute( fid,
"global",
"scale_land_grid_cartesC_index_kmax", (/lkmax/) )
2163 if ( ukmax > 0 )
call file_set_attribute( fid,
"global",
"scale_urban_grid_cartesC_index_kmax", (/ukmax/) )
2165 call file_set_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_khalo", (/khalo/) )
2166 call file_set_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_ihalo", (/ihalo/) )
2167 call file_set_attribute( fid,
"global",
"scale_atmos_grid_cartesC_index_jhalo", (/jhalo/) )
2169 if ( calendar /=
"" )
call file_set_attribute( fid,
"global",
"calendar", calendar )
2170 call file_set_attribute( fid,
"global",
"time_units", tunits )
2171 call file_set_attribute( fid,
"global",
"time_start", (/time/) )
2188 file_set_attribute, &
2195 integer,
intent(in) :: fid
2196 integer,
intent(in) :: dtype
2197 logical,
intent(in) :: hasZ
2204 character(len=2) :: axisname(3)
2206 logical,
save :: set_dim = .false.
2214 if ( .not. set_dim )
then 2233 call file_def_axis( fid,
'zh' ,
'Z (half level)' ,
'm',
'zh' , dtype,
kmax+1, bounds=.true. )
2235 if (
okmax > 0 )
then 2237 call file_def_axis( fid,
'ozh',
'OZ (half level)',
'm',
'ozh', dtype,
okmax+1, bounds=.true. )
2240 if (
lkmax > 0 )
then 2242 call file_def_axis( fid,
'lzh',
'LZ (half level)',
'm',
'lzh', dtype,
lkmax+1, bounds=.true. )
2245 if (
ukmax > 0 )
then 2247 call file_def_axis( fid,
'uzh',
'UZ (half level)',
'm',
'uzh', dtype,
ukmax+1, bounds=.true. )
2251 call file_def_axis( fid,
'x' ,
'X' ,
'm',
'x' , dtype, isize, bounds=.true. )
2252 call file_def_axis( fid,
'xh' ,
'X (half level)' ,
'm',
'xh' , dtype, isize, bounds=.true. )
2253 call file_def_axis( fid,
'y' ,
'Y' ,
'm',
'y' , dtype, jsize, bounds=.true. )
2254 call file_def_axis( fid,
'yh' ,
'Y (half level)' ,
'm',
'yh' , dtype, jsize, bounds=.true. )
2257 call file_def_axis( fid,
'CZ' ,
'Atmos Grid Center Position Z',
'm',
'CZ', dtype,
ka )
2258 call file_def_axis( fid,
'FZ' ,
'Atmos Grid Face Position Z',
'm',
'FZ', dtype,
ka+1 )
2259 call file_def_axis( fid,
'CDZ' ,
'Grid Cell length Z',
'm',
'CZ', dtype,
ka )
2260 call file_def_axis( fid,
'FDZ' ,
'Grid distance Z',
'm',
'FDZ', dtype,
ka-1 )
2261 call file_def_axis( fid,
'CBFZ' ,
'Boundary factor Center Z',
'1',
'CZ', dtype,
ka )
2262 call file_def_axis( fid,
'FBFZ' ,
'Boundary factor Face Z',
'1',
'FZ', dtype,
ka+1 )
2264 if (
okmax > 0 )
then 2265 call file_def_axis( fid,
'OCZ' ,
'Ocean Grid Center Position Z',
'm',
'OCZ', dtype,
okmax )
2266 call file_def_axis( fid,
'OFZ' ,
'Ocean Grid Face Position Z',
'm',
'OFZ', dtype,
okmax+1 )
2267 call file_def_axis( fid,
'OCDZ' ,
'Ocean Grid Cell length Z',
'm',
'OCZ', dtype,
okmax )
2270 if (
lkmax > 0 )
then 2271 call file_def_axis( fid,
'LCZ' ,
'Land Grid Center Position Z',
'm',
'LCZ', dtype,
lkmax )
2272 call file_def_axis( fid,
'LFZ' ,
'Land Grid Face Position Z',
'm',
'LFZ', dtype,
lkmax+1 )
2273 call file_def_axis( fid,
'LCDZ' ,
'Land Grid Cell length Z',
'm',
'LCZ', dtype,
lkmax )
2276 if (
ukmax > 0 )
then 2277 call file_def_axis( fid,
'UCZ' ,
'Urban Grid Center Position Z',
'm',
'UCZ', dtype,
ukmax )
2278 call file_def_axis( fid,
'UFZ' ,
'Urban Grid Face Position Z',
'm',
'UFZ', dtype,
ukmax+1 )
2279 call file_def_axis( fid,
'UCDZ' ,
'Urban Grid Cell length Z',
'm',
'UCZ', dtype,
ukmax )
2283 call file_def_axis( fid,
'CX' ,
'Atmos Grid Center Position X',
'm',
'CX', dtype, iall )
2284 call file_def_axis( fid,
'CY' ,
'Atmos Grid Center Position Y',
'm',
'CY', dtype, jall )
2285 call file_def_axis( fid,
'FX' ,
'Atmos Grid Face Position X',
'm',
'FX', dtype, iall+1 )
2286 call file_def_axis( fid,
'FY' ,
'Atmos Grid Face Position Y',
'm',
'FY', dtype, jall+1 )
2287 call file_def_axis( fid,
'CDX' ,
'Grid Cell length X',
'm',
'CX', dtype, iall )
2288 call file_def_axis( fid,
'CDY' ,
'Grid Cell length Y',
'm',
'CY', dtype, jall )
2289 call file_def_axis( fid,
'FDX' ,
'Grid distance X',
'm',
'FX', dtype, iall+1 )
2290 call file_def_axis( fid,
'FDY' ,
'Grid distance Y',
'm',
'FY', dtype, jall+1 )
2291 call file_def_axis( fid,
'CBFX' ,
'Boundary factor Center X',
'1',
'CX', dtype, iall )
2292 call file_def_axis( fid,
'CBFY' ,
'Boundary factor Center Y',
'1',
'CY', dtype, jall )
2293 call file_def_axis( fid,
'FBFX' ,
'Boundary factor Face X',
'1',
'FX', dtype, iall+1 )
2294 call file_def_axis( fid,
'FBFY' ,
'Boundary factor Face Y',
'1',
'FY', dtype, jall+1 )
2296 call file_def_axis( fid,
'CXG' ,
'Grid Center Position X (global)',
'm',
'CXG', dtype,
iag )
2297 call file_def_axis( fid,
'CYG' ,
'Grid Center Position Y (global)',
'm',
'CYG', dtype,
jag )
2298 call file_def_axis( fid,
'FXG' ,
'Grid Face Position X (global)',
'm',
'FXG', dtype,
iag+1 )
2299 call file_def_axis( fid,
'FYG' ,
'Grid Face Position Y (global)',
'm',
'FYG', dtype,
jag+1 )
2300 call file_def_axis( fid,
'CDXG' ,
'Grid Cell length X (global)',
'm',
'CXG', dtype,
iag )
2301 call file_def_axis( fid,
'CDYG' ,
'Grid Cell length Y (global)',
'm',
'CYG', dtype,
jag )
2302 call file_def_axis( fid,
'FDXG' ,
'Grid distance X (global)',
'm',
'FXG', dtype,
iag+1 )
2303 call file_def_axis( fid,
'FDYG' ,
'Grid distance Y (global)',
'm',
'FYG', dtype,
jag+1 )
2304 call file_def_axis( fid,
'CBFXG',
'Boundary factor Center X (global)',
'1',
'CXG', dtype,
iag )
2305 call file_def_axis( fid,
'CBFYG',
'Boundary factor Center Y (global)',
'1',
'CYG', dtype,
jag )
2306 call file_def_axis( fid,
'FBFXG',
'Boundary factor Face X (global)',
'1',
'FXG', dtype,
iag+1 )
2307 call file_def_axis( fid,
'FBFYG',
'Boundary factor Face Y (global)',
'1',
'FYG', dtype,
jag+1 )
2310 axisname(1:2) = (/
'x ',
'y '/)
2312 axisname(1:2) = (/
'xh',
'y '/)
2314 axisname(1:2) = (/
'x ',
'yh'/)
2316 axisname(1:2) = (/
'xh',
'yh'/)
2318 axisname(1:2) = (/
'x ',
'y '/)
2320 axisname(1:2) = (/
'xh',
'y '/)
2322 axisname(1:2) = (/
'x ',
'yh'/)
2324 axisname(1:2) = (/
'xh',
'yh'/)
2327 axisname(1:2) = (/
'x ',
'y '/)
2329 axisname(1:2) = (/
'x ',
'y '/)
2332 axisname(1:2) = (/
'x ',
'y '/)
2334 axisname(1:2) = (/
'xh',
'y '/)
2336 axisname(1:2) = (/
'x ',
'yh'/)
2338 axisname(1:2) = (/
'xh',
'yh'/)
2341 axisname = (/
'z ',
'x ',
'y '/)
2343 'm', axisname(1:3), dtype )
2344 axisname = (/
'zh',
'x ',
'y '/)
2346 'm', axisname(1:3), dtype )
2348 axisname = (/
'z ',
'xh',
'y '/)
2350 'm2', axisname(1:3), dtype )
2351 axisname = (/
'z ',
'x ',
'yh'/)
2353 'm2', axisname(1:3), dtype )
2354 axisname = (/
'zh',
'xh',
'y '/)
2356 'm2', axisname(1:3), dtype )
2357 axisname = (/
'zh',
'x ',
'yh'/)
2359 'm2', axisname(1:3), dtype )
2360 axisname = (/
'z ',
'x ',
'y '/)
2362 'm2', axisname(1:3), dtype )
2363 axisname = (/
'z ',
'xh',
'yh'/)
2365 'm2', axisname(1:3), dtype )
2366 axisname = (/
'z ',
'xh',
'yh'/)
2368 'm2', axisname(1:3), dtype )
2369 axisname = (/
'z ',
'x ',
'y '/)
2371 'm2', axisname(1:3), dtype )
2373 axisname = (/
'z ',
'x ',
'y '/)
2375 'm3', axisname(1:3), dtype )
2376 axisname = (/
'zh',
'x ',
'y '/)
2378 'm3', axisname(1:3), dtype )
2379 axisname = (/
'z ',
'xh',
'y '/)
2381 'm3', axisname(1:3), dtype )
2382 axisname = (/
'z ',
'x ',
'yh'/)
2384 'm3', axisname(1:3), dtype )
2386 if (
okmax > 0 )
then 2387 axisname = (/
'oz',
'x ',
'y '/)
2389 'm3', axisname(1:3), dtype )
2391 if (
lkmax > 0 )
then 2392 axisname = (/
'lz',
'x ',
'y '/)
2394 'm3', axisname(1:3), dtype )
2396 if (
ukmax > 0 )
then 2397 axisname = (/
'uz',
'x ',
'y '/)
2399 'm3', axisname(1:3), dtype )
2406 if (
okmax > 0 )
then 2407 call file_set_attribute( fid,
'oz' ,
'positive',
'down' )
2408 call file_set_attribute( fid,
'ozh',
'positive',
'down' )
2410 if (
lkmax > 0 )
then 2411 call file_set_attribute( fid,
'lz' ,
'positive',
'down' )
2412 call file_set_attribute( fid,
'lzh',
'positive',
'down' )
2414 if (
ukmax > 0 )
then 2415 call file_set_attribute( fid,
'uz' ,
'positive',
'down' )
2416 call file_set_attribute( fid,
'uzh',
'positive',
'down' )
2418 if (
okmax > 0 )
then 2419 call file_set_attribute( fid,
'OCZ',
'positive',
'down' )
2420 call file_set_attribute( fid,
'OFZ',
'positive',
'down' )
2422 if (
lkmax > 0 )
then 2423 call file_set_attribute( fid,
'LCZ',
'positive',
'down' )
2424 call file_set_attribute( fid,
'LFZ',
'positive',
'down' )
2426 if (
ukmax > 0 )
then 2427 call file_set_attribute( fid,
'UCZ',
'positive',
'down' )
2428 call file_set_attribute( fid,
'UFZ',
'positive',
'down' )
2433 call file_set_attribute( fid,
"x" ,
"size_global" , (/
iag /) )
2434 call file_set_attribute( fid,
"x" ,
"start_global", (/ 1 /) )
2435 call file_set_attribute( fid,
"x" ,
"halo_global" , (/
ihalo,
ihalo /) )
2436 call file_set_attribute( fid,
"x" ,
"halo_local" , (/
ihalo,
ihalo /) )
2438 call file_set_attribute( fid,
"xh",
"size_global" , (/
iag+1 /) )
2439 call file_set_attribute( fid,
"xh",
"start_global", (/ 1 /) )
2440 call file_set_attribute( fid,
"xh",
"halo_global" , (/
ihalo,
ihalo /) )
2441 call file_set_attribute( fid,
"xh",
"halo_local" , (/
ihalo,
ihalo /) )
2443 call file_set_attribute( fid,
"y" ,
"size_global" , (/
jag /) )
2444 call file_set_attribute( fid,
"y" ,
"start_global", (/ 1 /) )
2445 call file_set_attribute( fid,
"y" ,
"halo_global" , (/
jhalo,
jhalo /) )
2446 call file_set_attribute( fid,
"y" ,
"halo_local" , (/
jhalo,
jhalo /) )
2448 call file_set_attribute( fid,
"yh",
"size_global" , (/
jag+1 /) )
2449 call file_set_attribute( fid,
"yh",
"start_global", (/ 1 /) )
2450 call file_set_attribute( fid,
"yh",
"halo_global" , (/
jhalo,
jhalo /) )
2451 call file_set_attribute( fid,
"yh",
"halo_local" , (/
jhalo,
jhalo /) )
2453 call file_set_attribute( fid,
"x" ,
"size_global" , file_cartesc_axis_info(1)%size_global (:) )
2454 call file_set_attribute( fid,
"x" ,
"start_global", file_cartesc_axis_info(1)%start_global(:) )
2455 call file_set_attribute( fid,
"x" ,
"halo_global" , file_cartesc_axis_info(1)%halo_global (:) )
2456 call file_set_attribute( fid,
"x" ,
"halo_local" , file_cartesc_axis_info(1)%halo_local (:) )
2458 call file_set_attribute( fid,
"xh",
"size_global" , file_cartesc_axis_info(2)%size_global (:) )
2459 call file_set_attribute( fid,
"xh",
"start_global", file_cartesc_axis_info(2)%start_global(:) )
2460 call file_set_attribute( fid,
"xh",
"halo_global" , file_cartesc_axis_info(2)%halo_global (:) )
2461 call file_set_attribute( fid,
"xh",
"halo_local" , file_cartesc_axis_info(2)%halo_local (:) )
2463 call file_set_attribute( fid,
"y" ,
"size_global" , file_cartesc_axis_info(3)%size_global (:) )
2464 call file_set_attribute( fid,
"y" ,
"start_global", file_cartesc_axis_info(3)%start_global(:) )
2465 call file_set_attribute( fid,
"y" ,
"halo_global" , file_cartesc_axis_info(3)%halo_global (:) )
2466 call file_set_attribute( fid,
"y" ,
"halo_local" , file_cartesc_axis_info(3)%halo_local (:) )
2468 call file_set_attribute( fid,
"yh",
"size_global" , file_cartesc_axis_info(4)%size_global (:) )
2469 call file_set_attribute( fid,
"yh",
"start_global", file_cartesc_axis_info(4)%start_global(:) )
2470 call file_set_attribute( fid,
"yh",
"halo_global" , file_cartesc_axis_info(4)%halo_global (:) )
2471 call file_set_attribute( fid,
"yh",
"halo_local" , file_cartesc_axis_info(4)%halo_local (:) )
2474 call file_set_attribute( fid,
"x" ,
"periodic" , file_cartesc_axis_info(1)%periodic )
2475 call file_set_attribute( fid,
"xh",
"periodic" , file_cartesc_axis_info(2)%periodic )
2476 call file_set_attribute( fid,
"y" ,
"periodic" , file_cartesc_axis_info(3)%periodic )
2477 call file_set_attribute( fid,
"yh",
"periodic" , file_cartesc_axis_info(4)%periodic )
2481 if ( file_cartesc_mapping_info%mapping_name /=
"" )
then 2482 call file_set_attribute( fid,
"x" ,
"standard_name",
"projection_x_coordinate" )
2483 call file_set_attribute( fid,
"xh",
"standard_name",
"projection_x_coordinate" )
2484 call file_set_attribute( fid,
"y" ,
"standard_name",
"projection_y_coordinate" )
2485 call file_set_attribute( fid,
"yh",
"standard_name",
"projection_y_coordinate" )
2488 call file_set_attribute( fid, file_cartesc_mapping_info%mapping_name,
"grid_mapping_name", file_cartesc_mapping_info%mapping_name )
2490 if ( file_cartesc_mapping_info%false_easting(1) /= undef )
then 2491 call file_set_attribute( fid, &
2492 file_cartesc_mapping_info%mapping_name, &
2494 file_cartesc_mapping_info%false_easting(:) )
2497 if ( file_cartesc_mapping_info%false_northing(1) /= undef )
then 2498 call file_set_attribute( fid, &
2499 file_cartesc_mapping_info%mapping_name, &
2501 file_cartesc_mapping_info%false_northing(:) )
2504 if ( file_cartesc_mapping_info%longitude_of_central_meridian(1) /= undef )
then 2505 call file_set_attribute( fid, &
2506 file_cartesc_mapping_info%mapping_name, &
2507 "longitude_of_central_meridian", &
2508 file_cartesc_mapping_info%longitude_of_central_meridian(:) )
2511 if ( file_cartesc_mapping_info%longitude_of_projection_origin(1) /= undef )
then 2512 call file_set_attribute( fid, &
2513 file_cartesc_mapping_info%mapping_name, &
2514 "longitude_of_projection_origin", &
2515 file_cartesc_mapping_info%longitude_of_projection_origin(:) )
2518 if ( file_cartesc_mapping_info%latitude_of_projection_origin(1) /= undef )
then 2519 call file_set_attribute( fid, &
2520 file_cartesc_mapping_info%mapping_name, &
2521 "latitude_of_projection_origin", &
2522 file_cartesc_mapping_info%latitude_of_projection_origin(:) )
2525 if ( file_cartesc_mapping_info%straight_vertical_longitude_from_pole(1) /= undef )
then 2526 call file_set_attribute( fid, &
2527 file_cartesc_mapping_info%mapping_name, &
2528 "straight_vertical_longitude_from_pole", &
2529 file_cartesc_mapping_info%straight_vertical_longitude_from_pole(:) )
2532 if ( file_cartesc_mapping_info%standard_parallel(1) /= undef )
then 2533 if ( file_cartesc_mapping_info%standard_parallel(2) /= undef )
then 2534 call file_set_attribute( fid, &
2535 file_cartesc_mapping_info%mapping_name, &
2536 "standard_parallel", &
2537 file_cartesc_mapping_info%standard_parallel(1:2) )
2539 call file_set_attribute( fid, &
2540 file_cartesc_mapping_info%mapping_name, &
2541 "standard_parallel", &
2542 file_cartesc_mapping_info%standard_parallel(1:1) )
2549 call file_set_attribute( fid,
"cell_area",
"standard_name",
"area" )
2550 call file_set_attribute( fid,
"cell_area_uy",
"standard_name",
"area" )
2551 call file_set_attribute( fid,
"cell_area_xv",
"standard_name",
"area" )
2554 call file_set_attribute( fid,
"cell_area_zuy_x",
"standard_name",
"area" )
2555 call file_set_attribute( fid,
"cell_area_zxv_y",
"standard_name",
"area" )
2556 call file_set_attribute( fid,
"cell_area_wuy_x",
"standard_name",
"area" )
2557 call file_set_attribute( fid,
"cell_area_wxv_y",
"standard_name",
"area" )
2558 call file_set_attribute( fid,
"cell_area_zxy_x",
"standard_name",
"area" )
2559 call file_set_attribute( fid,
"cell_area_zuv_y",
"standard_name",
"area" )
2560 call file_set_attribute( fid,
"cell_area_zuv_x",
"standard_name",
"area" )
2561 call file_set_attribute( fid,
"cell_area_zxy_y",
"standard_name",
"area" )
2563 call file_set_attribute( fid,
"cell_volume",
"standard_name",
"volume" )
2564 call file_set_attribute( fid,
"cell_volume_wxy",
"standard_name",
"volume" )
2565 call file_set_attribute( fid,
"cell_volume_zuy",
"standard_name",
"volume" )
2566 call file_set_attribute( fid,
"cell_volume_zxv",
"standard_name",
"volume" )
2568 if (
okmax > 0 )
then 2569 call file_set_attribute( fid,
"cell_volume_oxy",
"standard_name",
"volume" )
2571 if (
lkmax > 0 )
then 2572 call file_set_attribute( fid,
"cell_volume_lxy",
"standard_name",
"volume" )
2574 if (
ukmax > 0 )
then 2575 call file_set_attribute( fid,
"cell_volume_uxy",
"standard_name",
"volume" )
2581 call file_set_attribute( fid,
"grid",
"cf_role",
"grid_topology" )
2582 call file_set_attribute( fid,
"grid",
"topology_dimension", (/ 2 /) )
2583 call file_set_attribute( fid,
"grid",
"node_dimensions",
"xh yh" )
2584 call file_set_attribute( fid,
"grid",
"face_dimensions",
"x: xh (padding: none) y: yh (padding: none)" )
2585 call file_set_attribute( fid,
"grid",
"node_coordinates",
"lon_uv lat_uv" )
2586 call file_set_attribute( fid,
"grid",
"face_coordinates",
"lon lat" )
2587 call file_set_attribute( fid,
"grid",
"edge1_coordinates",
"lon_uy lat_uy" )
2588 call file_set_attribute( fid,
"grid",
"edge2_coordinates",
"lon_xv lat_xv" )
2589 call file_set_attribute( fid,
"grid",
"vertical_dimensions",
"z: zh (padding: none)" )
2591 if (
okmax > 0 )
then 2593 call file_set_attribute( fid,
"grid_ocean",
"cf_role",
"grid_topology" )
2594 call file_set_attribute( fid,
"grid_ocean",
"topology_dimension", (/ 2 /) )
2595 call file_set_attribute( fid,
"grid_ocean",
"node_dimensions",
"xh yh" )
2596 call file_set_attribute( fid,
"grid_ocean",
"face_dimensions",
"x: xh (padding: none) y: yh (padding: none)" )
2597 call file_set_attribute( fid,
"grid_ocean",
"node_coordinates",
"lon_uv lat_uv" )
2598 call file_set_attribute( fid,
"grid_ocean",
"face_coordinates",
"lon lat" )
2599 call file_set_attribute( fid,
"grid_ocean",
"edge1_coordinates",
"lon_uy lat_uy" )
2600 call file_set_attribute( fid,
"grid_ocean",
"edge2_coordinates",
"lon_xv lat_xv" )
2601 call file_set_attribute( fid,
"grid_ocean",
"vertical_dimensions",
"oz: ozh (padding: none)" )
2604 if (
lkmax > 0 )
then 2606 call file_set_attribute( fid,
"grid_land",
"cf_role",
"grid_topology" )
2607 call file_set_attribute( fid,
"grid_land",
"topology_dimension", (/ 2 /) )
2608 call file_set_attribute( fid,
"grid_land",
"node_dimensions",
"xh yh" )
2609 call file_set_attribute( fid,
"grid_land",
"face_dimensions",
"x: xh (padding: none) y: yh (padding: none)" )
2610 call file_set_attribute( fid,
"grid_land",
"node_coordinates",
"lon_uv lat_uv" )
2611 call file_set_attribute( fid,
"grid_land",
"face_coordinates",
"lon lat" )
2612 call file_set_attribute( fid,
"grid_land",
"edge1_coordinates",
"lon_uy lat_uy" )
2613 call file_set_attribute( fid,
"grid_land",
"edge2_coordinates",
"lon_xv lat_xv" )
2614 call file_set_attribute( fid,
"grid_land",
"vertical_dimensions",
"lz: lzh (padding: none)" )
2617 if (
ukmax > 0 )
then 2619 call file_set_attribute( fid,
"grid_urban",
"cf_role",
"grid_topology" )
2620 call file_set_attribute( fid,
"grid_urban",
"topology_dimension", (/ 2 /) )
2621 call file_set_attribute( fid,
"grid_urban",
"node_dimensions",
"xh yh" )
2622 call file_set_attribute( fid,
"grid_urban",
"face_dimensions",
"x: xh (padding: none) y: yh (padding: none)" )
2623 call file_set_attribute( fid,
"grid_urban",
"node_coordinates",
"lon_uv lat_uv" )
2624 call file_set_attribute( fid,
"grid_urban",
"face_coordinates",
"lon lat" )
2625 call file_set_attribute( fid,
"grid_urban",
"edge1_coordinates",
"lon_uy lat_uy" )
2626 call file_set_attribute( fid,
"grid_urban",
"edge2_coordinates",
"lon_xv lat_xv" )
2627 call file_set_attribute( fid,
"grid_urban",
"vertical_dimensions",
"uz: uzh (padding: none)" )
2631 call file_set_attribute( fid,
"grid_model",
"cf_role",
"grid_topology" )
2632 call file_set_attribute( fid,
"grid_model",
"topology_dimension", (/ 2 /) )
2633 call file_set_attribute( fid,
"grid_model",
"node_dimensions",
"FX FY" )
2634 call file_set_attribute( fid,
"grid_model",
"face_dimensions",
"CX: FY (padding: none) CY: FY (padding: none)" )
2635 call file_set_attribute( fid,
"grid_model",
"vertical_dimensions",
"CZ: FZ (padding: none)" )
2638 call file_set_attribute( fid,
"grid_model_global",
"cf_role",
"grid_topology" )
2639 call file_set_attribute( fid,
"grid_model_global",
"topology_dimension", (/ 2 /) )
2640 call file_set_attribute( fid,
"grid_model_global",
"node_dimensions",
"FXG FYG" )
2641 call file_set_attribute( fid,
"grid_model_global",
"face_dimensions",
"CXG: FYG (padding: none) CYG: FYG (padding: none)" )
2642 call file_set_attribute( fid,
"grid_model_global",
"vertical_dimensions",
"CZ: FZ (padding: none)" )
2661 file_write_associatedcoordinate
2712 integer,
intent(in) :: fid
2713 logical,
intent(in) :: haszcoord
2714 integer,
intent(in) :: start(3)
2716 logical :: put_z, put_x, put_y
2717 integer :: XSB, XEB, YSB, YEB
2719 real(RP) :: z_bnds(2,
ka), zh_bnds(2,0:
ka)
2720 real(RP) :: oz_bnds(2,
oka), ozh_bnds(2,0:
oka)
2721 real(RP) :: lz_bnds(2,
lka), lzh_bnds(2,0:
lka)
2722 real(RP) :: uz_bnds(2,
uka), uzh_bnds(2,0:
uka)
2723 real(RP) :: x_bnds(2,
ia), xh_bnds(2,0:
ia)
2724 real(RP) :: y_bnds(2,
ja), yh_bnds(2,0:
ja)
2726 real(RP) :: FDXG(0:
iag), FDYG(0:
jag)
2727 real(RP) :: FDX(0:
ia), FDY(0:
ja)
2757 if ( haszcoord .and. put_z )
then 2764 call file_write_associatedcoordinate( fid,
'z_bnds', z_bnds(:,
ks:
ke), start(1:1) )
2771 call file_write_associatedcoordinate( fid,
'zh_bnds', zh_bnds(:,
ks-1:
ke), start(1:1) )
2774 if (
okmax > 0 )
then 2780 call file_write_associatedcoordinate( fid,
'oz_bnds', oz_bnds(:,
oks:
oke), start(1:1) )
2789 call file_write_associatedcoordinate( fid,
'ozh_bnds', ozh_bnds(:,
oks-1:
oke), start(1:1) )
2793 if (
lkmax > 0 )
then 2799 call file_write_associatedcoordinate( fid,
'lz_bnds', lz_bnds(:,
lks:
lke), start(1:1) )
2808 call file_write_associatedcoordinate( fid,
'lzh_bnds', lzh_bnds(:,
lks-1:
lke), start(1:1) )
2812 if (
ukmax > 0 )
then 2818 call file_write_associatedcoordinate( fid,
'uz_bnds', uz_bnds(:,
uks:
uke), start(1:1) )
2827 call file_write_associatedcoordinate( fid,
'uzh_bnds', uzh_bnds(:,
uks-1:
uke), start(1:1) )
2838 call file_write_associatedcoordinate( fid,
'x_bnds', x_bnds(:,isb2:ieb2), (/1,start(2)/) )
2846 if ( ieb2 ==
ia )
then 2851 call file_write_associatedcoordinate( fid,
'xh_bnds', xh_bnds(:,isb2:ieb2), (/1,start(2)/) )
2858 call file_write_associatedcoordinate( fid,
'x_bnds', x_bnds(:,
isb:
ieb), (/1,start(2)/) )
2866 if (
ieb ==
ia )
then 2871 call file_write_associatedcoordinate( fid,
'xh_bnds', xh_bnds(:,
isb:
ieb), (/1,start(2)/) )
2882 call file_write_associatedcoordinate( fid,
'y_bnds', y_bnds(:,jsb2:jeb2), (/1,start(2)/) )
2890 if ( jeb2 ==
ja )
then 2895 call file_write_associatedcoordinate( fid,
'yh_bnds', yh_bnds(:,jsb2:jeb2), (/1,start(2)/) )
2902 call file_write_associatedcoordinate( fid,
'y_bnds', y_bnds(:,
jsb:
jeb), (/1,start(2)/) )
2910 if (
jeb ==
ja )
then 2915 call file_write_associatedcoordinate( fid,
'yh_bnds', yh_bnds(:,
jsb:
jeb), (/1,start(2)/) )
2934 if ( haszcoord .and. put_z )
then 2942 if (
okmax > 0 )
then 2948 if (
lkmax > 0 )
then 2954 if (
ukmax > 0 )
then 2970 call file_write_axis( fid,
'FDX', fdxg(:) )
2971 call file_write_axis( fid,
'FDY', fdyg(:) )
2984 call file_write_axis( fid,
'FDX', fdx(:) )
2985 call file_write_axis( fid,
'FDY', fdy(:) )
2998 call file_write_axis( fid,
'FDXG', fdxg(:) )
2999 call file_write_axis( fid,
'FDYG', fdyg(:) )
3007 call file_write_associatedcoordinate( fid,
'lon' , axis_lon(:,:), start(2:3) )
3008 call file_write_associatedcoordinate( fid,
'lon_uy', axis_lonuy(:,:), start(2:3) )
3009 call file_write_associatedcoordinate( fid,
'lon_xv', axis_lonxv(:,:), start(2:3) )
3010 call file_write_associatedcoordinate( fid,
'lon_uv', axis_lonuv(:,:), start(2:3) )
3011 call file_write_associatedcoordinate( fid,
'lat' , axis_lat(:,:), start(2:3) )
3012 call file_write_associatedcoordinate( fid,
'lat_uy', axis_latuy(:,:), start(2:3) )
3013 call file_write_associatedcoordinate( fid,
'lat_xv', axis_latxv(:,:), start(2:3) )
3014 call file_write_associatedcoordinate( fid,
'lat_uv', axis_latuv(:,:), start(2:3) )
3016 call file_write_associatedcoordinate( fid,
'topo', axis_topo(:,:), start(2:3) )
3017 call file_write_associatedcoordinate( fid,
'lsmask', axis_lsmask(:,:), start(2:3) )
3019 call file_write_associatedcoordinate( fid,
'cell_area', axis_area(:,:), start(2:3) )
3020 call file_write_associatedcoordinate( fid,
'cell_area_uy', axis_areauy(:,:), start(2:3) )
3021 call file_write_associatedcoordinate( fid,
'cell_area_xv', axis_areaxv(:,:), start(2:3) )
3023 if ( haszcoord )
then 3024 call file_write_associatedcoordinate( fid,
'height' , axis_hgt(:,:,:), start(1:3) )
3025 call file_write_associatedcoordinate( fid,
'height_wxy', axis_hgtwxy(:,:,:), start(1:3) )
3027 call file_write_associatedcoordinate( fid,
'cell_area_zuy_x', axis_areazuy_x(:,:,:), start(1:3) )
3028 call file_write_associatedcoordinate( fid,
'cell_area_zxv_y', axis_areazxv_y(:,:,:), start(1:3) )
3029 call file_write_associatedcoordinate( fid,
'cell_area_wuy_x', axis_areawuy_x(:,:,:), start(1:3) )
3030 call file_write_associatedcoordinate( fid,
'cell_area_wxv_y', axis_areawxv_y(:,:,:), start(1:3) )
3031 call file_write_associatedcoordinate( fid,
'cell_area_zxy_x', axis_areazxy_x(:,:,:), start(1:3) )
3032 call file_write_associatedcoordinate( fid,
'cell_area_zuv_y', axis_areazuv_y(:,:,:), start(1:3) )
3033 call file_write_associatedcoordinate( fid,
'cell_area_zuv_x', axis_areazuv_x(:,:,:), start(1:3) )
3034 call file_write_associatedcoordinate( fid,
'cell_area_zxy_y', axis_areazxy_y(:,:,:), start(1:3) )
3036 call file_write_associatedcoordinate( fid,
'cell_volume', axis_vol(:,:,:), start(1:3) )
3037 call file_write_associatedcoordinate( fid,
'cell_volume_wxy', axis_volwxy(:,:,:), start(1:3) )
3038 call file_write_associatedcoordinate( fid,
'cell_volume_zuy', axis_volzuy(:,:,:), start(1:3) )
3039 call file_write_associatedcoordinate( fid,
'cell_volume_zxv', axis_volzxv(:,:,:), start(1:3) )
3041 if (
okmax > 0 )
then 3042 call file_write_associatedcoordinate( fid,
'cell_volume_oxy', axis_volo(:,:,:), start(1:3) )
3044 if (
lkmax > 0 )
then 3045 call file_write_associatedcoordinate( fid,
'cell_volume_lxy', axis_voll(:,:,:), start(1:3) )
3047 if (
ukmax > 0 )
then 3048 call file_write_associatedcoordinate( fid,
'cell_volume_uxy', axis_volu(:,:,:), start(1:3) )
3052 xsb =
isb - isb2 + 1
3054 ysb =
jsb - jsb2 + 1
3057 call file_write_associatedcoordinate( fid,
'lon' , axis_lon(xsb:xeb,ysb:yeb), start(2:3) )
3058 call file_write_associatedcoordinate( fid,
'lon_uy', axis_lonuy(xsb:xeb,ysb:yeb), start(2:3) )
3059 call file_write_associatedcoordinate( fid,
'lon_xv', axis_lonxv(xsb:xeb,ysb:yeb), start(2:3) )
3060 call file_write_associatedcoordinate( fid,
'lon_uv', axis_lonuv(xsb:xeb,ysb:yeb), start(2:3) )
3061 call file_write_associatedcoordinate( fid,
'lat' , axis_lat(xsb:xeb,ysb:yeb), start(2:3) )
3062 call file_write_associatedcoordinate( fid,
'lat_uy', axis_latuy(xsb:xeb,ysb:yeb), start(2:3) )
3063 call file_write_associatedcoordinate( fid,
'lat_xv', axis_latxv(xsb:xeb,ysb:yeb), start(2:3) )
3064 call file_write_associatedcoordinate( fid,
'lat_uv', axis_latuv(xsb:xeb,ysb:yeb), start(2:3) )
3066 call file_write_associatedcoordinate( fid,
'topo', axis_topo(xsb:xeb,ysb:yeb), start(2:3) )
3067 call file_write_associatedcoordinate( fid,
'lsmask', axis_lsmask(xsb:xeb,ysb:yeb), start(2:3) )
3069 call file_write_associatedcoordinate( fid,
'cell_area', axis_area(xsb:xeb,ysb:yeb), start(2:3) )
3070 call file_write_associatedcoordinate( fid,
'cell_area_uy', axis_areauy(xsb:xeb,ysb:yeb), start(2:3) )
3071 call file_write_associatedcoordinate( fid,
'cell_area_xv', axis_areaxv(xsb:xeb,ysb:yeb), start(2:3) )
3073 if ( haszcoord )
then 3074 call file_write_associatedcoordinate( fid,
'height' , axis_hgt(:,xsb:xeb,ysb:yeb), start(1:3) )
3075 call file_write_associatedcoordinate( fid,
'height_wxy', axis_hgtwxy(:,xsb:xeb,ysb:yeb), start(1:3) )
3077 call file_write_associatedcoordinate( fid,
'cell_area_zuy_x', axis_areazuy_x(:,xsb:xeb,ysb:yeb), start(2:3) )
3078 call file_write_associatedcoordinate( fid,
'cell_area_zxv_y', axis_areazxv_y(:,xsb:xeb,ysb:yeb), start(2:3) )
3079 call file_write_associatedcoordinate( fid,
'cell_area_wuy_x', axis_areawuy_x(:,xsb:xeb,ysb:yeb), start(2:3) )
3080 call file_write_associatedcoordinate( fid,
'cell_area_wxv_y', axis_areawxv_y(:,xsb:xeb,ysb:yeb), start(2:3) )
3081 call file_write_associatedcoordinate( fid,
'cell_area_zxy_x', axis_areazxy_x(:,xsb:xeb,ysb:yeb), start(2:3) )
3082 call file_write_associatedcoordinate( fid,
'cell_area_zuv_y', axis_areazuv_y(:,xsb:xeb,ysb:yeb), start(2:3) )
3083 call file_write_associatedcoordinate( fid,
'cell_area_zuv_x', axis_areazuv_x(:,xsb:xeb,ysb:yeb), start(2:3) )
3084 call file_write_associatedcoordinate( fid,
'cell_area_zxy_y', axis_areazxy_y(:,xsb:xeb,ysb:yeb), start(2:3) )
3086 call file_write_associatedcoordinate( fid,
'cell_volume', axis_vol(:,xsb:xeb,ysb:yeb), start(1:3) )
3087 call file_write_associatedcoordinate( fid,
'cell_volume_wxy', axis_volwxy(:,xsb:xeb,ysb:yeb), start(1:3) )
3088 call file_write_associatedcoordinate( fid,
'cell_volume_zuy', axis_volzuy(:,xsb:xeb,ysb:yeb), start(1:3) )
3089 call file_write_associatedcoordinate( fid,
'cell_volume_zxv', axis_volzxv(:,xsb:xeb,ysb:yeb), start(1:3) )
3091 if (
okmax > 0 )
then 3092 call file_write_associatedcoordinate( fid,
'cell_volume_oxy', axis_volo(:,xsb:xeb,ysb:yeb), start(1:3) )
3094 if (
lkmax > 0 )
then 3095 call file_write_associatedcoordinate( fid,
'cell_volume_lxy', axis_voll(:,xsb:xeb,ysb:yeb), start(1:3) )
3097 if (
ukmax > 0 )
then 3098 call file_write_associatedcoordinate( fid,
'cell_volume_uxy', axis_volu(:,xsb:xeb,ysb:yeb), start(1:3) )
3112 varname, desc, unit, &
3113 dim_type, datatype, &
3131 integer,
intent(in) :: fid
3132 character(len=*),
intent(in) :: varname
3133 character(len=*),
intent(in) :: desc
3134 character(len=*),
intent(in) :: unit
3135 character(len=*),
intent(in) :: dim_type
3136 character(len=*),
intent(in) :: datatype
3138 integer,
intent(out) :: vid
3140 character(len=*),
intent(in),
optional :: standard_name
3141 real(DP),
intent(in),
optional :: timeintv
3142 integer,
intent(in),
optional :: nsteps
3143 character(len=*),
intent(in),
optional :: cell_measures
3145 character(len=H_MID) :: standard_name_
3146 character(len=H_SHORT) :: cell_measures_
3148 integer :: dtype, elm_size, ndims
3156 if ( datatype ==
'REAL8' )
then 3159 elseif( datatype ==
'REAL4' )
then 3166 elseif(
rp == 4 )
then 3170 log_error(
"FILE_CARTESC_def_var",*)
'unsupported data type. Check!', trim(datatype),
' item:',trim(varname)
3176 do n = 1, file_cartesc_ndims
3177 if ( file_cartesc_dims(n)%name == dim_type )
then 3182 if ( dimid < -1 )
then 3183 log_error(
"FILE_CARTESC_def_var",*)
'dim_type is not supported: ', trim(dim_type)
3187 if (
present(nsteps) )
then 3188 write_buf_amount(fid) = write_buf_amount(fid) + file_cartesc_dims(dimid)%size * elm_size * nsteps
3190 write_buf_amount(fid) = write_buf_amount(fid) + file_cartesc_dims(dimid)%size * elm_size
3193 ndims = file_cartesc_dims(dimid)%ndims
3195 if (
present(standard_name) )
then 3196 standard_name_ = standard_name
3201 if (
present(timeintv) )
then 3203 ndims, file_cartesc_dims(dimid)%dims(1:ndims), dtype, &
3208 ndims, file_cartesc_dims(dimid)%dims(1:ndims), dtype, &
3212 if (
present(cell_measures) )
then 3213 cell_measures_ = cell_measures
3214 select case ( cell_measures )
3216 if ( file_cartesc_dims(dimid)%area ==
"" )
then 3217 log_error(
"FILE_CARTESC_def_var",*)
'area is not supported for ', trim(dim_type),
' as cell_measures' 3221 if ( file_cartesc_dims(dimid)%area ==
"" )
then 3222 log_error(
"FILE_CARTESC_def_var",*)
'area_z is not supported for ', trim(dim_type),
' as cell_measures' 3226 if ( file_cartesc_dims(dimid)%area_x ==
"" )
then 3227 log_error(
"FILE_CARTESC_def_var",*)
'area_x is not supported for ', trim(dim_type),
' as cell_measures' 3231 if ( file_cartesc_dims(dimid)%area_y ==
"" )
then 3232 log_error(
"FILE_CARTESC_def_var",*)
'area_y is not supported for ', trim(dim_type),
' as cell_measures' 3236 if ( file_cartesc_dims(dimid)%volume ==
"" )
then 3237 log_error(
"FILE_CARTESC_def_var",*)
'volume is not supported for ', trim(dim_type),
' as cell_measures' 3241 log_error(
"FILE_CARTESC_def_var",*)
'cell_measures must be "area" or "volume"' 3244 else if ( ndims == 2 )
then 3245 cell_measures_ =
"area" 3246 else if ( ndims == 3 )
then 3247 cell_measures_ =
"volume" 3252 select case( cell_measures_ )
3253 case (
"area",
"area_z" )
3254 call file_set_attribute( fid, varname,
"cell_measures",
"area: "//trim(file_cartesc_dims(dimid)%area) )
3256 call file_set_attribute( fid, varname,
"cell_measures",
"area: "//trim(file_cartesc_dims(dimid)%area_x) )
3258 call file_set_attribute( fid, varname,
"cell_measures",
"area: "//trim(file_cartesc_dims(dimid)%area_y) )
3260 call file_set_attribute( fid, varname,
"cell_measures",
"volume: "//trim(file_cartesc_dims(dimid)%volume) )
3264 if ( file_cartesc_dims(dimid)%mapping .and. file_cartesc_mapping_info%mapping_name /=
"" )
then 3265 call file_set_attribute( fid, varname,
"grid_mapping", file_cartesc_mapping_info%mapping_name )
3269 if ( file_cartesc_dims(dimid)%location /=
"" )
then 3270 call file_set_attribute( fid, varname,
"grid", file_cartesc_dims(dimid)%grid )
3271 call file_set_attribute( fid, varname,
"location", file_cartesc_dims(dimid)%location )
3300 integer,
intent(in) :: fid
3301 integer,
intent(in) :: vid
3302 real(RP),
intent(in) :: var(:)
3303 character(len=*),
intent(in) :: varname
3304 character(len=*),
intent(in) :: dim_type
3306 integer :: dim1_S, dim1_E
3307 integer :: rankidx(2)
3319 if ( dim_type ==
'Z' )
then 3328 elseif( dim_type ==
'X' )
then 3330 exec = ( rankidx(2) == 0 )
3339 elseif( dim_type ==
'Y' )
then 3341 exec = ( rankidx(1) == 0 )
3351 log_error(
"FILE_CARTESC_write_var_1D",*)
'unsupported dimenstion type. Check! dim_type:', trim(dim_type),
', item:',trim(varname)
3355 if( exec )
call file_write( vid, var(dim1_s:dim1_e), &
3356 nowdaysec, nowdaysec, start=start )
3389 integer,
intent(in) :: fid
3390 integer,
intent(in) :: vid
3391 real(RP),
intent(in) :: var(:,:)
3392 character(len=*),
intent(in) :: varname
3393 character(len=*),
intent(in) :: dim_type
3394 logical,
intent(in),
optional :: fill_halo
3396 real(RP) :: varhalo( size(var(:,1)), size(var(1,:)) )
3398 integer :: dim1_S, dim1_E
3399 integer :: dim2_S, dim2_E
3402 logical :: fill_halo_
3403 integer :: rankidx(2)
3418 fill_halo_ = .false.
3419 if(
present(fill_halo) ) fill_halo_ = fill_halo
3421 if ( dim_type ==
'XY' &
3422 .OR. dim_type ==
'UY' &
3423 .OR. dim_type ==
'XV' &
3424 .OR. dim_type ==
'UV' )
then 3437 elseif( dim_type ==
'ZX' )
then 3443 exec = ( rankidx(2) == 0 )
3452 log_error(
"FILE_CARTESC_write_var_2D",*)
'unsupported dimension type. Check! dim_type:', trim(dim_type),
', item:',trim(varname)
3457 if ( fill_halo_ )
then 3458 varhalo(:,:) = var(:,:)
3463 varhalo(i,j) = rmiss
3469 varhalo(i,j) = rmiss
3475 varhalo(i,j) = rmiss
3481 varhalo(i,j) = rmiss
3485 call file_write( vid, varhalo(dim1_s:dim1_e,dim2_s:dim2_e), &
3486 nowdaysec, nowdaysec, start )
3488 call file_write( vid, var(dim1_s:dim1_e,dim2_s:dim2_e), &
3489 nowdaysec, nowdaysec, start )
3525 integer,
intent(in) :: fid
3526 integer,
intent(in) :: vid
3527 real(RP),
intent(in) :: var(:,:,:)
3528 character(len=*),
intent(in) :: varname
3529 character(len=*),
intent(in) :: dim_type
3531 logical,
intent(in),
optional :: fill_halo
3533 real(RP) :: varhalo( size(var(:,1,1)), size(var(1,:,1)), size(var(1,1,:)) )
3535 integer :: dim1_S, dim1_E, dim1_max
3536 integer :: dim2_S, dim2_E
3537 integer :: dim3_S, dim3_E
3540 logical :: fill_halo_
3541 integer :: rankidx(2)
3549 fill_halo_ = .false.
3550 if(
present(fill_halo) ) fill_halo_ = fill_halo
3559 if ( dim_type ==
'ZXY' &
3560 .OR. dim_type ==
'ZXHY' &
3561 .OR. dim_type ==
'ZXYH' )
then 3565 elseif ( dim_type ==
'ZHXY' )
then 3569 elseif( dim_type ==
'OXY' )
then 3573 elseif( dim_type ==
'LXY' )
then 3577 elseif( dim_type ==
'UXY' )
then 3582 log_error(
"FILE_CARTESC_write_var_3D",*)
'unsupported dimension type. Check! dim_type:', trim(dim_type),
', item:',trim(varname)
3598 if ( fill_halo_ )
then 3599 varhalo(:,:,:) = var(:,:,:)
3605 varhalo(k,i,j) = rmiss
3613 varhalo(k,i,j) = rmiss
3621 varhalo(k,i,j) = rmiss
3629 varhalo(k,i,j) = rmiss
3634 call file_write( vid, varhalo(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e), &
3635 nowdaysec, nowdaysec, start )
3637 call file_write( vid, var(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e), &
3638 nowdaysec, nowdaysec, start )
3673 integer,
intent(in) :: fid
3674 integer,
intent(in) :: vid
3675 real(RP),
intent(in) :: var(:,:,:)
3676 character(len=*),
intent(in) :: varname
3677 character(len=*),
intent(in) :: dim_type
3678 real(DP),
intent(in) :: timeintv
3680 integer,
intent(in),
optional :: timetarg
3681 real(DP),
intent(in),
optional :: timeofs
3682 logical,
intent(in),
optional :: fill_halo
3684 real(RP) :: varhalo( size(var(:,1,1)), size(var(1,:,1)) )
3686 integer :: dim1_S, dim1_E
3687 integer :: dim2_S, dim2_E
3689 real(DP) :: time_interval, nowtime
3693 logical :: fill_halo_
3694 real(DP) :: timeofs_
3695 integer :: rankidx(2)
3703 fill_halo_ = .false.
3704 if(
present(fill_halo) ) fill_halo_ = fill_halo
3707 if(
present(timeofs) ) timeofs_ = timeofs
3709 time_interval = timeintv
3710 step =
size(var(
isb,
jsb,:))
3715 if ( dim_type ==
'XYT' )
then 3728 log_error(
"FILE_CARTESC_write_var_3D_t",*)
'unsupported dimension type. Check! dim_type:', trim(dim_type),
', item:',trim(varname)
3736 if (
present(timetarg) )
then 3737 nowtime = timeofs_ + (timetarg-1) * time_interval
3739 if ( fill_halo_ )
then 3740 varhalo(:,:) = var(:,:,timetarg)
3745 varhalo(i,j) = rmiss
3751 varhalo(i,j) = rmiss
3757 varhalo(i,j) = rmiss
3763 varhalo(i,j) = rmiss
3767 call file_write( vid, varhalo(dim1_s:dim1_e,dim2_s:dim2_e), &
3768 nowtime, nowtime, start )
3770 call file_write( vid, var(dim1_s:dim1_e,dim2_s:dim2_e,timetarg), &
3771 nowtime, nowtime, start )
3776 if ( fill_halo_ )
then 3777 varhalo(:,:) = var(:,:,n)
3782 varhalo(i,j) = rmiss
3788 varhalo(i,j) = rmiss
3794 varhalo(i,j) = rmiss
3800 varhalo(i,j) = rmiss
3804 call file_write( vid, varhalo(dim1_s:dim1_e,dim2_s:dim2_e), &
3805 nowtime, nowtime, start )
3807 call file_write( vid, var(dim1_s:dim1_e,dim2_s:dim2_e,n), &
3808 nowtime, nowtime, start )
3810 nowtime = nowtime + time_interval
3847 integer,
intent(in) :: fid
3848 integer,
intent(in) :: vid
3849 real(RP),
intent(in) :: var(:,:,:,:)
3850 character(len=*),
intent(in) :: varname
3851 character(len=*),
intent(in) :: dim_type
3852 real(DP),
intent(in) :: timeintv
3854 integer,
intent(in),
optional :: timetarg
3855 real(DP),
intent(in),
optional :: timeofs
3856 logical,
intent(in),
optional :: fill_halo
3858 real(RP) :: varhalo( size(var(:,1,1,1)), size(var(1,:,1,1)), size(var(1,1,:,1)) )
3860 integer :: dim1_S, dim1_E, dim1_max
3861 integer :: dim2_S, dim2_E
3862 integer :: dim3_S, dim3_E
3864 real(DP) :: time_interval, nowtime
3867 integer :: i, j, k, n
3868 logical :: fill_halo_
3869 real(DP) :: timeofs_
3870 integer :: rankidx(2)
3878 fill_halo_ = .false.
3879 if(
present(fill_halo) ) fill_halo_ = fill_halo
3882 if(
present(timeofs) ) timeofs_ = timeofs
3892 time_interval = timeintv
3907 if ( dim_type ==
'ZXYT' &
3908 .OR. dim_type ==
'ZXHYT' &
3909 .OR. dim_type ==
'ZXYHT' )
then 3913 elseif ( dim_type ==
'ZHXYT' )
then 3917 elseif( dim_type ==
'OXYT' )
then 3921 elseif( dim_type ==
'OHXYT' )
then 3925 elseif( dim_type ==
'LXYT' )
then 3929 elseif( dim_type ==
'LHXYT' )
then 3933 elseif( dim_type ==
'UXYT' )
then 3937 elseif( dim_type ==
'UHXYT' )
then 3942 log_error(
"FILE_CARTESC_write_var_4D",*)
'unsupported dimension type. Check! dim_type:', trim(dim_type),
', item:',trim(varname)
3946 if (
present(timetarg) )
then 3947 nowtime = timeofs_ + (timetarg-1) * time_interval
3949 if ( fill_halo_ )
then 3950 varhalo(:,:,:) = var(:,:,:,timetarg)
3956 varhalo(k,i,j) = rmiss
3964 varhalo(k,i,j) = rmiss
3972 varhalo(k,i,j) = rmiss
3980 varhalo(k,i,j) = rmiss
3985 call file_write( vid, varhalo(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e), &
3986 nowtime, nowtime, start )
3988 call file_write( vid, var(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e,timetarg), &
3989 nowtime, nowtime, start )
3994 if ( fill_halo_ )
then 3995 varhalo(:,:,:) = var(:,:,:,n)
4001 varhalo(k,i,j) = rmiss
4009 varhalo(k,i,j) = rmiss
4017 varhalo(k,i,j) = rmiss
4025 varhalo(k,i,j) = rmiss
4030 call file_write( vid, varhalo(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e), &
4031 nowtime, nowtime, start )
4033 call file_write( vid, var(dim1_s:dim1_e,dim2_s:dim2_e,dim3_s:dim3_e,n), &
4034 nowtime, nowtime, start )
4037 nowtime = nowtime + time_interval
4063 end subroutine closeall
4066 subroutine check_1d( &
4075 real(RP),
intent(in) :: expected(:)
4076 real(RP),
intent(in) :: buffer(:)
4077 character(len=*),
intent(in) :: name
4085 nmax =
size(expected)
4086 if (
size(buffer) /= nmax )
then 4087 log_error(
"check_1d",*)
'size of coordinate ('//trim(name)//
') is different:', nmax,
size(buffer)
4092 if ( abs(expected(n)) > eps )
then 4093 check = abs(buffer(n)-expected(n)) / abs(buffer(n)+expected(n)) * 2.0_rp
4095 check = abs(buffer(n)-expected(n))
4098 if ( check > file_cartesc_datacheck_criteria )
then 4099 log_error(
"check_1d",*)
'value of coordinate ('//trim(name)//
') at ', n,
' is different:', &
4100 expected(n), buffer(n), check
4106 end subroutine check_1d
4109 subroutine check_2d( &
4118 real(RP),
intent(in) :: expected(:,:)
4119 real(RP),
intent(in) :: buffer(:,:)
4120 character(len=*),
intent(in) :: name
4123 integer :: imax, jmax
4129 imax =
size(expected,1)
4130 jmax =
size(expected,2)
4131 if (
size(buffer,1) /= imax )
then 4132 log_error(
"check_2d",*)
'the first size of coordinate ('//trim(name)//
') is different:', imax,
size(buffer,1)
4135 if (
size(buffer,2) /= jmax )
then 4136 log_error(
"check_2d",*)
'the second size of coordinate ('//trim(name)//
') is different:', jmax,
size(buffer,2)
4142 if ( abs(expected(i,j)) > eps )
then 4143 check = abs(buffer(i,j)-expected(i,j)) / abs(buffer(i,j)+expected(i,j)) * 2.0_rp
4145 check = abs(buffer(i,j)-expected(i,j))
4148 if ( check > file_cartesc_datacheck_criteria )
then 4149 log_error(
"check_2d",*)
'value of coordinate ('//trim(name)//
') at (', i,
',', j,
') is different:', &
4150 expected(i,j), buffer(i,j), check
4157 end subroutine check_2d
4160 subroutine check_3d( &
4170 real(RP),
intent(in) :: expected(:,:,:)
4171 real(RP),
intent(in) :: buffer(:,:,:)
4172 character(len=*),
intent(in) :: name
4173 logical,
intent(in) :: transpose
4176 integer :: imax, jmax, kmax
4182 if ( transpose )
then 4183 kmax =
size(expected,3)
4184 imax =
size(expected,1)
4185 jmax =
size(expected,2)
4187 kmax =
size(expected,1)
4188 imax =
size(expected,2)
4189 jmax =
size(expected,3)
4191 if (
size(buffer,1) /= kmax )
then 4192 log_error(
"check_3d",*)
'the first size of coordinate ('//trim(name)//
') is different:', kmax,
size(buffer,1)
4195 if (
size(buffer,2) /= imax )
then 4196 log_error(
"check_3d",*)
'the second size of coordinate ('//trim(name)//
') is different:', imax,
size(buffer,2)
4199 if (
size(buffer,3) /= jmax )
then 4200 log_error(
"check_3d",*)
'the third size of coordinate ('//trim(name)//
') is different:', jmax,
size(buffer,3)
4204 if ( transpose )
then 4209 if ( abs(expected(k,i,j)) > eps )
then 4210 check = abs(buffer(i,j,k)-expected(k,i,j)) / abs(buffer(i,j,k)+expected(k,i,j)) * 2.0_rp
4212 check = abs(buffer(i,j,k)-expected(k,i,j))
4215 if ( check > file_cartesc_datacheck_criteria )
then 4216 log_error(
"check_3d",*)
'value of coordinate ('//trim(name)//
') at ', i,
',', j,
',', k,
' is different:', &
4217 expected(k,i,j), buffer(i,j,k), check
4227 if ( abs(expected(k,i,j)) > eps )
then 4228 check = abs(buffer(k,i,j)-expected(k,i,j)) / abs(buffer(k,i,j)+expected(k,i,j)) * 2.0_rp
4230 check = abs(buffer(k,i,j)-expected(k,i,j))
4233 if ( check > file_cartesc_datacheck_criteria )
then 4234 log_error(
"check_3d",*)
'value of coordinate ('//trim(name)//
') at ', k,
',', i,
',', j,
' is different:', &
4235 expected(k,i,j), buffer(k,i,j), check
4244 end subroutine check_3d
4269 call set_dimension(
'XY', 2, (/
'x' ,
'y' /),
ia*
ja, .true., area=
'cell_area', location=
'face' )
4270 call set_dimension(
'UY', 2, (/
'xh',
'y ' /),
ia*
ja, .true., area=
'cell_area_uy', location=
'edge1' )
4271 call set_dimension(
'XV', 2, (/
'x ',
'yh' /),
ia*
ja, .true., area=
'cell_area_xv', location=
'edge2' )
4279 area=
'cell_area', area_x=
'cell_area_zxy_x', area_y=
'cell_area_zxy_y', &
4280 volume=
'cell_volume', location=
'face' )
4282 area=
'cell_area', area_x=
'cell_area_wxy_x', area_y=
'cell_area_wxy_y', &
4283 volume=
'cell_volume_wxy', location=
'face' )
4285 area=
'cell_area_uy', area_x=
'cell_area_zuy_x', &
4286 volume=
'cell_volume_zuy', location=
'edge1' )
4288 area=
'cell_area_xv', area_y=
'cell_area_zxv_y', &
4289 volume=
'cell_volume_zxv', location=
'edge2' )
4291 area_x=
'cell_area_zuv_x', area_y=
'cell_area_zuv_y', &
4294 if (
okmax > 0 )
then 4295 call set_dimension(
'OXY', 3, (/
'oz',
'x ',
'y ' /),
okmax*
ia*
ja, .true., area=
'cell_area', volume=
'cell_volume_oxy', location=
'face', grid=
'ocean' )
4296 call set_dimension(
'OHXY', 3, (/
'ozh',
'x ',
'y ' /), (
okmax+1)*
ia*
ja, .true., area=
'cell_area', volume=
'cell_volume_oxy', location=
'face', grid=
'ocean' )
4298 if (
lkmax > 0 )
then 4299 call set_dimension(
'LXY', 3, (/
'lz',
'x ',
'y ' /),
lkmax*
ia*
ja, .true., area=
'cell_area', volume=
'cell_volume_lxy', location=
'face', grid=
'land' )
4300 call set_dimension(
'LHXY', 3, (/
'lzh',
'x ',
'y ' /), (
lkmax+1)*
ia*
ja, .true., area=
'cell_area', volume=
'cell_volume_lxy', location=
'face', grid=
'land' )
4302 if (
ukmax > 0 )
then 4303 call set_dimension(
'UXY', 3, (/
'uz',
'x ',
'y ' /),
ukmax*
ia*
ja, .true., area=
'cell_area', volume=
'cell_volume_uxy', location=
'face', grid=
'urban' )
4304 call set_dimension(
'UHXY', 3, (/
'uzh',
'x ',
'y ' /), (
ukmax+1)*
ia*
ja, .true., area=
'cell_area', volume=
'cell_volume_uxy', location=
'face', grid=
'urban' )
4311 file_cartesc_axis_info(1)%periodic = .true.
4312 file_cartesc_axis_info(2)%periodic = .true.
4314 file_cartesc_axis_info(1)%periodic = .false.
4315 file_cartesc_axis_info(2)%periodic = .false.
4319 file_cartesc_axis_info(3)%periodic = .true.
4320 file_cartesc_axis_info(4)%periodic = .true.
4322 file_cartesc_axis_info(3)%periodic = .false.
4323 file_cartesc_axis_info(4)%periodic = .false.
4329 file_cartesc_axis_info(1)%size_global (1) =
imax *
prc_num_x 4330 file_cartesc_axis_info(1)%start_global(1) =
is_ing -
ihalo 4331 file_cartesc_axis_info(1)%halo_global (1) = 0
4332 file_cartesc_axis_info(1)%halo_global (2) = 0
4333 file_cartesc_axis_info(1)%halo_local (1) = 0
4334 file_cartesc_axis_info(1)%halo_local (2) = 0
4336 file_cartesc_axis_info(1)%size_global (1) =
iag 4337 file_cartesc_axis_info(1)%start_global(1) =
isga 4338 file_cartesc_axis_info(1)%halo_global (1) =
ihalo 4339 file_cartesc_axis_info(1)%halo_global (2) =
ihalo 4340 file_cartesc_axis_info(1)%halo_local (1) =
ihalo 4341 file_cartesc_axis_info(1)%halo_local (2) =
ihalo 4342 if(
prc_has_w ) file_cartesc_axis_info(1)%halo_local(1) = 0
4343 if(
prc_has_e ) file_cartesc_axis_info(1)%halo_local(2) = 0
4346 file_cartesc_axis_info(2) = file_cartesc_axis_info(1)
4350 file_cartesc_axis_info(3)%size_global (1) =
jmax *
prc_num_y 4351 file_cartesc_axis_info(3)%start_global(1) =
js_ing -
jhalo 4352 file_cartesc_axis_info(3)%halo_global (1) = 0
4353 file_cartesc_axis_info(3)%halo_global (2) = 0
4354 file_cartesc_axis_info(3)%halo_local (1) = 0
4355 file_cartesc_axis_info(3)%halo_local (2) = 0
4357 file_cartesc_axis_info(3)%size_global (1) =
jag 4358 file_cartesc_axis_info(3)%start_global(1) =
jsga 4359 file_cartesc_axis_info(3)%halo_global (1) =
jhalo 4360 file_cartesc_axis_info(3)%halo_global (2) =
jhalo 4361 file_cartesc_axis_info(3)%halo_local (1) =
jhalo 4362 file_cartesc_axis_info(3)%halo_local (2) =
jhalo 4363 if(
prc_has_s ) file_cartesc_axis_info(3)%halo_local(1) = 0
4364 if(
prc_has_n ) file_cartesc_axis_info(3)%halo_local(2) = 0
4367 file_cartesc_axis_info(4) = file_cartesc_axis_info(3)
4374 file_cartesc_mapping_info%false_easting (1), &
4375 file_cartesc_mapping_info%false_northing (1), &
4376 file_cartesc_mapping_info%longitude_of_central_meridian (1), &
4377 file_cartesc_mapping_info%longitude_of_projection_origin (1), &
4378 file_cartesc_mapping_info%latitude_of_projection_origin (1), &
4379 file_cartesc_mapping_info%straight_vertical_longitude_from_pole(1), &
4380 file_cartesc_mapping_info%standard_parallel (:) )
4386 subroutine set_dimension( name, ndims, dims, size, mapping, area, area_x, area_y, volume, location, grid )
4389 character(len=*),
intent(in) :: name
4390 integer,
intent(in) :: ndims
4391 character(len=*),
intent(in) :: dims(ndims)
4392 integer,
intent(in) :: size
4393 logical,
intent(in),
optional :: mapping
4394 character(len=*),
intent(in),
optional :: area
4395 character(len=*),
intent(in),
optional :: area_x
4396 character(len=*),
intent(in),
optional :: area_y
4397 character(len=*),
intent(in),
optional :: volume
4398 character(len=*),
intent(in),
optional :: location
4399 character(len=*),
intent(in),
optional :: grid
4401 integer,
save :: dimid = 0
4407 if ( dimid > file_cartesc_ndims )
then 4408 log_error(
"set_dimension",*)
'number of dimensions exceeds the limit' 4413 file_cartesc_dims(dimid)%name = name
4415 file_cartesc_dims(dimid)%name = trim(name)//
"T" 4417 file_cartesc_dims(dimid)%ndims = ndims
4418 file_cartesc_dims(dimid)%dims(1:ndims) = dims(:)
4419 file_cartesc_dims(dimid)%size =
size 4421 if (
present(mapping) )
then 4422 file_cartesc_dims(dimid)%mapping = mapping
4424 file_cartesc_dims(dimid)%mapping = .false.
4427 if (
present(area) )
then 4428 file_cartesc_dims(dimid)%area = area
4430 file_cartesc_dims(dimid)%area =
'' 4432 if (
present(area_x) )
then 4433 file_cartesc_dims(dimid)%area = area_x
4435 file_cartesc_dims(dimid)%area =
'' 4437 if (
present(area_y) )
then 4438 file_cartesc_dims(dimid)%area = area_y
4440 file_cartesc_dims(dimid)%area =
'' 4443 if (
present(volume) )
then 4444 file_cartesc_dims(dimid)%volume = volume
4446 file_cartesc_dims(dimid)%volume =
'' 4449 if (
present(location) )
then 4450 file_cartesc_dims(dimid)%location = location
4451 if (
present(grid) )
then 4452 file_cartesc_dims(dimid)%grid =
'grid_'//trim(grid)
4454 file_cartesc_dims(dimid)%grid =
'grid' 4457 file_cartesc_dims(dimid)%location =
'' 4458 file_cartesc_dims(dimid)%grid =
'' 4475 integer :: err, order
4476 integer :: sizes(3), subsizes(3), sub_off(3)
4479 order = mpi_order_fortran
4481 centertypexy = mpi_datatype_null
4482 centertypezx = mpi_datatype_null
4483 centertypezxy = mpi_datatype_null
4484 centertypezhxy = mpi_datatype_null
4485 centertypeocean = mpi_datatype_null
4486 centertypeland = mpi_datatype_null
4487 centertypeurban = mpi_datatype_null
4491 if(
rp == 8 ) etype = mpi_double
4500 startzxy(2:3) = startxy(1:2)
4502 countzxy(2:3) = countxy(1:2)
4513 call mpi_type_create_subarray(3, sizes, subsizes, sub_off, order, etype, centertypezxy, err)
4514 call mpi_type_commit(centertypezxy, err)
4518 startzhxy(2:3) = startxy(1:2)
4519 countzhxy(1) =
kmax+1
4520 countzhxy(2:3) = countxy(1:2)
4525 subsizes(1) =
kmax+1
4531 call mpi_type_create_subarray(3, sizes, subsizes, sub_off, order, etype, centertypezhxy, err)
4532 call mpi_type_commit(centertypezhxy, err)
4534 if (
okmax > 0 )
then 4537 startocean(2:3) = startxy(1:2)
4538 countocean(1) =
okmax 4539 countocean(2:3) = countxy(1:2)
4543 sub_off(1) =
oks - 1
4544 call mpi_type_create_subarray(3, sizes, subsizes, sub_off, order, etype, centertypeocean, err)
4545 call mpi_type_commit(centertypeocean, err)
4548 if (
lkmax > 0 )
then 4551 startland(2:3) = startxy(1:2)
4552 countland(1) =
lkmax 4553 countland(2:3) = countxy(1:2)
4557 sub_off(1) =
lks - 1
4558 call mpi_type_create_subarray(3, sizes, subsizes, sub_off, order, etype, centertypeland, err)
4559 call mpi_type_commit(centertypeland, err)
4562 if (
ukmax > 0 )
then 4565 starturban(2:3) = startxy(1:2)
4566 counturban(1) =
ukmax 4567 counturban(2:3) = countxy(1:2)
4571 sub_off(1) =
uks - 1
4572 call mpi_type_create_subarray(3, sizes, subsizes, sub_off, order, etype, centertypeurban, err)
4573 call mpi_type_commit(centertypeurban, err)
4577 startzx(1) =
khalo+1
4587 sub_off(2) =
isb - 1
4588 call mpi_type_create_subarray(2, sizes, subsizes, sub_off, order, etype, centertypezx, err)
4589 call mpi_type_commit(centertypezx, err)
4603 if( centertypexy /= mpi_datatype_null )
call mpi_type_free(centertypexy, err)
4604 if( centertypezx /= mpi_datatype_null )
call mpi_type_free(centertypezx, err)
4605 if( centertypezxy /= mpi_datatype_null )
call mpi_type_free(centertypezxy, err)
4606 if( centertypezhxy /= mpi_datatype_null )
call mpi_type_free(centertypezhxy, err)
4607 if( centertypeocean /= mpi_datatype_null )
call mpi_type_free(centertypeocean, err)
4608 if( centertypeland /= mpi_datatype_null )
call mpi_type_free(centertypeland, err)
4609 if( centertypeurban /= mpi_datatype_null )
call mpi_type_free(centertypeurban, err)
subroutine, public mapprojection_get_attributes(mapping, false_easting, false_northing, longitude_of_central_meridian, longitude_of_projection_origin, latitude_of_projection_origin, straight_vertical_longitude_from_pole, standard_parallel)
Get mapping attributes.
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdy
y-length of control volume [m]
real(rp), dimension(:), allocatable, public urban_grid_cartesc_cz
center coordinate [m]: z, local=global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cxg
center coordinate [m]: x, global
integer, public jmax
of computational cells: y, local
subroutine, public file_cartesc_setup
Setup.
real(rp), dimension(:), allocatable, public ocean_grid_cartesc_cdz
z-length of control volume [m]
real(rp), dimension(:), allocatable, public urban_grid_cartesc_fz
face coordinate [m]: z, local=global
subroutine file_cartesc_read_var_2d(fid, varname, dim_type, var, step)
Read 2D data from file.
real(rp), dimension(:), allocatable, public land_grid_cartesc_cz
center coordinate [m]: z, local=global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdx
x-length of control volume [m]
subroutine, public file_close(fid, skip_abort)
subroutine file_cartesc_read_var_4d(fid, varname, dim_type, var, step)
Read 4D data from file.
integer, parameter, public khalo
of halo cells: z
integer, public ihalo
of halo cells: x
real(dp), public time_nowms
subsecond part of current time [millisec]
integer, parameter, public file_real4
integer, public imax
of computational cells: x, local
integer, public jhalo
of halo cells: y
integer, public ia
of whole cells: x, local, with HALO
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cyg
center coordinate [m]: y, global
logical, public file_aggregate
module land / grid / cartesianC / index
subroutine, public file_cartesc_cleanup
deallocate buffers
subroutine file_cartesc_def_axes(fid, dtype, hasZ)
define axis variables in the file
subroutine, public file_def_axis(fid, name, desc, units, dim_name, dtype, dim_size, bounds)
integer, public iag
of computational grids
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfxg
center buffer factor (0-1): x, global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfz
center buffer factor (0-1): z
real(dp), public time_nowdaysec
second of current time [sec]
subroutine construct_derived_datatype
construct MPI derived datatypes for read buffers
subroutine file_cartesc_write_var_2d(fid, vid, var, varname, dim_type, fill_halo)
Write 2D data to file.
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fxg
face coordinate [m]: x, global
integer, public ja
of whole cells: y, local, with HALO
integer, public io_fid_conf
Config file ID.
real(rp), public const_d2r
degree to radian
subroutine file_cartesc_write_var_3d(fid, vid, var, varname, dim_type, fill_halo)
Write 3D data to file.
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fdz
z-length of grid(i+1) to grid(i) [m]
subroutine, public file_detach_buffer(fid)
logical, public prc_has_s
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fz
face coordinate [m]: z, local
integer, public je_ing
end point of the inner domain: cy, global
integer, public jsga
start point of the full domain: cy, global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfyg
face buffer factor (0-1): y, global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fdy
y-length of grid(j+1) to grid(j) [m]
logical, public prc_has_n
logical, public prc_has_e
logical, public prc_periodic_y
periodic condition or not (Y)?
integer, parameter, public file_real8
module urban / grid / icosahedralA / index
subroutine, public file_open(basename, fid, mode, single, aggregate, rankid, postfix)
integer, public jmaxg
of computational cells: y, global
real(rp), public const_undef
subroutine, public file_attach_buffer(fid, buf_amount)
subroutine, public file_flush(fid)
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cy
center coordinate [m]: y, local
logical, public prc_periodic_x
periodic condition or not (X)?
subroutine, public file_cartesc_set_coordinates_urban(VOL)
set volume for urban
integer, public is
start point of inner domain: x, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fdyg
center coordinate [m]: y, global
integer, public ie
end point of inner domain: x, local
subroutine, public file_cartesc_create(basename, title, datatype, fid, date, subsec, haszcoord, append, aggregate, single)
Create/open a netCDF file.
subroutine file_cartesc_read_1d(basename, varname, dim_type, var, step, aggregate)
interface FILE_CARTESC_read Read data from file This routine is a wrapper of the lower primitive rout...
integer, public js_ing
start point of the inner domain: cy, global
integer, parameter, public file_file_max
real(rp), dimension(:), allocatable, public land_grid_cartesc_fz
face coordinate [m]: z, local=global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfxg
face buffer factor (0-1): x, global
subroutine, public calendar_get_name(name)
integer, parameter, public file_fread
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fdx
x-length of grid(i+1) to grid(i) [m]
module atmosphere / grid / cartesC index
integer, public ke
end point of inner domain: z, local
real(rp), dimension(:), allocatable, public urban_grid_cartesc_cdz
z-length of control volume [m]
integer, public ie_ing
end point of the inner domain: cx, global
character(len=h_mid), public h_source
for file header
subroutine, public file_cartesc_set_coordinates_atmos(CZ, FZ, LON, LONUY, LONXV, LONUV, LAT, LATUY, LATXV, LATUV, TOPO, LSMASK, AREA, AREAZUY_X, AREAZXV_Y, AREAWUY_X, AREAWXV_Y, AREAUY, AREAZXY_X, AREAZUV_Y, AREAXV, AREAZUV_X, AREAZXY_Y, VOL, VOLWXY, VOLZUY, VOLZXV)
set latlon and z for atmosphere
integer, public je
end point of inner domain: y, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdz
z-length of control volume [m]
subroutine file_cartesc_get_size_id(fid, KMAX, OKMAX, LKMAX, UKMAX, IMAXG, JMAXG, KHALO, IHALO, JHALO)
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cx
center coordinate [m]: x, local
character(len=h_mid), public h_institute
for file header
subroutine, public file_cartesc_enddef(fid)
Exit netCDF file define mode.
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fdxg
center coordinate [m]: x, global
module atmosphere / grid / cartesC
subroutine, public file_def_variable(fid, varname, desc, units, standard_name, ndims, dims, dtype, vid, time_int, time_avg, existed)
integer, public ks
start point of inner domain: z, local
logical function, public file_opened(fid)
check if the file is opened?
module urban / grid / cartesianC
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfx
center buffer factor (0-1): x
real(rp), dimension(:), allocatable, public ocean_grid_cartesc_cz
center coordinate [m]: z, local=global
integer, public prc_myrank
process num in local communicator
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdyg
center coordinate [m]: y, global
integer, dimension(:,:), allocatable, public prc_2drank
node index in 2D topology
subroutine, public file_setup(myrank)
setup
integer, public kmax
of computational cells: z, local
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cdxg
center coordinate [m]: x, global
subroutine, public prc_abort
Abort Process.
integer, public jag
of computational grids
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fy
face coordinate [m]: y, local
subroutine file_cartesc_write_1d(var, basename, title, varname, desc, unit, dim_type, datatype, date, subsec, append, aggregate, standard_name, cell_measures)
interface FILE_CARTESC_write Write data to file This routine is a wrapper of the lowere primitive rou...
subroutine file_cartesc_read_auto_2d(fid, varname, var, step, existed)
Read 2D data from file.
real(dp), parameter, public file_rmiss
integer, public js
start point of inner domain: y, local
subroutine, public file_cartesc_def_var(fid, varname, desc, unit, dim_type, datatype, vid, standard_name, timeintv, nsteps, cell_measures)
Define a variable to file.
subroutine, public file_create(basename, title, source, institution, fid, existed, rankid, single, aggregate, time_units, calendar, append)
create file fid is >= 1
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfx
face buffer factor (0-1): x
subroutine set_dimension(name, ndims, dims, size, mapping, area, area_x, area_y, volume, location, grid)
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfy
center buffer factor (0-1): y
logical function, public file_get_aggregate(fid)
integer, public is_ing
start point of the inner domain: cx, global
integer, public prc_num_y
y length of 2D processor topology
module land / grid / cartesianC
subroutine, public prof_rapstart(rapname_base, level)
Start raptime.
subroutine file_cartesc_write_var_3d_t(fid, vid, var, varname, dim_type, timeintv, timetarg, timeofs, fill_halo)
Write 3D data with time dimension to file.
subroutine, public file_def_associatedcoordinate(fid, name, desc, units, dim_names, dtype)
module ocean / grid / cartesianC / index
integer, public imaxg
of computational cells: x, global
subroutine file_cartesc_read_var_3d(fid, varname, dim_type, var, step)
Read 3D data from file.
logical, public prc_ismaster
master process in local communicator?
subroutine file_cartesc_write_var_4d(fid, vid, var, varname, dim_type, timeintv, timetarg, timeofs, fill_halo)
Write 4D data to file.
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cbfyg
center buffer factor (0-1): y, global
real(rp), public const_eps
small number
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfz
face buffer factor (0-1): z
subroutine set_dimension_informations
character(len=7), parameter, public atmos_grid_cartesc_name
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fbfy
face buffer factor (0-1): y
real(rp), dimension(:), allocatable, public ocean_grid_cartesc_fz
face coordinate [m]: z, local=global
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fx
face coordinate [m]: x, local
integer, public ka
of whole cells: z, local, with HALO
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_fyg
face coordinate [m]: y, global
integer, dimension(6), public time_nowdate
current time [YYYY MM DD HH MM SS]
subroutine, public file_cartesc_flush(fid)
Flush all pending requests to a netCDF file (PnetCDF only)
subroutine, public file_add_associatedvariable(fid, vname, existed)
subroutine file_cartesc_read_auto_3d(fid, varname, var, step, existed)
Read 3D data from file.
subroutine, public prof_rapend(rapname_base, level)
Save raptime.
integer, parameter, public rp
real(rp), dimension(:), allocatable, public atmos_grid_cartesc_cz
center coordinate [m]: z, local
subroutine, public file_cartesc_open(basename, fid, aggregate)
open a netCDF file for read
integer, public isga
start point of the full domain: cx, global
subroutine, public file_cartesc_set_coordinates_ocean(VOL)
set volume for ocean
subroutine, public file_cartesc_close(fid)
Close a netCDF file.
subroutine, public file_enddef(fid)
subroutine file_cartesc_write_axes(fid, haszcoord, start)
write axis to the file
subroutine, public file_cartesc_put_globalattributes(fid, prc_rank_x, prc_rank_y, prc_num_x, prc_num_y, prc_periodic_x, prc_periodic_y, kmax, okmax, lkmax, ukmax, imaxg, jmaxg, khalo, ihalo, jhalo, time, tunits, calendar)
put global attributes
module ocean / grid / cartesianC
subroutine free_derived_datatype
free MPI derived datatypes
subroutine, public file_cartesc_set_coordinates_land(VOL)
set volume for land
logical, public prc_has_w
subroutine file_cartesc_write_var_1d(fid, vid, var, varname, dim_type)
Write 1D data to file.
subroutine, public file_get_cftunits(date, tunits)
get unit of time
integer, public prc_num_x
x length of 2D processor topology
real(rp), dimension(:), allocatable, public land_grid_cartesc_cdz
z-length of control volume [m]