40 public :: file_put_axis
41 public :: file_write_axis
43 public :: file_put_associatedcoordinate
44 public :: file_write_associatedcoordinate
45 public :: file_add_variable
47 public :: file_get_shape
49 public :: file_get_commoninfo
50 public :: file_get_datainfo
51 public :: file_get_all_datainfo
54 public :: file_get_attribute
55 public :: file_set_attribute
67 interface file_get_commoninfo
68 module procedure file_get_commoninfo_fid
69 module procedure file_get_commoninfo_fname
70 end interface file_get_commoninfo
72 interface file_get_shape
73 module procedure file_get_shape_fid
74 module procedure file_get_shape_fname
75 end interface file_get_shape
77 interface file_get_datainfo
78 module procedure file_get_datainfo_fid
79 module procedure file_get_datainfo_fname
80 end interface file_get_datainfo
82 interface file_get_all_datainfo
83 module procedure file_get_all_datainfo_fid
84 module procedure file_get_all_datainfo_fname
85 end interface file_get_all_datainfo
87 interface file_put_axis
88 module procedure file_put_axis_realsp
89 module procedure file_put_axis_realdp
90 end interface file_put_axis
91 interface file_write_axis
92 module procedure file_write_axis_realsp
93 module procedure file_write_axis_realdp
94 end interface file_write_axis
95 interface file_put_associatedcoordinate
96 module procedure file_put_associatedcoordinate_realsp_1d
97 module procedure file_put_associatedcoordinate_realdp_1d
98 module procedure file_put_associatedcoordinate_realsp_2d
99 module procedure file_put_associatedcoordinate_realdp_2d
100 module procedure file_put_associatedcoordinate_realsp_3d
101 module procedure file_put_associatedcoordinate_realdp_3d
102 module procedure file_put_associatedcoordinate_realsp_4d
103 module procedure file_put_associatedcoordinate_realdp_4d
104 end interface file_put_associatedcoordinate
105 interface file_write_associatedcoordinate
106 module procedure file_write_associatedcoordinate_realsp_1d
107 module procedure file_write_associatedcoordinate_realdp_1d
108 module procedure file_write_associatedcoordinate_realsp_2d
109 module procedure file_write_associatedcoordinate_realdp_2d
110 module procedure file_write_associatedcoordinate_realsp_3d
111 module procedure file_write_associatedcoordinate_realdp_3d
112 module procedure file_write_associatedcoordinate_realsp_4d
113 module procedure file_write_associatedcoordinate_realdp_4d
114 end interface file_write_associatedcoordinate
115 interface file_add_variable
116 module procedure file_add_variable_no_time
117 module procedure file_add_variable_with_time
118 end interface file_add_variable
120 module procedure file_read_realsp_1d
121 module procedure file_read_realdp_1d
122 module procedure file_read_realsp_2d
123 module procedure file_read_realdp_2d
124 module procedure file_read_realsp_3d
125 module procedure file_read_realdp_3d
126 module procedure file_read_realsp_4d
127 module procedure file_read_realdp_4d
128 module procedure file_read_var_realsp_1d
129 module procedure file_read_var_realdp_1d
130 module procedure file_read_var_realsp_2d
131 module procedure file_read_var_realdp_2d
132 module procedure file_read_var_realsp_3d
133 module procedure file_read_var_realdp_3d
134 module procedure file_read_var_realsp_4d
135 module procedure file_read_var_realdp_4d
136 end interface file_read
138 module procedure file_write_realsp_1d
139 module procedure file_write_realdp_1d
140 module procedure file_write_realsp_2d
141 module procedure file_write_realdp_2d
142 module procedure file_write_realsp_3d
143 module procedure file_write_realdp_3d
144 module procedure file_write_realsp_4d
145 module procedure file_write_realdp_4d
146 end interface file_write
147 interface file_get_attribute
148 module procedure file_get_attribute_text_fname
149 module procedure file_get_attribute_logical_fname
150 module procedure file_get_attribute_int_fname
151 module procedure file_get_attribute_float_fname
152 module procedure file_get_attribute_double_fname
153 module procedure file_get_attribute_text_fid
154 module procedure file_get_attribute_logical_fid
155 module procedure file_get_attribute_int_fid
156 module procedure file_get_attribute_float_fid
157 module procedure file_get_attribute_double_fid
158 end interface file_get_attribute
159 interface file_set_attribute
160 module procedure file_set_attribute_text
161 module procedure file_set_attribute_logical
162 module procedure file_set_attribute_int
163 module procedure file_set_attribute_float
164 module procedure file_set_attribute_double
165 end interface file_set_attribute
177 private :: file_get_fid
184 character(len=FILE_HLONG) :: name
189 integer :: file_nfiles = 0
192 character(len=FILE_HLONG) :: name
197 integer :: file_nvars = 0
199 integer :: mpi_myrank
212 integer,
intent(in) :: myrank
214 namelist / param_file / &
223 log_info(
"FILE_setup",*)
'Not found namelist. Default used.' 224 elseif( ierr > 0 )
then 225 log_error(
"FILE_setup",*)
'Not appropriate names in namelist PARAM_FILE. Check!' 243 title, source, institution, &
245 rankid, single, aggregate, &
246 time_units, calendar, &
250 character(len=*),
intent(in) :: basename
251 character(len=*),
intent(in) :: title
252 character(len=*),
intent(in) :: source
253 character(len=*),
intent(in) :: institution
255 integer,
intent(out) :: fid
256 logical,
intent(out) :: existed
258 integer,
intent(in),
optional :: rankid
259 logical,
intent(in),
optional :: single
260 logical,
intent(in),
optional :: aggregate
261 character(len=*),
intent(in),
optional :: time_units
262 character(len=*),
intent(in),
optional :: calendar
263 logical,
intent(in),
optional :: append
265 character(len=FILE_HMID) :: time_units_
266 character(len=FILE_HSHORT) :: calendar_
275 if (
present(rankid) )
then 282 if (
present(single) )
then 286 if (
present(time_units) )
then 287 time_units_ = time_units
289 time_units_ =
'seconds' 292 if (
present(calendar) )
then 299 if (
present(append) )
then 303 if ( single_ .and. rankid_ /= 0 )
return 305 call file_get_fid( basename, mode, &
308 aggregate=aggregate )
313 call file_set_attribute( fid,
"global",
"title" , title )
314 call file_set_attribute( fid,
"global",
"source" , source )
315 call file_set_attribute( fid,
"global",
"institution", institution )
317 if ( ( .not.
present(aggregate) ) .or. .not. aggregate )
then 319 call file_set_attribute( fid,
"global",
"rankid" , (/rankid/) )
323 time_units_, calendar_, &
327 log_error(
"FILE_create",*)
'failed to set time units' 335 subroutine file_get_var_num( &
340 integer,
intent(in) :: fid
341 integer,
intent(in) :: nvars_limit
342 integer,
intent(out) :: nvars
348 log_error(
"FILE_get_var_num",*)
'File is not opened. fid = ', fid
356 log_error(
"FILE_get_var_num",*)
'failed to get varnum. fid = ', fid
360 if ( nvars > nvars_limit )
then 361 log_error(
"FILE_get_var_num",*)
'number of variables exceeds the requested size.', nvars, nvars_limit
366 end subroutine file_get_var_num
369 subroutine file_get_var_name( &
374 integer,
intent(in) :: fid
375 integer,
intent(in) :: cvid
376 character(len=*),
intent(out) :: varname
382 log_error(
"FILE_get_var_name",*)
'File is not opened. fid = ', fid
390 log_error(
"FILE_get_var_name",*)
'failed to get varname. cvid = ', cvid
395 end subroutine file_get_var_name
399 integer,
intent(in) :: fid
400 character(len=*),
intent(in) :: vname
401 logical,
optional,
intent(out) :: existed
406 log_error(
"FILE_add_associatedVariable",*)
'File is not opened. fid = ', fid
413 if (
present(existed) )
then 422 log_error(
"FILE_add_associatedvariable",*)
'failed to add associated variable: '//trim(vname)
433 integer,
intent(in) :: fid
434 character(len=*),
intent(in) :: filetype
435 character(len=*),
intent(in) :: key
436 character(len=*),
intent(in) :: val
441 log_error(
"FILE_set_option",*)
'File is not opened. fid = ', fid
448 log_error(
"FILE_set_option",*)
'failed to set option' 466 character(len=*),
intent( in) :: basename
467 integer,
intent(out) :: fid
468 integer,
intent( in),
optional :: mode
469 logical,
intent( in),
optional :: single
470 logical,
intent( in),
optional :: aggregate
471 integer,
intent( in),
optional :: rankid
472 character(len=*),
intent( in),
optional :: postfix
481 if (
present(mode) )
then 487 if (
present(single) ) single_ = single
488 if (
present(rankid) )
then 494 call file_get_fid( basename, mode_, rankid_, single_, &
496 aggregate=aggregate, postfix=postfix )
506 integer,
intent( in) :: fid
507 logical :: FILE_opened
510 file_opened = .false.
512 file_opened = file_files(fid)%fid >= 0
525 integer,
intent(in) :: fid
526 character(len=*),
intent(in) :: dimname
528 integer,
intent(out) :: len
530 logical,
intent(out),
optional :: error
536 log_error(
"FILE_get_dimLength",*)
'File is not opened. fid = ', fid
543 if (
present(error) )
then 546 log_error(
"FILE_get_dimLength",*)
'failed to get dimension length' 550 if (
present(error) ) error = .false.
559 subroutine file_put_axis_realsp( &
564 integer,
intent(in) :: fid
565 character(len=*),
intent(in) :: name
566 character(len=*),
intent(in) :: desc
567 character(len=*),
intent(in) :: units
568 character(len=*),
intent(in) :: dim_name
569 integer,
intent(in) :: dtype
570 real(SP),
intent(in) :: val(:)
576 log_error(
"FILE_put_axis_real",*)
'File is not opened. fid = ', fid
581 name, desc, units, dim_name, dtype, val,
size(val),
sp, &
584 log_error(
"FILE_put_axis_realSP",*)
'failed to put axis' 589 end subroutine file_put_axis_realsp
590 subroutine file_put_axis_realdp( &
595 integer,
intent(in) :: fid
596 character(len=*),
intent(in) :: name
597 character(len=*),
intent(in) :: desc
598 character(len=*),
intent(in) :: units
599 character(len=*),
intent(in) :: dim_name
600 integer,
intent(in) :: dtype
601 real(DP),
intent(in) :: val(:)
607 log_error(
"FILE_put_axis_real",*)
'File is not opened. fid = ', fid
612 name, desc, units, dim_name, dtype, val,
size(val),
dp, &
615 log_error(
"FILE_put_axis_realDP",*)
'failed to put axis' 620 end subroutine file_put_axis_realdp
625 dim_name, dtype, dim_size, &
627 integer,
intent(in) :: fid
628 character(len=*),
intent(in) :: name
629 character(len=*),
intent(in) :: desc
630 character(len=*),
intent(in) :: units
631 character(len=*),
intent(in) :: dim_name
632 integer,
intent(in) :: dtype
633 integer,
intent(in) :: dim_size
635 logical,
intent(in),
optional :: bounds
641 if (
present(bounds) )
then 642 if ( bounds ) bounds_ = 1
646 log_error(
"FILE_def_axis",*)
'File is not opened. fid = ', fid
651 name, desc, units, dim_name, dtype, dim_size, bounds_, &
654 log_error(
"FILE_def_axis",*)
'failed to define axis' 664 subroutine file_write_axis_realsp( &
669 integer,
intent(in) :: fid
670 character(len=*),
intent(in) :: name
671 real(SP),
intent(in) :: val(:)
672 integer,
intent(in),
optional :: start(:)
678 log_error(
"FILE_write_axis_realSP",*)
'File is not opened. fid = ', fid
682 if (
present(start) )
then 684 name, val,
sp, start, shape(val), &
688 name, val,
sp, (/1/), shape(val), &
692 log_error(
"FILE_write_axis_realSP",*)
'failed to write axis: '//trim(name)
697 end subroutine file_write_axis_realsp
698 subroutine file_write_axis_realdp( &
703 integer,
intent(in) :: fid
704 character(len=*),
intent(in) :: name
705 real(DP),
intent(in) :: val(:)
706 integer,
intent(in),
optional :: start(:)
712 log_error(
"FILE_write_axis_realDP",*)
'File is not opened. fid = ', fid
716 if (
present(start) )
then 718 name, val,
dp, start, shape(val), &
722 name, val,
dp, (/1/), shape(val), &
726 log_error(
"FILE_write_axis_realDP",*)
'failed to write axis: '//trim(name)
731 end subroutine file_write_axis_realdp
736 subroutine file_put_associatedcoordinate_realsp_1d( &
741 integer,
intent(in) :: fid
742 character(len=*),
intent(in) :: name
743 character(len=*),
intent(in) :: desc
744 character(len=*),
intent(in) :: units
745 character(len=*),
intent(in) :: dim_names(:)
746 integer,
intent(in) :: dtype
747 real(SP),
intent(in) :: val(:)
753 log_error(
"FILE_put_associatedCoordinate_realSP_1D",*)
'File is not opened. fid = ', fid
758 name, desc, units, dim_names,
size(dim_names), dtype, &
762 log_error(
"FILE_put_associatedCoordinate_realSP_1D",*)
'failed to put associated coordinate: '//trim(name)
767 end subroutine file_put_associatedcoordinate_realsp_1d
768 subroutine file_put_associatedcoordinate_realdp_1d( &
773 integer,
intent(in) :: fid
774 character(len=*),
intent(in) :: name
775 character(len=*),
intent(in) :: desc
776 character(len=*),
intent(in) :: units
777 character(len=*),
intent(in) :: dim_names(:)
778 integer,
intent(in) :: dtype
779 real(DP),
intent(in) :: val(:)
785 log_error(
"FILE_put_associatedCoordinate_realDP_1D",*)
'File is not opened. fid = ', fid
790 name, desc, units, dim_names,
size(dim_names), dtype, &
794 log_error(
"FILE_put_associatedCoordinate_realDP_1D",*)
'failed to put associated coordinate: '//trim(name)
799 end subroutine file_put_associatedcoordinate_realdp_1d
800 subroutine file_put_associatedcoordinate_realsp_2d( &
805 integer,
intent(in) :: fid
806 character(len=*),
intent(in) :: name
807 character(len=*),
intent(in) :: desc
808 character(len=*),
intent(in) :: units
809 character(len=*),
intent(in) :: dim_names(:)
810 integer,
intent(in) :: dtype
811 real(SP),
intent(in) :: val(:,:)
817 log_error(
"FILE_put_associatedCoordinate_realSP_2D",*)
'File is not opened. fid = ', fid
822 name, desc, units, dim_names,
size(dim_names), dtype, &
826 log_error(
"FILE_put_associatedCoordinate_realSP_2D",*)
'failed to put associated coordinate: '//trim(name)
831 end subroutine file_put_associatedcoordinate_realsp_2d
832 subroutine file_put_associatedcoordinate_realdp_2d( &
837 integer,
intent(in) :: fid
838 character(len=*),
intent(in) :: name
839 character(len=*),
intent(in) :: desc
840 character(len=*),
intent(in) :: units
841 character(len=*),
intent(in) :: dim_names(:)
842 integer,
intent(in) :: dtype
843 real(DP),
intent(in) :: val(:,:)
849 log_error(
"FILE_put_associatedCoordinate_realDP_2D",*)
'File is not opened. fid = ', fid
854 name, desc, units, dim_names,
size(dim_names), dtype, &
858 log_error(
"FILE_put_associatedCoordinate_realDP_2D",*)
'failed to put associated coordinate: '//trim(name)
863 end subroutine file_put_associatedcoordinate_realdp_2d
864 subroutine file_put_associatedcoordinate_realsp_3d( &
869 integer,
intent(in) :: fid
870 character(len=*),
intent(in) :: name
871 character(len=*),
intent(in) :: desc
872 character(len=*),
intent(in) :: units
873 character(len=*),
intent(in) :: dim_names(:)
874 integer,
intent(in) :: dtype
875 real(SP),
intent(in) :: val(:,:,:)
881 log_error(
"FILE_put_associatedCoordinate_realSP_3D",*)
'File is not opened. fid = ', fid
886 name, desc, units, dim_names,
size(dim_names), dtype, &
890 log_error(
"FILE_put_associatedCoordinate_realSP_3D",*)
'failed to put associated coordinate: '//trim(name)
895 end subroutine file_put_associatedcoordinate_realsp_3d
896 subroutine file_put_associatedcoordinate_realdp_3d( &
901 integer,
intent(in) :: fid
902 character(len=*),
intent(in) :: name
903 character(len=*),
intent(in) :: desc
904 character(len=*),
intent(in) :: units
905 character(len=*),
intent(in) :: dim_names(:)
906 integer,
intent(in) :: dtype
907 real(DP),
intent(in) :: val(:,:,:)
913 log_error(
"FILE_put_associatedCoordinate_realDP_3D",*)
'File is not opened. fid = ', fid
918 name, desc, units, dim_names,
size(dim_names), dtype, &
922 log_error(
"FILE_put_associatedCoordinate_realDP_3D",*)
'failed to put associated coordinate: '//trim(name)
927 end subroutine file_put_associatedcoordinate_realdp_3d
928 subroutine file_put_associatedcoordinate_realsp_4d( &
933 integer,
intent(in) :: fid
934 character(len=*),
intent(in) :: name
935 character(len=*),
intent(in) :: desc
936 character(len=*),
intent(in) :: units
937 character(len=*),
intent(in) :: dim_names(:)
938 integer,
intent(in) :: dtype
939 real(SP),
intent(in) :: val(:,:,:,:)
945 log_error(
"FILE_put_associatedCoordinate_realSP_4D",*)
'File is not opened. fid = ', fid
950 name, desc, units, dim_names,
size(dim_names), dtype, &
954 log_error(
"FILE_put_associatedCoordinate_realSP_4D",*)
'failed to put associated coordinate: '//trim(name)
959 end subroutine file_put_associatedcoordinate_realsp_4d
960 subroutine file_put_associatedcoordinate_realdp_4d( &
965 integer,
intent(in) :: fid
966 character(len=*),
intent(in) :: name
967 character(len=*),
intent(in) :: desc
968 character(len=*),
intent(in) :: units
969 character(len=*),
intent(in) :: dim_names(:)
970 integer,
intent(in) :: dtype
971 real(DP),
intent(in) :: val(:,:,:,:)
977 log_error(
"FILE_put_associatedCoordinate_realDP_4D",*)
'File is not opened. fid = ', fid
982 name, desc, units, dim_names,
size(dim_names), dtype, &
986 log_error(
"FILE_put_associatedCoordinate_realDP_4D",*)
'failed to put associated coordinate: '//trim(name)
991 end subroutine file_put_associatedcoordinate_realdp_4d
997 integer,
intent(in) :: fid
998 character(len=*),
intent(in) :: name
999 character(len=*),
intent(in) :: desc
1000 character(len=*),
intent(in) :: units
1001 character(len=*),
intent(in) :: dim_names(:)
1002 integer,
intent(in) :: dtype
1008 log_error(
"FILE_def_associatedCoordinate",*)
'File is not opened. fid = ', fid
1013 name, desc, units, dim_names,
size(dim_names), dtype, &
1016 log_error(
"FILE_def_associatedCoordinate",*)
'failed to put associated coordinate: '//trim(name)
1026 subroutine file_write_associatedcoordinate_realsp_1d( &
1032 integer,
intent(in) :: fid
1033 character(len=*),
intent(in) :: name
1034 real(SP),
intent(in) :: val(:)
1035 integer,
intent(in),
optional :: start(:)
1036 integer,
intent(in),
optional :: count(:)
1037 integer,
intent(in),
optional :: ndims
1043 log_error(
"FILE_write_associatedCoordinate_realSP_1D",*)
'File is not opened. fid = ', fid
1047 if (
present(ndims) )
then 1052 ndims, start, count, &
1054 else if (
present(start) )
then 1058 1, start, shape(val), &
1064 1, (/1/), shape(val), &
1068 log_error(
"FILE_write_associatedCoordinate_realSP_1D",*)
'failed to put associated coordinate: '//trim(name)
1073 end subroutine file_write_associatedcoordinate_realsp_1d
1074 subroutine file_write_associatedcoordinate_realdp_1d( &
1080 integer,
intent(in) :: fid
1081 character(len=*),
intent(in) :: name
1082 real(DP),
intent(in) :: val(:)
1083 integer,
intent(in),
optional :: start(:)
1084 integer,
intent(in),
optional :: count(:)
1085 integer,
intent(in),
optional :: ndims
1091 log_error(
"FILE_write_associatedCoordinate_realDP_1D",*)
'File is not opened. fid = ', fid
1095 if (
present(ndims) )
then 1100 ndims, start, count, &
1102 else if (
present(start) )
then 1106 1, start, shape(val), &
1112 1, (/1/), shape(val), &
1116 log_error(
"FILE_write_associatedCoordinate_realDP_1D",*)
'failed to put associated coordinate: '//trim(name)
1121 end subroutine file_write_associatedcoordinate_realdp_1d
1122 subroutine file_write_associatedcoordinate_realsp_2d( &
1128 integer,
intent(in) :: fid
1129 character(len=*),
intent(in) :: name
1130 real(SP),
intent(in) :: val(:,:)
1131 integer,
intent(in),
optional :: start(:)
1132 integer,
intent(in),
optional :: count(:)
1133 integer,
intent(in),
optional :: ndims
1139 log_error(
"FILE_write_associatedCoordinate_realSP_2D",*)
'File is not opened. fid = ', fid
1143 if (
present(ndims) )
then 1148 ndims, start, count, &
1150 else if (
present(start) )
then 1154 2, start, shape(val), &
1160 2, (/1,1/), shape(val), &
1164 log_error(
"FILE_write_associatedCoordinate_realSP_2D",*)
'failed to put associated coordinate: '//trim(name)
1169 end subroutine file_write_associatedcoordinate_realsp_2d
1170 subroutine file_write_associatedcoordinate_realdp_2d( &
1176 integer,
intent(in) :: fid
1177 character(len=*),
intent(in) :: name
1178 real(DP),
intent(in) :: val(:,:)
1179 integer,
intent(in),
optional :: start(:)
1180 integer,
intent(in),
optional :: count(:)
1181 integer,
intent(in),
optional :: ndims
1187 log_error(
"FILE_write_associatedCoordinate_realDP_2D",*)
'File is not opened. fid = ', fid
1191 if (
present(ndims) )
then 1196 ndims, start, count, &
1198 else if (
present(start) )
then 1202 2, start, shape(val), &
1208 2, (/1,1/), shape(val), &
1212 log_error(
"FILE_write_associatedCoordinate_realDP_2D",*)
'failed to put associated coordinate: '//trim(name)
1217 end subroutine file_write_associatedcoordinate_realdp_2d
1218 subroutine file_write_associatedcoordinate_realsp_3d( &
1224 integer,
intent(in) :: fid
1225 character(len=*),
intent(in) :: name
1226 real(SP),
intent(in) :: val(:,:,:)
1227 integer,
intent(in),
optional :: start(:)
1228 integer,
intent(in),
optional :: count(:)
1229 integer,
intent(in),
optional :: ndims
1235 log_error(
"FILE_write_associatedCoordinate_realSP_3D",*)
'File is not opened. fid = ', fid
1239 if (
present(ndims) )
then 1244 ndims, start, count, &
1246 else if (
present(start) )
then 1250 3, start, shape(val), &
1256 3, (/1,1,1/), shape(val), &
1260 log_error(
"FILE_write_associatedCoordinate_realSP_3D",*)
'failed to put associated coordinate: '//trim(name)
1265 end subroutine file_write_associatedcoordinate_realsp_3d
1266 subroutine file_write_associatedcoordinate_realdp_3d( &
1272 integer,
intent(in) :: fid
1273 character(len=*),
intent(in) :: name
1274 real(DP),
intent(in) :: val(:,:,:)
1275 integer,
intent(in),
optional :: start(:)
1276 integer,
intent(in),
optional :: count(:)
1277 integer,
intent(in),
optional :: ndims
1283 log_error(
"FILE_write_associatedCoordinate_realDP_3D",*)
'File is not opened. fid = ', fid
1287 if (
present(ndims) )
then 1292 ndims, start, count, &
1294 else if (
present(start) )
then 1298 3, start, shape(val), &
1304 3, (/1,1,1/), shape(val), &
1308 log_error(
"FILE_write_associatedCoordinate_realDP_3D",*)
'failed to put associated coordinate: '//trim(name)
1313 end subroutine file_write_associatedcoordinate_realdp_3d
1314 subroutine file_write_associatedcoordinate_realsp_4d( &
1320 integer,
intent(in) :: fid
1321 character(len=*),
intent(in) :: name
1322 real(SP),
intent(in) :: val(:,:,:,:)
1323 integer,
intent(in),
optional :: start(:)
1324 integer,
intent(in),
optional :: count(:)
1325 integer,
intent(in),
optional :: ndims
1331 log_error(
"FILE_write_associatedCoordinate_realSP_4D",*)
'File is not opened. fid = ', fid
1335 if (
present(ndims) )
then 1340 ndims, start, count, &
1342 else if (
present(start) )
then 1346 4, start, shape(val), &
1352 4, (/1,1,1,1/), shape(val), &
1356 log_error(
"FILE_write_associatedCoordinate_realSP_4D",*)
'failed to put associated coordinate: '//trim(name)
1361 end subroutine file_write_associatedcoordinate_realsp_4d
1362 subroutine file_write_associatedcoordinate_realdp_4d( &
1368 integer,
intent(in) :: fid
1369 character(len=*),
intent(in) :: name
1370 real(DP),
intent(in) :: val(:,:,:,:)
1371 integer,
intent(in),
optional :: start(:)
1372 integer,
intent(in),
optional :: count(:)
1373 integer,
intent(in),
optional :: ndims
1379 log_error(
"FILE_write_associatedCoordinate_realDP_4D",*)
'File is not opened. fid = ', fid
1383 if (
present(ndims) )
then 1388 ndims, start, count, &
1390 else if (
present(start) )
then 1394 4, start, shape(val), &
1400 4, (/1,1,1,1/), shape(val), &
1404 log_error(
"FILE_write_associatedCoordinate_realDP_4D",*)
'failed to put associated coordinate: '//trim(name)
1409 end subroutine file_write_associatedcoordinate_realdp_4d
1414 subroutine file_add_variable_no_time( &
1416 varname, desc, units, &
1421 integer,
intent( in) :: fid
1422 character(len=*),
intent( in) :: varname
1423 character(len=*),
intent( in) :: desc
1424 character(len=*),
intent( in) :: units
1425 character(len=*),
intent( in) :: standard_name
1426 character(len=*),
intent( in) :: dims(:)
1427 integer,
intent( in) :: dtype
1428 integer,
intent(out) :: vid
1429 logical,
intent( in),
optional :: time_avg
1432 log_error(
"FILE_add_variable_no_time",*)
'File is not opened. fid = ', fid
1436 call file_add_variable_with_time( fid, &
1437 varname, desc, units, standard_name, &
1438 dims, dtype, -1.0_dp, &
1440 time_avg = time_avg )
1443 end subroutine file_add_variable_no_time
1446 subroutine file_add_variable_with_time( &
1448 varname, desc, units, &
1455 integer,
intent(in) :: fid
1456 character(len=*),
intent(in) :: varname
1457 character(len=*),
intent(in) :: desc
1458 character(len=*),
intent(in) :: units
1459 character(len=*),
intent(in) :: standard_name
1460 character(len=*),
intent(in) :: dims(:)
1461 integer,
intent(in) :: dtype
1462 real(DP),
intent(in) :: time_int
1464 integer,
intent(out) :: vid
1466 logical,
intent(in),
optional :: time_avg
1478 log_error(
"FILE_add_variable_with_time",*)
'File is not opened. fid = ', fid
1483 do n = 1, file_nvars
1484 if ( file_vars(n)%fid == fid .and. file_vars(n)%name == varname )
then 1485 vid = file_vars(n)%vid
1495 if (
present(time_avg) )
then 1496 if( time_avg ) itavg = 1
1500 varname, desc, units, standard_name, &
1501 dims, ndims, dtype, time_int, itavg, &
1505 log_error(
"FILE_add_variable_with_time",*)
'failed to add variable: '//trim(varname)
1509 file_nvars = file_nvars + 1
1511 file_vars(vid)%name = varname
1512 file_vars(vid)%vid = cvid
1513 file_vars(vid)%fid = fid
1515 log_info(
"FILE_add_variable_with_time",
'(1x,A,I3.3,A,I4.4,2A)') &
1516 'Variable registration : NO.', fid,
', vid = ', vid,
', name = ', trim(varname)
1520 end subroutine file_add_variable_with_time
1524 varname, desc, units, &
1529 time_int, time_avg, &
1531 integer,
intent( in) :: fid
1532 character(len=*),
intent( in) :: varname
1533 character(len=*),
intent( in) :: desc
1534 character(len=*),
intent( in) :: units
1535 character(len=*),
intent( in) :: standard_name
1536 integer,
intent( in) :: ndims
1537 character(len=*),
intent( in) :: dims(:)
1538 integer,
intent( in) :: dtype
1539 integer,
intent(out) :: vid
1540 real(DP),
intent( in),
optional :: time_int
1541 logical,
intent( in),
optional :: time_avg
1542 logical,
intent(out),
optional :: existed
1553 log_error(
"FILE_def_variable",*)
'File is not opened. fid = ', fid
1558 do n = 1, file_nvars
1559 if ( file_vars(n)%fid == fid .and. file_vars(n)%name == varname )
then 1566 if (
present(time_int) )
then 1572 if (
present(time_avg) )
then 1573 if ( time_avg )
then 1583 varname, desc, units, standard_name, &
1584 dims, ndims, dtype, &
1588 log_error(
"FILE_def_variable",*)
'failed to add variable: '//trim(varname)
1592 file_nvars = file_nvars + 1
1594 file_vars(vid)%name = varname
1595 file_vars(vid)%vid = cvid
1596 file_vars(vid)%fid = fid
1598 log_info(
"FILE_def_variable",
'(1x,A,I3.3,A,I4.4,2A)') &
1599 'Variable registration : NO.', fid,
', vid = ', vid,
', name = ', trim(varname)
1601 if (
present(existed) ) existed = .false.
1603 if (
present(existed) ) existed = .true.
1612 subroutine file_get_attribute_text_fid( &
1617 integer,
intent(in ) :: fid
1618 character(len=*),
intent(in ) :: vname
1619 character(len=*),
intent(in ) :: key
1620 character(len=*),
intent(out) :: val
1622 logical,
intent(out),
optional :: existed
1628 log_error(
"FILE_get_attribute_text_fid",*)
'File is not opened. fid = ', fid
1632 if (
present(existed) )
then 1638 file_files(fid)%fid, vname, &
1642 if (
present(existed) )
then 1645 log_error(
"FILE_get_attribute_text_fid",*)
'failed to get text attribute for '//trim(vname)//
': '//trim(key)
1649 if (
present(existed) ) existed = .true.
1653 end subroutine file_get_attribute_text_fid
1654 subroutine file_get_attribute_text_fname( &
1655 basename, vname, key, &
1657 single, aggregate, rankid, &
1661 character(len=*),
intent(in) :: basename
1662 character(len=*),
intent(in) :: vname
1663 character(len=*),
intent(in) :: key
1665 character(len=*),
intent(out) :: val
1667 logical,
intent(in),
optional :: single
1668 logical,
intent(in),
optional :: aggregate
1669 integer,
intent(in),
optional :: rankid
1671 logical,
intent(out),
optional :: existed
1677 aggregate=aggregate, &
1680 call file_get_attribute_text_fid( &
1686 end subroutine file_get_attribute_text_fname
1689 subroutine file_get_attribute_logical_fid( &
1694 integer,
intent(in ) :: fid
1695 character(len=*),
intent(in ) :: vname
1696 character(len=*),
intent(in ) :: key
1697 logical,
intent(out) :: val
1699 logical,
intent(out),
optional :: existed
1701 character(len=5) :: buf
1704 log_error(
"FILE_get_attribute_logical_fid",*)
'File is not opened. fid = ', fid
1708 call file_get_attribute_text_fid( fid, vname, key, &
1711 if (
present(existed) )
then 1712 if ( .not. existed )
return 1715 if ( buf ==
"true" )
then 1717 else if ( buf ==
"false" )
then 1720 log_error(
"FILE_get_attribute_logical_fid",*)
'value is not eigher true or false' 1725 end subroutine file_get_attribute_logical_fid
1726 subroutine file_get_attribute_logical_fname( &
1727 basename, vname, key, &
1729 single, aggregate, rankid, &
1733 character(len=*),
intent(in) :: basename
1734 character(len=*),
intent(in) :: vname
1735 character(len=*),
intent(in) :: key
1737 logical,
intent(out) :: val
1739 logical,
intent(in),
optional :: single
1740 logical,
intent(in),
optional :: aggregate
1741 integer,
intent(in),
optional :: rankid
1743 logical,
intent(out),
optional :: existed
1749 aggregate=aggregate, &
1752 call file_get_attribute_logical_fid( &
1758 end subroutine file_get_attribute_logical_fname
1761 subroutine file_get_attribute_int_fid( &
1765 integer,
intent(in ) :: fid
1766 character(len=*),
intent(in ) :: vname
1767 character(len=*),
intent(in ) :: key
1768 integer,
intent(out) :: val(:)
1770 logical,
intent(out),
optional :: existed
1778 log_error(
"FILE_get_attribute_int_fid",*)
'File is not opened. fid = ', fid
1782 if (
present(existed) )
then 1788 file_files(fid)%fid, vname, &
1789 key,
size(val), suppress, &
1792 if (
present(existed) )
then 1795 log_error(
"FILE_get_attribute_int_fid",*)
'failed to get integer attribute for '//trim(vname)//
': '//trim(key)
1799 if (
present(existed) ) existed = .true.
1803 end subroutine file_get_attribute_int_fid
1804 subroutine file_get_attribute_int_fname( &
1805 basename, vname, key, &
1807 single, aggregate, rankid, &
1811 character(len=*),
intent(in) :: basename
1812 character(len=*),
intent(in) :: vname
1813 character(len=*),
intent(in) :: key
1815 integer,
intent(out) :: val(:)
1817 logical,
intent(in),
optional :: single
1818 logical,
intent(in),
optional :: aggregate
1819 integer,
intent(in),
optional :: rankid
1821 logical,
intent(out),
optional :: existed
1828 aggregate=aggregate, &
1831 call file_get_attribute_int_fid( &
1837 end subroutine file_get_attribute_int_fname
1840 subroutine file_get_attribute_float_fid( &
1844 integer,
intent(in ) :: fid
1845 character(len=*),
intent(in ) :: vname
1846 character(len=*),
intent(in ) :: key
1847 real(SP),
intent(out) :: val(:)
1849 logical,
intent(out),
optional :: existed
1857 log_error(
"FILE_get_attribute_float_fid",*)
'File is not opened. fid = ', fid
1861 if (
present(existed) )
then 1867 file_files(fid)%fid, vname, &
1868 key,
size(val), suppress, &
1871 if (
present(existed) )
then 1874 log_error(
"FILE_get_attribute_float_fid",*)
'failed to get float attribute for '//trim(vname)//
': '//trim(key)
1878 if (
present(existed) ) existed = .true.
1882 end subroutine file_get_attribute_float_fid
1883 subroutine file_get_attribute_float_fname( &
1884 basename, vname, key, &
1886 single, aggregate, rankid, &
1890 character(len=*),
intent(in) :: basename
1891 character(len=*),
intent(in) :: vname
1892 character(len=*),
intent(in) :: key
1894 real(SP),
intent(out) :: val(:)
1896 logical,
intent(in),
optional :: single
1897 logical,
intent(in),
optional :: aggregate
1898 integer,
intent(in),
optional :: rankid
1900 logical,
intent(out),
optional :: existed
1907 aggregate=aggregate, &
1910 call file_get_attribute_float_fid( &
1916 end subroutine file_get_attribute_float_fname
1917 subroutine file_get_attribute_double_fid( &
1921 integer,
intent(in ) :: fid
1922 character(len=*),
intent(in ) :: vname
1923 character(len=*),
intent(in ) :: key
1924 real(DP),
intent(out) :: val(:)
1926 logical,
intent(out),
optional :: existed
1934 log_error(
"FILE_get_attribute_double_fid",*)
'File is not opened. fid = ', fid
1938 if (
present(existed) )
then 1944 file_files(fid)%fid, vname, &
1945 key,
size(val), suppress, &
1948 if (
present(existed) )
then 1951 log_error(
"FILE_get_attribute_double_fid",*)
'failed to get double attribute for '//trim(vname)//
': '//trim(key)
1955 if (
present(existed) ) existed = .true.
1959 end subroutine file_get_attribute_double_fid
1960 subroutine file_get_attribute_double_fname( &
1961 basename, vname, key, &
1963 single, aggregate, rankid, &
1967 character(len=*),
intent(in) :: basename
1968 character(len=*),
intent(in) :: vname
1969 character(len=*),
intent(in) :: key
1971 real(DP),
intent(out) :: val(:)
1973 logical,
intent(in),
optional :: single
1974 logical,
intent(in),
optional :: aggregate
1975 integer,
intent(in),
optional :: rankid
1977 logical,
intent(out),
optional :: existed
1984 aggregate=aggregate, &
1987 call file_get_attribute_double_fid( &
1993 end subroutine file_get_attribute_double_fname
1998 subroutine file_set_attribute_text( &
2001 integer,
intent(in) :: fid
2002 character(len=*),
intent(in) :: vname
2003 character(len=*),
intent(in) :: key
2004 character(len=*),
intent(in) :: val
2009 log_error(
"FILE_set_attribute_text",*)
'File is not opened. fid = ', fid
2014 file_files(fid)%fid, vname, &
2018 log_error(
"FILE_set_attribute_text",*)
'failed to set text attribute for '//trim(vname)//
': '//trim(key)
2023 end subroutine file_set_attribute_text
2025 subroutine file_set_attribute_logical( &
2028 integer,
intent(in) :: fid
2029 character(len=*),
intent(in) :: vname
2030 character(len=*),
intent(in) :: key
2031 logical,
intent(in) :: val
2033 character(len=5) :: buf
2036 log_error(
"FILE_set_attribute_logical",*)
'File is not opened. fid = ', fid
2046 call file_set_attribute_text( fid, vname, key, buf )
2049 end subroutine file_set_attribute_logical
2052 subroutine file_set_attribute_int( &
2055 integer,
intent(in) :: fid
2056 character(len=*),
intent(in) :: vname
2057 character(len=*),
intent(in) :: key
2058 integer,
intent(in) :: val(:)
2065 log_error(
"FILE_set_attribute_int",*)
'File is not opened. fid = ', fid
2070 file_files(fid)%fid, vname, &
2071 key, val(:),
size(val(:)), &
2074 log_error(
"FILE_set_attribute_int",*)
'failed to set integer attribute for '//trim(vname)//
': '//trim(key)
2079 end subroutine file_set_attribute_int
2082 subroutine file_set_attribute_float( &
2085 integer,
intent(in) :: fid
2086 character(len=*),
intent(in) :: vname
2087 character(len=*),
intent(in) :: key
2088 real(SP),
intent(in) :: val(:)
2095 log_error(
"FILE_set_attributefloat",*)
'File is not opened. fid = ', fid
2100 file_files(fid)%fid, vname, &
2101 key, val(:),
size(val(:)), &
2104 log_error(
"FILE_set_attribute_float",*)
'failed to set float attribute for '//trim(vname)//
': '//trim(key)
2109 end subroutine file_set_attribute_float
2111 subroutine file_set_attribute_double( &
2114 integer,
intent(in) :: fid
2115 character(len=*),
intent(in) :: vname
2116 character(len=*),
intent(in) :: key
2117 real(DP),
intent(in) :: val(:)
2124 log_error(
"FILE_set_attributedouble",*)
'File is not opened. fid = ', fid
2129 file_files(fid)%fid, vname, &
2130 key, val(:),
size(val(:)), &
2133 log_error(
"FILE_set_attribute_double",*)
'failed to set double attribute for '//trim(vname)//
': '//trim(key)
2138 end subroutine file_set_attribute_double
2142 subroutine file_get_shape_fname( &
2143 basename, varname, &
2149 character(len=*),
intent( in) :: basename
2150 character(len=*),
intent( in) :: varname
2151 integer,
intent(out) :: dims(:)
2152 integer,
intent( in),
optional :: rankid
2153 logical,
intent( in),
optional :: single
2154 logical,
intent(out),
optional :: error
2162 rankid=rankid, single=single )
2164 call file_get_shape_fid( fid, varname, &
2169 end subroutine file_get_shape_fname
2171 subroutine file_get_shape_fid( &
2176 integer,
intent( in) :: fid
2177 character(len=*),
intent( in) :: varname
2179 integer,
intent(out) :: dims(:)
2181 logical,
intent(out),
optional :: error
2193 log_error(
"FILE_get_shape_id",*)
'File is not opened. fid = ', fid
2197 if (
present(error) )
then 2205 file_files(fid)%fid, varname, &
2211 if (
present(error) )
then 2215 log_error(
"FILE_get_shape_fid",*)
'failed to get data information : ', trim(varname)
2220 if ( dinfo%rank /=
size(dims) )
then 2221 log_error(
"FILE_get_shape_fid",*)
'rank is different, ', trim(varname),
size(dims), dinfo%rank
2224 do n = 1,
size(dims)
2225 dims(n) = dinfo%dim_size(n)
2228 if (
present(error) ) error = .false.
2231 end subroutine file_get_shape_fid
2240 integer,
intent(in) :: fid
2241 character(len=*),
intent(in) :: varname
2243 integer,
intent(out) :: len
2245 logical,
intent(out),
optional :: error
2250 log_error(
"FILE_get_stepSize",*)
'File is not opened. fid = ', fid
2257 if (
present(error) )
then 2260 log_error(
"FILE_get_stepSize",*)
'failed to get number of steps' 2264 if (
present(error) ) error = .false.
2273 subroutine file_get_commoninfo_fname( &
2284 character(len=*),
intent(in) :: basename
2285 integer,
intent(in) :: rankid
2286 integer,
intent(in) :: nvars_limit
2287 character(len=FILE_HMID),
intent(out) :: title
2288 character(len=FILE_HMID),
intent(out) :: source
2289 character(len=FILE_HMID),
intent(out) :: institution
2290 integer,
intent(out) :: nvars
2291 character(len=FILE_HSHORT),
intent(out) :: varname(nvars_limit)
2300 call file_get_commoninfo_fid( fid, &
2309 end subroutine file_get_commoninfo_fname
2311 subroutine file_get_commoninfo_fid( &
2321 integer,
intent(in) :: fid
2322 integer,
intent(in) :: nvars_limit
2323 character(len=FILE_HMID),
intent(out) :: title
2324 character(len=FILE_HMID),
intent(out) :: source
2325 character(len=FILE_HMID),
intent(out) :: institution
2326 integer,
intent(out) :: nvars
2327 character(len=FILE_HSHORT),
intent(out) :: varname(nvars_limit)
2333 log_error(
"FILE_get_commonInfo_fid",*)
'File is not opened. fid = ', fid
2337 call file_get_attribute( fid,
'global',
'title', title )
2338 call file_get_attribute( fid,
'global',
'source', source )
2339 call file_get_attribute( fid,
'global',
'institution', institution )
2341 call file_get_var_num( fid, nvars_limit, nvars )
2344 call file_get_var_name( fid, v, varname(v) )
2348 end subroutine file_get_commoninfo_fid
2353 subroutine file_get_datainfo_fname( &
2354 basename, varname, &
2355 rankid, istep, single, &
2357 description, units, standard_name, &
2359 dim_rank, dim_name, dim_size, &
2360 natts, att_name, att_type, att_len, &
2361 time_start, time_end, &
2362 time_units, calendar )
2365 character(len=*),
intent(in) :: basename
2366 character(len=*),
intent(in) :: varname
2368 integer,
intent(in),
optional :: rankid
2369 integer,
intent(in),
optional :: istep
2370 logical,
intent(in),
optional :: single
2371 logical,
intent(out),
optional :: existed
2372 character(len=FILE_HMID),
intent(out),
optional :: description
2373 character(len=FILE_HSHORT),
intent(out),
optional :: units
2374 character(len=FILE_HMID),
intent(out),
optional :: standard_name
2375 integer,
intent(out),
optional :: datatype
2376 integer,
intent(out),
optional :: dim_rank
2377 character(len=FILE_HSHORT),
intent(out),
optional :: dim_name(:)
2378 integer,
intent(out),
optional :: dim_size(:)
2379 integer,
intent(out),
optional :: natts
2380 character(len=FILE_HSHORT),
intent(out),
optional :: att_name(:)
2381 integer,
intent(out),
optional :: att_type(:)
2382 integer,
intent(out),
optional :: att_len (:)
2383 real(DP),
intent(out),
optional :: time_start
2384 real(DP),
intent(out),
optional :: time_end
2385 character(len=FILE_HMID),
intent(out),
optional :: time_units
2386 character(len=FILE_HSHORT),
intent(out),
optional :: calendar
2392 if (
present(single) )
then 2401 rankid=rankid, single=single_ )
2403 call file_get_datainfo_fid( fid, varname, &
2406 description, units, standard_name, &
2408 dim_rank, dim_name, dim_size, &
2409 natts, att_name, att_type, att_len, &
2410 time_start, time_end, time_units, calendar )
2413 end subroutine file_get_datainfo_fname
2415 subroutine file_get_datainfo_fid( &
2419 description, units, standard_name, &
2421 dim_rank, dim_name, dim_size, &
2422 natts, att_name, att_type, att_len, &
2423 time_start, time_end, &
2424 time_units, calendar )
2427 integer,
intent(in) :: fid
2428 character(len=*),
intent(in) :: varname
2430 integer,
intent(in),
optional :: istep
2431 logical,
intent(out),
optional :: existed
2432 character(len=FILE_HMID),
intent(out),
optional :: description
2433 character(len=FILE_HSHORT),
intent(out),
optional :: units
2434 character(len=FILE_HMID),
intent(out),
optional :: standard_name
2435 integer,
intent(out),
optional :: datatype
2436 integer,
intent(out),
optional :: dim_rank
2437 character(len=FILE_HSHORT),
intent(out),
optional :: dim_name(:)
2438 integer,
intent(out),
optional :: dim_size(:)
2439 integer,
intent(out),
optional :: natts
2440 character(len=FILE_HSHORT),
intent(out),
optional :: att_name(:)
2441 integer,
intent(out),
optional :: att_type(:)
2442 integer,
intent(out),
optional :: att_len (:)
2443 real(DP),
intent(out),
optional :: time_start
2444 real(DP),
intent(out),
optional :: time_end
2445 character(len=FILE_HMID),
intent(out),
optional :: time_units
2446 character(len=FILE_HSHORT),
intent(out),
optional :: calendar
2461 if (
present(istep) )
then 2467 if (
present(existed) )
then 2474 log_error(
"FILE_get_dataInfo_fid",*)
'File is not opened. fid = ', fid
2480 file_files(fid)%fid, &
2488 if (
present( existed ) )
then 2492 log_error(
"FILE_get_dataInfo_fid",*)
'data info not found' 2497 if (
present(existed) ) existed = .true.
2499 if (
present(description) ) description = dinfo%description
2500 if (
present(units) ) units = dinfo%units
2501 if (
present(standard_name) ) standard_name = dinfo%standard_name
2502 if (
present(datatype) ) datatype = dinfo%datatype
2503 if (
present(dim_rank) ) dim_rank = dinfo%rank
2505 if (
present(dim_name) )
then 2506 do i = 1, min( dinfo%rank,
size(dim_name) )
2507 dim_name(i) = dinfo%dim_name(i)
2511 if (
present(dim_size) )
then 2512 do i = 1, min( dinfo%rank,
size(dim_size) )
2513 dim_size(i) = dinfo%dim_size(i)
2517 if (
present(natts) ) natts = dinfo%natts
2518 if (
present(att_name) )
then 2519 do i = 1, min( dinfo%natts,
size(att_name) )
2520 att_name(i) = dinfo%att_name(i)
2523 if (
present(att_type) )
then 2524 do i = 1, min( dinfo%natts,
size(att_type) )
2525 att_type(i) = dinfo%att_type(i)
2528 if (
present(att_len) )
then 2529 do i = 1, min( dinfo%natts,
size(att_len) )
2530 att_len(i) = dinfo%att_len(i)
2534 if (
present(time_units) )
then 2535 if ( dinfo%time_units ==
"" )
then 2536 call file_get_attribute( fid,
"global",
"time_units", time_units )
2538 time_units = dinfo%time_units
2542 if (
present(calendar) )
then 2543 if ( dinfo%time_units ==
"" )
then 2544 call file_get_attribute( fid,
"global",
"calendar", calendar, existed2 )
2545 if ( .not. existed2 ) calendar =
"" 2547 calendar = dinfo%calendar
2551 if (
present(time_start) )
then 2552 if ( dinfo%time_units ==
"" )
then 2553 call file_get_attribute( fid,
"global",
"time_start", time )
2554 time_start = time(1)
2556 time_start = dinfo%time_start
2560 if (
present(time_end) )
then 2561 if ( dinfo%time_units ==
"" )
then 2562 call file_get_attribute( fid,
"global",
"time_start", time )
2565 time_end = dinfo%time_end
2570 end subroutine file_get_datainfo_fid
2575 subroutine file_get_all_datainfo_fname( &
2576 basename, varname, &
2578 description, units, standard_name, &
2580 dim_rank, dim_name, dim_size, &
2581 natts, att_name, att_type, att_len, &
2582 time_start, time_end, &
2583 time_units, calendar, &
2586 character(len=*),
intent(in) :: basename
2587 character(len=*),
intent(in) :: varname
2588 integer,
intent(out) :: step_nmax
2589 character(len=FILE_HMID),
intent(out) :: description
2590 character(len=FILE_HSHORT),
intent(out) :: units
2591 character(len=FILE_HMID),
intent(out) :: standard_name
2592 integer,
intent(out) :: datatype
2593 integer,
intent(out) :: dim_rank
2594 character(len=FILE_HSHORT),
intent(out) :: dim_name (:)
2595 integer,
intent(out) :: dim_size (:)
2596 integer,
intent(out) :: natts
2597 character(len=FILE_HSHORT),
intent(out) :: att_name (:)
2598 integer,
intent(out) :: att_type (:)
2599 integer,
intent(out) :: att_len (:)
2600 real(DP),
intent(out) :: time_start(:)
2601 real(DP),
intent(out) :: time_end (:)
2602 character(len=FILE_HMID),
intent(out) :: time_units
2603 character(len=FILE_HSHORT),
intent(out) :: calendar
2605 integer,
intent(in),
optional :: rankid
2606 logical,
intent(in),
optional :: single
2612 if (
present(single) )
then 2621 rankid=rankid, single=single_ )
2623 call file_get_all_datainfo_fid( fid, varname, &
2625 description, units, standard_name, &
2627 dim_rank, dim_name(:), dim_size(:), &
2628 natts, att_name(:), att_type(:), att_len(:), &
2629 time_start(:), time_end(:), &
2630 time_units, calendar )
2633 end subroutine file_get_all_datainfo_fname
2635 subroutine file_get_all_datainfo_fid( &
2638 description, units, standard_name, &
2640 dim_rank, dim_name, dim_size, &
2641 natts, att_name, att_type, att_len, &
2642 time_start, time_end, &
2643 time_units, calendar )
2646 integer,
intent(in) :: fid
2647 character(len=*),
intent(in) :: varname
2648 integer,
intent(out) :: step_nmax
2649 character(len=FILE_HMID),
intent(out) :: description
2650 character(len=FILE_HSHORT),
intent(out) :: units
2651 character(len=FILE_HMID),
intent(out) :: standard_name
2652 integer,
intent(out) :: datatype
2653 integer,
intent(out) :: dim_rank
2654 character(len=FILE_HSHORT),
intent(out) :: dim_name (:)
2655 integer,
intent(out) :: dim_size (:)
2656 integer,
intent(out) :: natts
2657 character(len=FILE_HSHORT),
intent(out) :: att_name (:)
2658 integer,
intent(out) :: att_type (:)
2659 integer,
intent(out) :: att_len (:)
2660 real(DP),
intent(out) :: time_start(:)
2661 real(DP),
intent(out) :: time_end (:)
2662 character(len=FILE_HMID),
intent(out) :: time_units
2663 character(len=FILE_HSHORT),
intent(out) :: calendar
2678 log_error(
"FILE_get_all_dataInfo_fid",*)
'File is not opened. fid = ', fid
2693 do istep = 1, min(
size(time_start),
size(time_end) )
2696 file_files(fid)%fid, &
2704 step_nmax = istep - 1
2708 if ( istep == 1 )
then 2709 description = dinfo%description
2711 standard_name = dinfo%standard_name
2712 datatype = dinfo%datatype
2713 dim_rank = dinfo%rank
2716 do i = 1, min( dinfo%rank,
size(dim_name) )
2717 dim_name(i) = dinfo%dim_name(i)
2718 dim_size(i) = dinfo%dim_size(i)
2721 do i = 1, min( dinfo%natts,
size(att_name) )
2722 att_name(i) = dinfo%att_name(i)
2723 att_type(i) = dinfo%att_type(i)
2724 att_len(i) = dinfo%att_len (i)
2727 if ( dinfo%time_units ==
"" )
then 2728 call file_get_attribute( fid,
"global",
"time_units", time_units )
2729 call file_get_attribute( fid,
"global",
"calendar", calendar, existed )
2730 if ( .not. existed ) calendar =
"" 2731 call file_get_attribute( fid,
"global",
"time_start", time )
2732 time_start(1) = time(1)
2733 time_end(1) = time(1)
2737 time_units = dinfo%time_units
2738 calendar = dinfo%calendar
2739 time_start(1) = dinfo%time_start
2740 time_end(1) = dinfo%time_end
2743 time_start(istep) = dinfo%time_start
2744 time_end(istep) = dinfo%time_end
2749 end subroutine file_get_all_datainfo_fid
2754 subroutine file_read_realsp_1d( &
2755 basename, varname, &
2757 step, rankid, single, postfix, &
2758 allow_missing, missing_value )
2761 character(len=*),
intent( in) :: basename
2762 character(len=*),
intent( in) :: varname
2763 real(SP),
intent(out) :: var(:)
2764 integer,
intent( in),
optional :: step
2765 integer,
intent( in),
optional :: rankid
2766 logical,
intent( in),
optional :: single
2767 character(len=*),
intent( in),
optional :: postfix
2768 logical,
intent( in),
optional :: allow_missing
2769 real(SP),
intent( in),
optional :: missing_value
2779 rankid=rankid, single=single, &
2782 call file_read_var_realsp_1d( &
2786 allow_missing=allow_missing, missing_value=missing_value )
2789 end subroutine file_read_realsp_1d
2790 subroutine file_read_realdp_1d( &
2791 basename, varname, &
2793 step, rankid, single, postfix, &
2794 allow_missing, missing_value )
2797 character(len=*),
intent( in) :: basename
2798 character(len=*),
intent( in) :: varname
2799 real(DP),
intent(out) :: var(:)
2800 integer,
intent( in),
optional :: step
2801 integer,
intent( in),
optional :: rankid
2802 logical,
intent( in),
optional :: single
2803 character(len=*),
intent( in),
optional :: postfix
2804 logical,
intent( in),
optional :: allow_missing
2805 real(DP),
intent( in),
optional :: missing_value
2815 rankid=rankid, single=single, &
2818 call file_read_var_realdp_1d( &
2822 allow_missing=allow_missing, missing_value=missing_value )
2825 end subroutine file_read_realdp_1d
2826 subroutine file_read_realsp_2d( &
2827 basename, varname, &
2829 step, rankid, single, postfix, &
2830 allow_missing, missing_value )
2833 character(len=*),
intent( in) :: basename
2834 character(len=*),
intent( in) :: varname
2835 real(SP),
intent(out) :: var(:,:)
2836 integer,
intent( in),
optional :: step
2837 integer,
intent( in),
optional :: rankid
2838 logical,
intent( in),
optional :: single
2839 character(len=*),
intent( in),
optional :: postfix
2840 logical,
intent( in),
optional :: allow_missing
2841 real(SP),
intent( in),
optional :: missing_value
2851 rankid=rankid, single=single, &
2854 call file_read_var_realsp_2d( &
2858 allow_missing=allow_missing, missing_value=missing_value )
2861 end subroutine file_read_realsp_2d
2862 subroutine file_read_realdp_2d( &
2863 basename, varname, &
2865 step, rankid, single, postfix, &
2866 allow_missing, missing_value )
2869 character(len=*),
intent( in) :: basename
2870 character(len=*),
intent( in) :: varname
2871 real(DP),
intent(out) :: var(:,:)
2872 integer,
intent( in),
optional :: step
2873 integer,
intent( in),
optional :: rankid
2874 logical,
intent( in),
optional :: single
2875 character(len=*),
intent( in),
optional :: postfix
2876 logical,
intent( in),
optional :: allow_missing
2877 real(DP),
intent( in),
optional :: missing_value
2887 rankid=rankid, single=single, &
2890 call file_read_var_realdp_2d( &
2894 allow_missing=allow_missing, missing_value=missing_value )
2897 end subroutine file_read_realdp_2d
2898 subroutine file_read_realsp_3d( &
2899 basename, varname, &
2901 step, rankid, single, postfix, &
2902 allow_missing, missing_value )
2905 character(len=*),
intent( in) :: basename
2906 character(len=*),
intent( in) :: varname
2907 real(SP),
intent(out) :: var(:,:,:)
2908 integer,
intent( in),
optional :: step
2909 integer,
intent( in),
optional :: rankid
2910 logical,
intent( in),
optional :: single
2911 character(len=*),
intent( in),
optional :: postfix
2912 logical,
intent( in),
optional :: allow_missing
2913 real(SP),
intent( in),
optional :: missing_value
2923 rankid=rankid, single=single, &
2926 call file_read_var_realsp_3d( &
2930 allow_missing=allow_missing, missing_value=missing_value )
2933 end subroutine file_read_realsp_3d
2934 subroutine file_read_realdp_3d( &
2935 basename, varname, &
2937 step, rankid, single, postfix, &
2938 allow_missing, missing_value )
2941 character(len=*),
intent( in) :: basename
2942 character(len=*),
intent( in) :: varname
2943 real(DP),
intent(out) :: var(:,:,:)
2944 integer,
intent( in),
optional :: step
2945 integer,
intent( in),
optional :: rankid
2946 logical,
intent( in),
optional :: single
2947 character(len=*),
intent( in),
optional :: postfix
2948 logical,
intent( in),
optional :: allow_missing
2949 real(DP),
intent( in),
optional :: missing_value
2959 rankid=rankid, single=single, &
2962 call file_read_var_realdp_3d( &
2966 allow_missing=allow_missing, missing_value=missing_value )
2969 end subroutine file_read_realdp_3d
2970 subroutine file_read_realsp_4d( &
2971 basename, varname, &
2973 step, rankid, single, postfix, &
2974 allow_missing, missing_value )
2977 character(len=*),
intent( in) :: basename
2978 character(len=*),
intent( in) :: varname
2979 real(SP),
intent(out) :: var(:,:,:,:)
2980 integer,
intent( in),
optional :: step
2981 integer,
intent( in),
optional :: rankid
2982 logical,
intent( in),
optional :: single
2983 character(len=*),
intent( in),
optional :: postfix
2984 logical,
intent( in),
optional :: allow_missing
2985 real(SP),
intent( in),
optional :: missing_value
2995 rankid=rankid, single=single, &
2998 call file_read_var_realsp_4d( &
3002 allow_missing=allow_missing, missing_value=missing_value )
3005 end subroutine file_read_realsp_4d
3006 subroutine file_read_realdp_4d( &
3007 basename, varname, &
3009 step, rankid, single, postfix, &
3010 allow_missing, missing_value )
3013 character(len=*),
intent( in) :: basename
3014 character(len=*),
intent( in) :: varname
3015 real(DP),
intent(out) :: var(:,:,:,:)
3016 integer,
intent( in),
optional :: step
3017 integer,
intent( in),
optional :: rankid
3018 logical,
intent( in),
optional :: single
3019 character(len=*),
intent( in),
optional :: postfix
3020 logical,
intent( in),
optional :: allow_missing
3021 real(DP),
intent( in),
optional :: missing_value
3031 rankid=rankid, single=single, &
3034 call file_read_var_realdp_4d( &
3038 allow_missing=allow_missing, missing_value=missing_value )
3041 end subroutine file_read_realdp_4d
3043 subroutine file_read_var_realsp_1d( &
3053 integer,
intent( in) :: fid
3054 character(len=*),
intent( in) :: varname
3055 real(SP),
intent(out) :: var(:)
3056 integer,
intent( in),
optional :: step
3057 logical,
intent( in),
optional :: allow_missing
3058 real(SP),
intent( in),
optional :: missing_value
3059 integer,
intent( in),
optional :: ntypes
3060 integer,
intent( in),
optional :: dtype
3061 integer,
intent( in),
optional :: start(:)
3062 integer,
intent( in),
optional :: count(:)
3065 logical :: allow_missing_
3066 real(SP) :: missing_value_
3069 integer :: dim_size(1)
3073 intrinsic size, shape
3077 log_error(
"FILE_",*)
'File is not opened. fid = ', fid
3081 if (
present(step) )
then 3087 if (
present(allow_missing) )
then 3088 allow_missing_ = allow_missing
3090 allow_missing_ = .false.
3093 if (
present(missing_value) )
then 3094 missing_value_ = missing_value
3096 missing_value_ = 0.0_sp
3101 file_files(fid)%fid, varname, step_, allow_missing_, &
3106 if ( allow_missing_ )
then 3107 log_info(
"FILE_read_var_realSP_1D",*)
'[INPUT]/[FILE] data not found! : ', &
3108 'varname= ',trim(varname),
', step=',step_
3109 log_info(
"FILE_read_var_realSP_1D",*)
'[INPUT]/[FILE] Value is set to ', missing_value_
3110 var(:) = missing_value_
3113 log_error(
"FILE_read_var_realSP_1D",*)
'failed to get data information :'//trim(varname)
3118 if ( dinfo%rank /= 1 )
then 3119 if ( (.not.
present(start)) .and. (.not.
present(count)) )
then 3120 log_error(
"FILE_read_var_realSP_1D",*)
'rank of '//trim(varname)//
' is not 1', dinfo%rank
3125 if (
present(ntypes) )
then 3127 dinfo,
sp, ntypes, dtype, start(:), count(:), &
3129 else if (
present(start) .and.
present(count) )
then 3131 dinfo,
sp, 0, 0, start(:), count(:), &
3134 dim_size(:) = shape(var)
3136 if ( dinfo%dim_size(n) /= dim_size(n) )
then 3137 log_error(
"FILE_read_var_realSP_1D",*)
'shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
3142 dinfo,
sp, 0, 0, -1, -1, &
3146 log_error(
"FILE_read_var_realSP_1D",*)
'failed to get data value: ', trim(varname)
3151 end subroutine file_read_var_realsp_1d
3152 subroutine file_read_var_realdp_1d( &
3162 integer,
intent( in) :: fid
3163 character(len=*),
intent( in) :: varname
3164 real(DP),
intent(out) :: var(:)
3165 integer,
intent( in),
optional :: step
3166 logical,
intent( in),
optional :: allow_missing
3167 real(DP),
intent( in),
optional :: missing_value
3168 integer,
intent( in),
optional :: ntypes
3169 integer,
intent( in),
optional :: dtype
3170 integer,
intent( in),
optional :: start(:)
3171 integer,
intent( in),
optional :: count(:)
3174 logical :: allow_missing_
3175 real(DP) :: missing_value_
3178 integer :: dim_size(1)
3182 intrinsic size, shape
3186 log_error(
"FILE_",*)
'File is not opened. fid = ', fid
3190 if (
present(step) )
then 3196 if (
present(allow_missing) )
then 3197 allow_missing_ = allow_missing
3199 allow_missing_ = .false.
3202 if (
present(missing_value) )
then 3203 missing_value_ = missing_value
3205 missing_value_ = 0.0_dp
3210 file_files(fid)%fid, varname, step_, allow_missing_, &
3215 if ( allow_missing_ )
then 3216 log_info(
"FILE_read_var_realDP_1D",*)
'[INPUT]/[FILE] data not found! : ', &
3217 'varname= ',trim(varname),
', step=',step_
3218 log_info(
"FILE_read_var_realDP_1D",*)
'[INPUT]/[FILE] Value is set to ', missing_value_
3219 var(:) = missing_value_
3222 log_error(
"FILE_read_var_realDP_1D",*)
'failed to get data information :'//trim(varname)
3227 if ( dinfo%rank /= 1 )
then 3228 if ( (.not.
present(start)) .and. (.not.
present(count)) )
then 3229 log_error(
"FILE_read_var_realDP_1D",*)
'rank of '//trim(varname)//
' is not 1', dinfo%rank
3234 if (
present(ntypes) )
then 3236 dinfo,
dp, ntypes, dtype, start(:), count(:), &
3238 else if (
present(start) .and.
present(count) )
then 3240 dinfo,
dp, 0, 0, start(:), count(:), &
3243 dim_size(:) = shape(var)
3245 if ( dinfo%dim_size(n) /= dim_size(n) )
then 3246 log_error(
"FILE_read_var_realDP_1D",*)
'shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
3251 dinfo,
dp, 0, 0, -1, -1, &
3255 log_error(
"FILE_read_var_realDP_1D",*)
'failed to get data value: ', trim(varname)
3260 end subroutine file_read_var_realdp_1d
3261 subroutine file_read_var_realsp_2d( &
3271 integer,
intent( in) :: fid
3272 character(len=*),
intent( in) :: varname
3273 real(SP),
intent(out) :: var(:,:)
3274 integer,
intent( in),
optional :: step
3275 logical,
intent( in),
optional :: allow_missing
3276 real(SP),
intent( in),
optional :: missing_value
3277 integer,
intent( in),
optional :: ntypes
3278 integer,
intent( in),
optional :: dtype
3279 integer,
intent( in),
optional :: start(:)
3280 integer,
intent( in),
optional :: count(:)
3283 logical :: allow_missing_
3284 real(SP) :: missing_value_
3287 integer :: dim_size(2)
3291 intrinsic size, shape
3295 log_error(
"FILE_",*)
'File is not opened. fid = ', fid
3299 if (
present(step) )
then 3305 if (
present(allow_missing) )
then 3306 allow_missing_ = allow_missing
3308 allow_missing_ = .false.
3311 if (
present(missing_value) )
then 3312 missing_value_ = missing_value
3314 missing_value_ = 0.0_sp
3319 file_files(fid)%fid, varname, step_, allow_missing_, &
3324 if ( allow_missing_ )
then 3325 log_info(
"FILE_read_var_realSP_2D",*)
'[INPUT]/[FILE] data not found! : ', &
3326 'varname= ',trim(varname),
', step=',step_
3327 log_info(
"FILE_read_var_realSP_2D",*)
'[INPUT]/[FILE] Value is set to ', missing_value_
3328 var(:,:) = missing_value_
3331 log_error(
"FILE_read_var_realSP_2D",*)
'failed to get data information :'//trim(varname)
3336 if ( dinfo%rank /= 2 )
then 3337 if ( (.not.
present(start)) .and. (.not.
present(count)) )
then 3338 log_error(
"FILE_read_var_realSP_2D",*)
'rank of '//trim(varname)//
' is not 2', dinfo%rank
3343 if (
present(ntypes) )
then 3345 dinfo,
sp, ntypes, dtype, start(:), count(:), &
3347 else if (
present(start) .and.
present(count) )
then 3349 dinfo,
sp, 0, 0, start(:), count(:), &
3352 dim_size(:) = shape(var)
3354 if ( dinfo%dim_size(n) /= dim_size(n) )
then 3355 log_error(
"FILE_read_var_realSP_2D",*)
'shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
3360 dinfo,
sp, 0, 0, -1, -1, &
3364 log_error(
"FILE_read_var_realSP_2D",*)
'failed to get data value: ', trim(varname)
3369 end subroutine file_read_var_realsp_2d
3370 subroutine file_read_var_realdp_2d( &
3380 integer,
intent( in) :: fid
3381 character(len=*),
intent( in) :: varname
3382 real(DP),
intent(out) :: var(:,:)
3383 integer,
intent( in),
optional :: step
3384 logical,
intent( in),
optional :: allow_missing
3385 real(DP),
intent( in),
optional :: missing_value
3386 integer,
intent( in),
optional :: ntypes
3387 integer,
intent( in),
optional :: dtype
3388 integer,
intent( in),
optional :: start(:)
3389 integer,
intent( in),
optional :: count(:)
3392 logical :: allow_missing_
3393 real(DP) :: missing_value_
3396 integer :: dim_size(2)
3400 intrinsic size, shape
3404 log_error(
"FILE_",*)
'File is not opened. fid = ', fid
3408 if (
present(step) )
then 3414 if (
present(allow_missing) )
then 3415 allow_missing_ = allow_missing
3417 allow_missing_ = .false.
3420 if (
present(missing_value) )
then 3421 missing_value_ = missing_value
3423 missing_value_ = 0.0_dp
3428 file_files(fid)%fid, varname, step_, allow_missing_, &
3433 if ( allow_missing_ )
then 3434 log_info(
"FILE_read_var_realDP_2D",*)
'[INPUT]/[FILE] data not found! : ', &
3435 'varname= ',trim(varname),
', step=',step_
3436 log_info(
"FILE_read_var_realDP_2D",*)
'[INPUT]/[FILE] Value is set to ', missing_value_
3437 var(:,:) = missing_value_
3440 log_error(
"FILE_read_var_realDP_2D",*)
'failed to get data information :'//trim(varname)
3445 if ( dinfo%rank /= 2 )
then 3446 if ( (.not.
present(start)) .and. (.not.
present(count)) )
then 3447 log_error(
"FILE_read_var_realDP_2D",*)
'rank of '//trim(varname)//
' is not 2', dinfo%rank
3452 if (
present(ntypes) )
then 3454 dinfo,
dp, ntypes, dtype, start(:), count(:), &
3456 else if (
present(start) .and.
present(count) )
then 3458 dinfo,
dp, 0, 0, start(:), count(:), &
3461 dim_size(:) = shape(var)
3463 if ( dinfo%dim_size(n) /= dim_size(n) )
then 3464 log_error(
"FILE_read_var_realDP_2D",*)
'shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
3469 dinfo,
dp, 0, 0, -1, -1, &
3473 log_error(
"FILE_read_var_realDP_2D",*)
'failed to get data value: ', trim(varname)
3478 end subroutine file_read_var_realdp_2d
3479 subroutine file_read_var_realsp_3d( &
3489 integer,
intent( in) :: fid
3490 character(len=*),
intent( in) :: varname
3491 real(SP),
intent(out) :: var(:,:,:)
3492 integer,
intent( in),
optional :: step
3493 logical,
intent( in),
optional :: allow_missing
3494 real(SP),
intent( in),
optional :: missing_value
3495 integer,
intent( in),
optional :: ntypes
3496 integer,
intent( in),
optional :: dtype
3497 integer,
intent( in),
optional :: start(:)
3498 integer,
intent( in),
optional :: count(:)
3501 logical :: allow_missing_
3502 real(SP) :: missing_value_
3505 integer :: dim_size(3)
3509 intrinsic size, shape
3513 log_error(
"FILE_",*)
'File is not opened. fid = ', fid
3517 if (
present(step) )
then 3523 if (
present(allow_missing) )
then 3524 allow_missing_ = allow_missing
3526 allow_missing_ = .false.
3529 if (
present(missing_value) )
then 3530 missing_value_ = missing_value
3532 missing_value_ = 0.0_sp
3537 file_files(fid)%fid, varname, step_, allow_missing_, &
3542 if ( allow_missing_ )
then 3543 log_info(
"FILE_read_var_realSP_3D",*)
'[INPUT]/[FILE] data not found! : ', &
3544 'varname= ',trim(varname),
', step=',step_
3545 log_info(
"FILE_read_var_realSP_3D",*)
'[INPUT]/[FILE] Value is set to ', missing_value_
3546 var(:,:,:) = missing_value_
3549 log_error(
"FILE_read_var_realSP_3D",*)
'failed to get data information :'//trim(varname)
3554 if ( dinfo%rank /= 3 )
then 3555 if ( (.not.
present(start)) .and. (.not.
present(count)) )
then 3556 log_error(
"FILE_read_var_realSP_3D",*)
'rank of '//trim(varname)//
' is not 3', dinfo%rank
3561 if (
present(ntypes) )
then 3563 dinfo,
sp, ntypes, dtype, start(:), count(:), &
3565 else if (
present(start) .and.
present(count) )
then 3567 dinfo,
sp, 0, 0, start(:), count(:), &
3570 dim_size(:) = shape(var)
3572 if ( dinfo%dim_size(n) /= dim_size(n) )
then 3573 log_error(
"FILE_read_var_realSP_3D",*)
'shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
3578 dinfo,
sp, 0, 0, -1, -1, &
3582 log_error(
"FILE_read_var_realSP_3D",*)
'failed to get data value: ', trim(varname)
3587 end subroutine file_read_var_realsp_3d
3588 subroutine file_read_var_realdp_3d( &
3598 integer,
intent( in) :: fid
3599 character(len=*),
intent( in) :: varname
3600 real(DP),
intent(out) :: var(:,:,:)
3601 integer,
intent( in),
optional :: step
3602 logical,
intent( in),
optional :: allow_missing
3603 real(DP),
intent( in),
optional :: missing_value
3604 integer,
intent( in),
optional :: ntypes
3605 integer,
intent( in),
optional :: dtype
3606 integer,
intent( in),
optional :: start(:)
3607 integer,
intent( in),
optional :: count(:)
3610 logical :: allow_missing_
3611 real(DP) :: missing_value_
3614 integer :: dim_size(3)
3618 intrinsic size, shape
3622 log_error(
"FILE_",*)
'File is not opened. fid = ', fid
3626 if (
present(step) )
then 3632 if (
present(allow_missing) )
then 3633 allow_missing_ = allow_missing
3635 allow_missing_ = .false.
3638 if (
present(missing_value) )
then 3639 missing_value_ = missing_value
3641 missing_value_ = 0.0_dp
3646 file_files(fid)%fid, varname, step_, allow_missing_, &
3651 if ( allow_missing_ )
then 3652 log_info(
"FILE_read_var_realDP_3D",*)
'[INPUT]/[FILE] data not found! : ', &
3653 'varname= ',trim(varname),
', step=',step_
3654 log_info(
"FILE_read_var_realDP_3D",*)
'[INPUT]/[FILE] Value is set to ', missing_value_
3655 var(:,:,:) = missing_value_
3658 log_error(
"FILE_read_var_realDP_3D",*)
'failed to get data information :'//trim(varname)
3663 if ( dinfo%rank /= 3 )
then 3664 if ( (.not.
present(start)) .and. (.not.
present(count)) )
then 3665 log_error(
"FILE_read_var_realDP_3D",*)
'rank of '//trim(varname)//
' is not 3', dinfo%rank
3670 if (
present(ntypes) )
then 3672 dinfo,
dp, ntypes, dtype, start(:), count(:), &
3674 else if (
present(start) .and.
present(count) )
then 3676 dinfo,
dp, 0, 0, start(:), count(:), &
3679 dim_size(:) = shape(var)
3681 if ( dinfo%dim_size(n) /= dim_size(n) )
then 3682 log_error(
"FILE_read_var_realDP_3D",*)
'shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
3687 dinfo,
dp, 0, 0, -1, -1, &
3691 log_error(
"FILE_read_var_realDP_3D",*)
'failed to get data value: ', trim(varname)
3696 end subroutine file_read_var_realdp_3d
3697 subroutine file_read_var_realsp_4d( &
3707 integer,
intent( in) :: fid
3708 character(len=*),
intent( in) :: varname
3709 real(SP),
intent(out) :: var(:,:,:,:)
3710 integer,
intent( in),
optional :: step
3711 logical,
intent( in),
optional :: allow_missing
3712 real(SP),
intent( in),
optional :: missing_value
3713 integer,
intent( in),
optional :: ntypes
3714 integer,
intent( in),
optional :: dtype
3715 integer,
intent( in),
optional :: start(:)
3716 integer,
intent( in),
optional :: count(:)
3719 logical :: allow_missing_
3720 real(SP) :: missing_value_
3723 integer :: dim_size(4)
3727 intrinsic size, shape
3731 log_error(
"FILE_",*)
'File is not opened. fid = ', fid
3735 if (
present(step) )
then 3741 if (
present(allow_missing) )
then 3742 allow_missing_ = allow_missing
3744 allow_missing_ = .false.
3747 if (
present(missing_value) )
then 3748 missing_value_ = missing_value
3750 missing_value_ = 0.0_sp
3755 file_files(fid)%fid, varname, step_, allow_missing_, &
3760 if ( allow_missing_ )
then 3761 log_info(
"FILE_read_var_realSP_4D",*)
'[INPUT]/[FILE] data not found! : ', &
3762 'varname= ',trim(varname),
', step=',step_
3763 log_info(
"FILE_read_var_realSP_4D",*)
'[INPUT]/[FILE] Value is set to ', missing_value_
3764 var(:,:,:,:) = missing_value_
3767 log_error(
"FILE_read_var_realSP_4D",*)
'failed to get data information :'//trim(varname)
3772 if ( dinfo%rank /= 4 )
then 3773 if ( (.not.
present(start)) .and. (.not.
present(count)) )
then 3774 log_error(
"FILE_read_var_realSP_4D",*)
'rank of '//trim(varname)//
' is not 4', dinfo%rank
3779 if (
present(ntypes) )
then 3781 dinfo,
sp, ntypes, dtype, start(:), count(:), &
3783 else if (
present(start) .and.
present(count) )
then 3785 dinfo,
sp, 0, 0, start(:), count(:), &
3788 dim_size(:) = shape(var)
3790 if ( dinfo%dim_size(n) /= dim_size(n) )
then 3791 log_error(
"FILE_read_var_realSP_4D",*)
'shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
3796 dinfo,
sp, 0, 0, -1, -1, &
3800 log_error(
"FILE_read_var_realSP_4D",*)
'failed to get data value: ', trim(varname)
3805 end subroutine file_read_var_realsp_4d
3806 subroutine file_read_var_realdp_4d( &
3816 integer,
intent( in) :: fid
3817 character(len=*),
intent( in) :: varname
3818 real(DP),
intent(out) :: var(:,:,:,:)
3819 integer,
intent( in),
optional :: step
3820 logical,
intent( in),
optional :: allow_missing
3821 real(DP),
intent( in),
optional :: missing_value
3822 integer,
intent( in),
optional :: ntypes
3823 integer,
intent( in),
optional :: dtype
3824 integer,
intent( in),
optional :: start(:)
3825 integer,
intent( in),
optional :: count(:)
3828 logical :: allow_missing_
3829 real(DP) :: missing_value_
3832 integer :: dim_size(4)
3836 intrinsic size, shape
3840 log_error(
"FILE_",*)
'File is not opened. fid = ', fid
3844 if (
present(step) )
then 3850 if (
present(allow_missing) )
then 3851 allow_missing_ = allow_missing
3853 allow_missing_ = .false.
3856 if (
present(missing_value) )
then 3857 missing_value_ = missing_value
3859 missing_value_ = 0.0_dp
3864 file_files(fid)%fid, varname, step_, allow_missing_, &
3869 if ( allow_missing_ )
then 3870 log_info(
"FILE_read_var_realDP_4D",*)
'[INPUT]/[FILE] data not found! : ', &
3871 'varname= ',trim(varname),
', step=',step_
3872 log_info(
"FILE_read_var_realDP_4D",*)
'[INPUT]/[FILE] Value is set to ', missing_value_
3873 var(:,:,:,:) = missing_value_
3876 log_error(
"FILE_read_var_realDP_4D",*)
'failed to get data information :'//trim(varname)
3881 if ( dinfo%rank /= 4 )
then 3882 if ( (.not.
present(start)) .and. (.not.
present(count)) )
then 3883 log_error(
"FILE_read_var_realDP_4D",*)
'rank of '//trim(varname)//
' is not 4', dinfo%rank
3888 if (
present(ntypes) )
then 3890 dinfo,
dp, ntypes, dtype, start(:), count(:), &
3892 else if (
present(start) .and.
present(count) )
then 3894 dinfo,
dp, 0, 0, start(:), count(:), &
3897 dim_size(:) = shape(var)
3899 if ( dinfo%dim_size(n) /= dim_size(n) )
then 3900 log_error(
"FILE_read_var_realDP_4D",*)
'shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
3905 dinfo,
dp, 0, 0, -1, -1, &
3909 log_error(
"FILE_read_var_realDP_4D",*)
'failed to get data value: ', trim(varname)
3914 end subroutine file_read_var_realdp_4d
3919 subroutine file_write_realsp_1d( &
3927 integer,
intent(in) :: vid
3928 real(SP),
intent(in) :: var(:)
3929 real(DP),
intent(in) :: t_start
3930 real(DP),
intent(in) :: t_end
3931 integer,
intent(in),
optional :: ndims
3932 integer,
intent(in),
optional :: count(:)
3933 integer,
intent(in),
optional :: start(:)
3936 integer :: start_(1)
3947 fid = file_vars(vid)%fid
3950 log_error(
"FILE_write_realSP_1D",*)
'File is not opened. fid = ', fid
3954 if (
present(ndims) )
then 3958 if ( .not.
present(start) )
then 3959 log_error(
"FILE_write_realSP_1D",*)
'start argument is neccessary when ndims is specified' 3962 if ( .not.
present(count) )
then 3963 log_error(
"FILE_write_realSP_1D",*)
'count argument is neccessary when ndims is specified' 3968 var(:), ts, te,
sp, &
3969 ndims, start, count, &
3973 if (
present(start) )
then 3974 start_(:) = start(:)
3979 var(:), ts, te,
sp, &
3980 1, start_, shape(var), &
3984 do n = 1, file_nvars
3985 if ( file_vars(n)%vid == vid )
then 3986 log_error(
"FILE_write_realSP_1D",*)
'failed to write data: ', trim(file_vars(n)%name)
3994 end subroutine file_write_realsp_1d
3995 subroutine file_write_realdp_1d( &
4003 integer,
intent(in) :: vid
4004 real(DP),
intent(in) :: var(:)
4005 real(DP),
intent(in) :: t_start
4006 real(DP),
intent(in) :: t_end
4007 integer,
intent(in),
optional :: ndims
4008 integer,
intent(in),
optional :: count(:)
4009 integer,
intent(in),
optional :: start(:)
4012 integer :: start_(1)
4023 fid = file_vars(vid)%fid
4026 log_error(
"FILE_write_realDP_1D",*)
'File is not opened. fid = ', fid
4030 if (
present(ndims) )
then 4034 if ( .not.
present(start) )
then 4035 log_error(
"FILE_write_realDP_1D",*)
'start argument is neccessary when ndims is specified' 4038 if ( .not.
present(count) )
then 4039 log_error(
"FILE_write_realDP_1D",*)
'count argument is neccessary when ndims is specified' 4044 var(:), ts, te,
dp, &
4045 ndims, start, count, &
4049 if (
present(start) )
then 4050 start_(:) = start(:)
4055 var(:), ts, te,
dp, &
4056 1, start_, shape(var), &
4060 do n = 1, file_nvars
4061 if ( file_vars(n)%vid == vid )
then 4062 log_error(
"FILE_write_realDP_1D",*)
'failed to write data: ', trim(file_vars(n)%name)
4070 end subroutine file_write_realdp_1d
4071 subroutine file_write_realsp_2d( &
4077 integer,
intent(in) :: vid
4078 real(SP),
intent(in) :: var(:,:)
4079 real(DP),
intent(in) :: t_start
4080 real(DP),
intent(in) :: t_end
4081 integer,
intent(in),
optional :: start(:)
4084 integer :: start_(2)
4095 fid = file_vars(vid)%fid
4098 log_error(
"FILE_write_realSP_2D",*)
'File is not opened. fid = ', fid
4103 if (
present(start) )
then 4104 start_(:) = start(:)
4109 var(:,:), ts, te,
sp, &
4110 2, start_, shape(var), &
4113 do n = 1, file_nvars
4114 if ( file_vars(n)%vid == vid )
then 4115 log_error(
"FILE_write_realSP_2D",*)
'failed to write data: ', trim(file_vars(n)%name)
4123 end subroutine file_write_realsp_2d
4124 subroutine file_write_realdp_2d( &
4130 integer,
intent(in) :: vid
4131 real(DP),
intent(in) :: var(:,:)
4132 real(DP),
intent(in) :: t_start
4133 real(DP),
intent(in) :: t_end
4134 integer,
intent(in),
optional :: start(:)
4137 integer :: start_(2)
4148 fid = file_vars(vid)%fid
4151 log_error(
"FILE_write_realDP_2D",*)
'File is not opened. fid = ', fid
4156 if (
present(start) )
then 4157 start_(:) = start(:)
4162 var(:,:), ts, te,
dp, &
4163 2, start_, shape(var), &
4166 do n = 1, file_nvars
4167 if ( file_vars(n)%vid == vid )
then 4168 log_error(
"FILE_write_realDP_2D",*)
'failed to write data: ', trim(file_vars(n)%name)
4176 end subroutine file_write_realdp_2d
4177 subroutine file_write_realsp_3d( &
4183 integer,
intent(in) :: vid
4184 real(SP),
intent(in) :: var(:,:,:)
4185 real(DP),
intent(in) :: t_start
4186 real(DP),
intent(in) :: t_end
4187 integer,
intent(in),
optional :: start(:)
4190 integer :: start_(3)
4201 fid = file_vars(vid)%fid
4204 log_error(
"FILE_write_realSP_3D",*)
'File is not opened. fid = ', fid
4209 if (
present(start) )
then 4210 start_(:) = start(:)
4215 var(:,:,:), ts, te,
sp, &
4216 3, start_, shape(var), &
4219 do n = 1, file_nvars
4220 if ( file_vars(n)%vid == vid )
then 4221 log_error(
"FILE_write_realSP_3D",*)
'failed to write data: ', trim(file_vars(n)%name)
4229 end subroutine file_write_realsp_3d
4230 subroutine file_write_realdp_3d( &
4236 integer,
intent(in) :: vid
4237 real(DP),
intent(in) :: var(:,:,:)
4238 real(DP),
intent(in) :: t_start
4239 real(DP),
intent(in) :: t_end
4240 integer,
intent(in),
optional :: start(:)
4243 integer :: start_(3)
4254 fid = file_vars(vid)%fid
4257 log_error(
"FILE_write_realDP_3D",*)
'File is not opened. fid = ', fid
4262 if (
present(start) )
then 4263 start_(:) = start(:)
4268 var(:,:,:), ts, te,
dp, &
4269 3, start_, shape(var), &
4272 do n = 1, file_nvars
4273 if ( file_vars(n)%vid == vid )
then 4274 log_error(
"FILE_write_realDP_3D",*)
'failed to write data: ', trim(file_vars(n)%name)
4282 end subroutine file_write_realdp_3d
4283 subroutine file_write_realsp_4d( &
4289 integer,
intent(in) :: vid
4290 real(SP),
intent(in) :: var(:,:,:,:)
4291 real(DP),
intent(in) :: t_start
4292 real(DP),
intent(in) :: t_end
4293 integer,
intent(in),
optional :: start(:)
4296 integer :: start_(4)
4307 fid = file_vars(vid)%fid
4310 log_error(
"FILE_write_realSP_4D",*)
'File is not opened. fid = ', fid
4315 if (
present(start) )
then 4316 start_(:) = start(:)
4321 var(:,:,:,:), ts, te,
sp, &
4322 4, start_, shape(var), &
4325 do n = 1, file_nvars
4326 if ( file_vars(n)%vid == vid )
then 4327 log_error(
"FILE_write_realSP_4D",*)
'failed to write data: ', trim(file_vars(n)%name)
4335 end subroutine file_write_realsp_4d
4336 subroutine file_write_realdp_4d( &
4342 integer,
intent(in) :: vid
4343 real(DP),
intent(in) :: var(:,:,:,:)
4344 real(DP),
intent(in) :: t_start
4345 real(DP),
intent(in) :: t_end
4346 integer,
intent(in),
optional :: start(:)
4349 integer :: start_(4)
4360 fid = file_vars(vid)%fid
4363 log_error(
"FILE_write_realDP_4D",*)
'File is not opened. fid = ', fid
4368 if (
present(start) )
then 4369 start_(:) = start(:)
4374 var(:,:,:,:), ts, te,
dp, &
4375 4, start_, shape(var), &
4378 do n = 1, file_nvars
4379 if ( file_vars(n)%vid == vid )
then 4380 log_error(
"FILE_write_realDP_4D",*)
'failed to write data: ', trim(file_vars(n)%name)
4388 end subroutine file_write_realdp_4d
4395 integer,
intent(in) :: fid
4407 log_info(
"FILE_enddef",
'(1x,A,I3.3,2A)') &
4408 'End define mode : No.', fid,
', name = ', trim(file_files(fid)%name)
4411 log_error(
"FILE_enddef",*)
'failed to exit define mode' 4425 integer,
intent(in) :: fid
4426 integer(8),
intent(in) :: buf_amount
4438 log_info(
"FILE_attach_buffer",
'(1x,A,I3.3,3A,I10)') &
4439 'Attach buffer : No.', fid,
', name = ', trim(file_files(fid)%name), &
4440 ', size = ', buf_amount
4442 log_error(
"FILE_attach_buffer",*)
'failed to attach buffer in PnetCDF' 4454 integer,
intent(in) :: fid
4461 if ( file_files(fid)%fid < 0 )
return 4468 log_info(
"FILE_detach_buffer",
'(1x,A,I3.3,2A)') &
4469 'Detach buffer : No.', fid,
', name = ', trim(file_files(fid)%name)
4472 log_error(
"FILE_detach_buffer",*)
'failed to detach buffer in PnetCDF' 4484 integer,
intent(in) :: fid
4491 if ( file_files(fid)%fid < 0 )
return 4502 log_error(
"FILE_flush",*)
'failed to flush PnetCDF pending requests' 4512 integer,
intent(in) :: fid
4513 logical,
intent(in),
optional :: skip_abort
4515 logical :: skip_abort_
4522 if ( file_files(fid)%fid < 0 )
return 4524 if (
present(skip_abort) )
then 4525 skip_abort_ = skip_abort
4527 skip_abort_ = .false.
4535 log_info(
"FILE_close",
'(1x,A,I3.3,2A)') &
4536 'Close : No.', fid,
', name = ', trim(file_files(fid)%name)
4539 log_error(
"FILE_close",*)
'failed to close file' 4543 file_files(fid)%fid = -1
4544 file_files(fid)%name =
'' 4545 file_files(fid)%aggregate = .false.
4547 do n = 1, file_nvars
4548 if ( file_vars(n)%fid == fid )
then 4549 file_vars(n)%vid = -1
4550 file_vars(n)%name =
'' 4560 logical,
intent(in),
optional :: skip_abort
4565 do fid = 1, file_nfiles
4578 character(len=*),
intent( in) :: basename
4579 character(len=*),
intent( in) :: prefix
4580 integer,
intent( in) :: rankid
4581 integer,
intent( in) :: len
4582 character(len=*),
intent(out) :: fname
4585 character(len=17) :: fmt =
"(A, '.', A, I*.*)" 4588 if ( len < 1 .or. len > 9 )
then 4589 log_error(
"FILE_make_fname",*)
'len is invalid' 4593 write(fmt(14:14),
'(I1)') len
4594 write(fmt(16:16),
'(I1)') len
4595 write(fname, fmt) trim(basename), trim(prefix), rankid
4606 integer,
intent(in) :: date(6)
4607 character(len=*),
intent(out) :: tunits
4610 write(tunits,
'(a,i4.4,"-",i2.2,"-",i2.2," ",i2.2,":",i2.2,":",i2.2)')
'seconds since ', date
4616 integer,
intent(in) :: fid
4617 logical :: FILE_get_aggregate
4620 file_get_aggregate = .false.
4622 file_get_aggregate = file_files(fid)%aggregate
4633 subroutine file_get_fid( &
4647 character(len=*),
intent( in) :: basename
4648 integer,
intent( in) :: mode
4649 integer,
intent( in) :: rankid
4650 logical,
intent( in) :: single
4652 integer,
intent(out) :: fid
4653 logical,
intent(out) :: existed
4655 logical,
intent( in),
optional :: aggregate
4656 character(len=*),
intent( in),
optional :: postfix
4658 character(len=FILE_HSHORT) :: rwname(0:2)
4659 data rwname /
'READ',
'WRITE',
'APPEND' /
4661 character(len=FILE_HLONG) :: fname
4664 logical :: aggregate_
4673 if (
present(aggregate) )
then 4674 aggregate_ = aggregate
4679 if ( aggregate_ )
then 4685 if (
present(postfix) )
then 4686 fname = trim(basename)//trim(postfix)
4687 elseif ( aggregate_ )
then 4689 elseif ( single )
then 4690 fname = trim(basename)//
'.peall' 4697 do n = 1, file_nfiles
4698 if ( fname == file_files(n)%name )
then 4710 fname, mode, mpi_comm, &
4714 log_error(
"FILE_get_fid",*)
'failed to open file :'//trim(fname)//
'.nc' 4718 file_nfiles = file_nfiles + 1
4721 file_files(fid)%name = fname
4722 file_files(fid)%fid = cfid
4723 file_files(fid)%aggregate = aggregate_
4726 log_info(
"FILE_get_fid",
'(1x,A,A6,A,I3.3,2A)') &
4727 'Registration (', trim(rwname(mode)),
') : No.', fid,
', name = ', trim(fname)
4732 end subroutine file_get_fid
subroutine, public file_close_all(skip_abort)
subroutine, public file_get_stepsize(fid, varname, len, error)
get number of steps
int32_t file_get_attribute_int_c(const int32_t fid, const char *vname, const char *key, const int32_t suppress, int32_t *value, const size_t len)
subroutine, public file_close(fid, skip_abort)
int32_t file_get_attribute_double_c(const int32_t fid, const char *vname, const char *key, const int32_t suppress, double *value, const size_t len)
integer, parameter, public file_success_code
subroutine, public prc_set_file_closer(routine)
int32_t file_set_attribute_int_c(const int32_t fid, const char *vname, const char *key, const int32_t *value, const size_t len)
integer, parameter, public file_fappend
int32_t file_write_axis_c(const int32_t fid, const char *name, const void *val, const int32_t precision, const MPI_Offset *start, const MPI_Offset *count)
logical, public file_aggregate
int32_t file_detach_buffer_c(const int32_t fid)
subroutine, public file_def_axis(fid, name, desc, units, dim_name, dtype, dim_size, bounds)
integer, parameter, public prc_comm_null
int32_t file_set_attribute_double_c(const int32_t fid, const char *vname, const char *key, const double *value, const size_t len)
subroutine, public file_set_option(fid, filetype, key, val)
int32_t file_put_axis_c(const int32_t fid, const char *name, const char *desc, const char *units, const char *dim_name, const int32_t dtype, const void *val, const int32_t size, const int32_t precision)
int32_t file_get_nvars_c(const int32_t fid, int32_t *nvars)
integer, public io_fid_conf
Config file ID.
int32_t file_get_step_size_c(const int32_t fid, const char *varname, int32_t *len)
subroutine, public file_detach_buffer(fid)
int32_t file_get_attribute_text_c(const int32_t fid, const char *vname, const char *key, const int32_t suppress, char *value, const int32_t len)
subroutine, public file_open(basename, fid, mode, single, aggregate, rankid, postfix)
subroutine, public file_attach_buffer(fid, buf_amount)
subroutine, public file_flush(fid)
int32_t file_write_associatedcoordinate_c(const int32_t fid, const char *name, const void *val, const int32_t precision, const MPI_Offset *start, const MPI_Offset *count)
int32_t file_put_associatedcoordinate_c(const int32_t fid, const char *name, const char *desc, const char *units, const char **dim_names, const int32_t ndims, const int32_t dtype, const void *val, const int32_t precision)
int32_t file_open_c(int32_t *fid, const char *fname, const int32_t mode, const MPI_Comm comm)
integer, parameter, public file_file_max
integer, parameter, public file_fread
int32_t file_set_tunits_c(const int32_t fid, const char *time_units, const char *calendar)
int32_t file_set_option_c(const int32_t fid, const char *filetype, const char *key, const char *val)
int32_t file_get_datainfo_c(datainfo_t *dinfo, const int32_t fid, const char *varname, const int32_t step, const int32_t suppress)
int32_t file_get_varname_c(const int32_t fid, const int32_t vid, char *name, const int32_t len)
int32_t file_close_c(const int32_t fid)
int32_t file_add_variable_c(const int32_t fid, const char *varname, const char *desc, const char *units, const char *stdname, const char **dims, const int32_t ndims, const int32_t dtype, const real64_t tint, const int32_t tavg, int32_t *vid)
subroutine, public file_def_variable(fid, varname, desc, units, standard_name, ndims, dims, dtype, vid, time_int, time_avg, existed)
integer, parameter, public file_already_closed_code
logical function, public file_opened(fid)
check if the file is opened?
subroutine, public file_setup(myrank)
setup
int32_t file_write_data_c(const int32_t fid, const int32_t vid, const void *var, const real64_t t_start, const real64_t t_end, const int32_t precision, const int32_t ndims, const int32_t *start, const int32_t *count)
subroutine, public prc_abort
Abort Process.
int32_t file_flush_c(const int32_t fid)
int32_t file_set_attribute_text_c(const int32_t fid, const char *vname, const char *key, const char *value)
integer, parameter, public file_var_max
real(dp), parameter, public file_rmiss
subroutine, public file_create(basename, title, source, institution, fid, existed, rankid, single, aggregate, time_units, calendar, append)
create file fid is >= 1
integer, parameter, public file_already_existed_code
logical function, public file_get_aggregate(fid)
int32_t file_def_associatedcoordinate_c(const int32_t fid, const char *name, const char *desc, const char *units, const char **dim_names, const int32_t ndims, const int32_t dtype)
int32_t file_read_data_c(void *var, const datainfo_t *dinfo, const int32_t precision, const MPI_Offset ntypes, const MPI_Datatype dtype, const int32_t *start, const int32_t *count)
subroutine, public file_def_associatedcoordinate(fid, name, desc, units, dim_names, dtype)
subroutine, public file_make_fname(basename, prefix, rankid, len, fname)
int32_t file_enddef_c(const int32_t fid)
int32_t file_def_axis_c(const int32_t fid, const char *name, const char *desc, const char *units, const char *dim_name, const int32_t dtype, const int32_t dim_size, const int32_t bounds)
int32_t file_set_attribute_float_c(const int32_t fid, const char *vname, const char *key, const float *value, const size_t len)
integer, public prc_local_comm_world
local communicator
int32_t file_get_attribute_float_c(const int32_t fid, const char *vname, const char *key, const int32_t suppress, float *value, const size_t len)
integer, parameter, public sp
subroutine, public file_add_associatedvariable(fid, vname, existed)
integer, parameter, public file_fwrite
int32_t file_attach_buffer_c(const int32_t fid, const int64_t buf_amount)
integer, parameter, public dp
int32_t file_get_dim_length_c(const int32_t fid, const char *dimname, int32_t *len)
subroutine, public file_enddef(fid)
int32_t file_add_associatedvariable_c(const int32_t fid, const char *vname)
subroutine, public file_get_dimlength(fid, dimname, len, error)
get length of dimension
subroutine, public file_get_cftunits(date, tunits)
get unit of time