41 public :: filewriteaxis
43 public :: fileputassociatedcoordinates
44 public :: filewriteassociatedcoordinates
45 public :: fileaddvariable
53 public :: filewritevar
54 public :: filegetglobalattribute
55 public :: filesetglobalattribute
62 module procedure fileputaxisrealsp
63 module procedure fileputaxisrealdp
64 end interface fileputaxis
65 interface filewriteaxis
66 module procedure filewriteaxisrealsp
67 module procedure filewriteaxisrealdp
68 end interface filewriteaxis
69 interface fileputassociatedcoordinates
70 module procedure fileput1dassociatedcoordinatesrealsp
71 module procedure fileput1dassociatedcoordinatesrealdp
72 module procedure fileput2dassociatedcoordinatesrealsp
73 module procedure fileput2dassociatedcoordinatesrealdp
74 module procedure fileput3dassociatedcoordinatesrealsp
75 module procedure fileput3dassociatedcoordinatesrealdp
76 module procedure fileput4dassociatedcoordinatesrealsp
77 module procedure fileput4dassociatedcoordinatesrealdp
78 end interface fileputassociatedcoordinates
79 interface filewriteassociatedcoordinates
80 module procedure filewrite1dassociatedcoordinatesrealsp
81 module procedure filewrite1dassociatedcoordinatesrealdp
82 module procedure filewrite2dassociatedcoordinatesrealsp
83 module procedure filewrite2dassociatedcoordinatesrealdp
84 module procedure filewrite3dassociatedcoordinatesrealsp
85 module procedure filewrite3dassociatedcoordinatesrealdp
86 module procedure filewrite4dassociatedcoordinatesrealsp
87 module procedure filewrite4dassociatedcoordinatesrealdp
88 end interface filewriteassociatedcoordinates
89 interface fileaddvariable
90 module procedure fileaddvariablenot
91 module procedure fileaddvariablerealsp
92 module procedure fileaddvariablerealdp
93 end interface fileaddvariable
95 module procedure fileread1drealsp
96 module procedure fileread1drealdp
97 module procedure fileread2drealsp
98 module procedure fileread2drealdp
99 module procedure fileread3drealsp
100 module procedure fileread3drealdp
101 module procedure fileread4drealsp
102 module procedure fileread4drealdp
103 end interface fileread
105 module procedure filewrite1drealsp
106 module procedure filewrite1drealdp
107 module procedure filewrite2drealsp
108 module procedure filewrite2drealdp
109 module procedure filewrite3drealsp
110 module procedure filewrite3drealdp
111 module procedure filewrite4drealsp
112 module procedure filewrite4drealdp
113 end interface filewrite
114 interface filewritevar
115 module procedure filewritevar1drealsp
116 module procedure filewritevar1drealdp
117 module procedure filewritevar2drealsp
118 module procedure filewritevar2drealdp
119 module procedure filewritevar3drealsp
120 module procedure filewritevar3drealdp
121 module procedure filewritevar4drealsp
122 module procedure filewritevar4drealdp
123 end interface filewritevar
124 interface filegetglobalattribute
125 module procedure filegetglobalattributetext
126 module procedure filegetglobalattributeint
127 module procedure filegetglobalattributefloat
128 module procedure filegetglobalattributedouble
129 end interface filegetglobalattribute
130 interface filesetglobalattribute
131 module procedure filesetglobalattributetext
132 module procedure filesetglobalattributeint
133 module procedure filesetglobalattributefloat
134 module procedure filesetglobalattributedouble
135 end interface filesetglobalattribute
141 real(DP),
parameter,
public ::
rmiss = -9.9999e+30
150 integer,
private,
parameter :: file_nfile_max = 512
152 integer,
private,
parameter :: file_nvar_max = 40960
155 character(LEN=File_HLONG),
private,
save :: file_fname_list(file_nfile_max)
156 integer,
private,
save :: file_fid_list (file_nfile_max)
157 integer,
private,
save :: file_fid_count = 1
158 character(LEN=File_HLONG),
private,
save :: file_vname_list (file_nvar_max)
159 integer,
private,
save :: file_vid_fid_list(file_nvar_max)
160 integer,
private,
save :: file_vid_list (file_nvar_max)
161 integer,
private,
save :: file_vid_count = 1
162 integer,
private,
save :: mpi_myrank
164 character(LEN=LOG_LMSG),
private :: message
183 integer,
intent(out) :: fid
184 logical,
intent(out) :: existed
185 character(LEN=*),
intent( in) :: basename
186 character(LEN=*),
intent( in) :: title
187 character(LEN=*),
intent( in) :: source
188 character(LEN=*),
intent( in) :: institution
189 integer,
intent( in) :: master
190 integer,
intent( in) :: myrank
191 integer,
intent( in) :: rankidx(:)
192 character(LEN=*),
intent( in),
optional :: time_units
193 logical,
intent( in),
optional :: single
194 logical,
intent( in),
optional :: append
196 character(len=File_HMID) :: time_units_
203 if (
present(time_units) )
then 204 time_units_ = time_units
206 time_units_ =
'seconds' 211 if (
present(single) )
then 212 if ( single .and. (myrank .ne. master) )
return 219 if (
present(append) )
then 231 if ( existed )
return 234 call filesetglobalattribute( fid, &
236 call filesetglobalattribute( fid, &
238 call filesetglobalattribute( fid, &
239 "institution", institution )
240 call filesetglobalattribute( fid, &
241 "myrank", (/myrank/) )
242 call filesetglobalattribute( fid, &
249 call log(
'E',
'xxx failed to set time units')
256 subroutine filegetglobalattributetext( &
261 integer,
intent(in) :: fid
262 character(LEN=*),
intent(in) :: key
263 character(LEN=*),
intent(out) :: val
273 call log(
'E',
'xxx failed to get text global attribute: '//trim(key))
277 end subroutine filegetglobalattributetext
280 subroutine filegetglobalattributeint( &
285 integer,
intent(in) :: fid
286 character(LEN=*),
intent(in) :: key
287 integer,
intent(out) :: val(:)
294 fid, key,
size(val), &
297 call log(
'E',
'xxx failed to get integer global attribute: '//trim(key))
301 end subroutine filegetglobalattributeint
304 subroutine filegetglobalattributefloat( &
309 integer,
intent(in) :: fid
310 character(LEN=*),
intent(in) :: key
311 real(SP),
intent(out) :: val(:)
318 fid, key,
size(val), &
321 call log(
'E',
'xxx failed to get float global attribute: '//trim(key))
325 end subroutine filegetglobalattributefloat
328 subroutine filegetglobalattributedouble( &
333 integer,
intent(in) :: fid
334 character(LEN=*),
intent(in) :: key
335 real(DP),
intent(out) :: val(:)
342 fid, key,
size(val), &
345 call log(
'E',
'xxx failed to get double global attribute: '//trim(key))
349 end subroutine filegetglobalattributedouble
353 subroutine filesetglobalattributetext( &
358 integer,
intent(in) :: fid
359 character(LEN=*),
intent(in) :: key
360 character(LEN=*),
intent(in) :: val
368 call log(
'E',
'xxx failed to set text global attribute: '//trim(key))
372 end subroutine filesetglobalattributetext
375 subroutine filesetglobalattributeint( &
380 integer,
intent(in) :: fid
381 character(LEN=*),
intent(in) :: key
382 integer,
intent(in) :: val(:)
389 key, val,
size(val), &
392 call log(
'E',
'xxx failed to set integer global attribute: '//trim(key))
396 end subroutine filesetglobalattributeint
399 subroutine filesetglobalattributefloat( &
404 integer,
intent(in) :: fid
405 character(LEN=*),
intent(in) :: key
406 real(SP),
intent(in) :: val(:)
413 key, val,
size(val), &
416 call log(
'E',
'xxx failed to set float global attribute: '//trim(key))
420 end subroutine filesetglobalattributefloat
423 subroutine filesetglobalattributedouble( &
428 integer,
intent(in) :: fid
429 character(LEN=*),
intent(in) :: key
430 real(DP),
intent(in) :: val(:)
437 key, val,
size(val), &
440 call log(
'E',
'xxx failed to set double global attribute: '//trim(key))
444 end subroutine filesetglobalattributedouble
453 integer,
intent(in) :: fid
454 character(LEN=*),
intent(in) :: filetype
455 character(LEN=*),
intent(in) :: key
456 character(LEN=*),
intent(in) :: val
461 filetype, key, val, &
464 call log(
'E',
'xxx failed to set option')
479 integer,
intent(out) :: fid
480 character(LEN=*),
intent( in) :: basename
481 integer,
intent( in) :: mode
482 logical,
intent( in),
optional :: single
485 logical :: single_ = .false.
487 if (
present(single) ) single_ = single
489 call filegetfid( fid, &
491 basename, mode, single_ )
499 subroutine fileputaxisrealsp( &
507 integer,
intent(in) :: fid
508 character(len=*),
intent(in) :: name
509 character(len=*),
intent(in) :: desc
510 character(len=*),
intent(in) :: units
511 character(len=*),
intent(in) :: dim_name
512 integer,
intent(in) :: dtype
513 real(SP),
intent(in) :: val(:)
519 name, desc, units, dim_name, dtype, val,
size(val),
sp, &
522 call log(
'E',
'xxx failed to put axis')
526 end subroutine fileputaxisrealsp
527 subroutine fileputaxisrealdp( &
535 integer,
intent(in) :: fid
536 character(len=*),
intent(in) :: name
537 character(len=*),
intent(in) :: desc
538 character(len=*),
intent(in) :: units
539 character(len=*),
intent(in) :: dim_name
540 integer,
intent(in) :: dtype
541 real(DP),
intent(in) :: val(:)
547 name, desc, units, dim_name, dtype, val,
size(val),
dp, &
550 call log(
'E',
'xxx failed to put axis')
554 end subroutine fileputaxisrealdp
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 integer,
intent(in) :: dim_size
575 call file_def_axis( fid, name, desc, units, dim_name, dtype, dim_size, &
578 call log(
'E',
'xxx failed to define axis')
587 subroutine filewriteaxisrealsp( &
591 integer,
intent(in) :: fid
592 character(len=*),
intent(in) :: name
593 real(SP),
intent(in) :: val(:)
601 call log(
'E',
'xxx failed to write axis')
605 end subroutine filewriteaxisrealsp
606 subroutine filewriteaxisrealdp( &
610 integer,
intent(in) :: fid
611 character(len=*),
intent(in) :: name
612 real(DP),
intent(in) :: val(:)
620 call log(
'E',
'xxx failed to write axis')
624 end subroutine filewriteaxisrealdp
629 subroutine fileput1dassociatedcoordinatesrealsp( &
637 integer,
intent(in) :: fid
638 character(len=*),
intent(in) :: name
639 character(len=*),
intent(in) :: desc
640 character(len=*),
intent(in) :: units
641 character(len=*),
intent(in) :: dim_names(:)
642 integer,
intent(in) :: dtype
643 real(SP),
intent(in) :: val(:)
649 name, desc, units, dim_names,
size(dim_names), dtype, &
653 call log(
'E',
'xxx failed to put associated coordinates')
657 end subroutine fileput1dassociatedcoordinatesrealsp
658 subroutine fileput1dassociatedcoordinatesrealdp( &
666 integer,
intent(in) :: fid
667 character(len=*),
intent(in) :: name
668 character(len=*),
intent(in) :: desc
669 character(len=*),
intent(in) :: units
670 character(len=*),
intent(in) :: dim_names(:)
671 integer,
intent(in) :: dtype
672 real(DP),
intent(in) :: val(:)
678 name, desc, units, dim_names,
size(dim_names), dtype, &
682 call log(
'E',
'xxx failed to put associated coordinates')
686 end subroutine fileput1dassociatedcoordinatesrealdp
687 subroutine fileput2dassociatedcoordinatesrealsp( &
695 integer,
intent(in) :: fid
696 character(len=*),
intent(in) :: name
697 character(len=*),
intent(in) :: desc
698 character(len=*),
intent(in) :: units
699 character(len=*),
intent(in) :: dim_names(:)
700 integer,
intent(in) :: dtype
701 real(SP),
intent(in) :: val(:,:)
707 name, desc, units, dim_names,
size(dim_names), dtype, &
711 call log(
'E',
'xxx failed to put associated coordinates')
715 end subroutine fileput2dassociatedcoordinatesrealsp
716 subroutine fileput2dassociatedcoordinatesrealdp( &
724 integer,
intent(in) :: fid
725 character(len=*),
intent(in) :: name
726 character(len=*),
intent(in) :: desc
727 character(len=*),
intent(in) :: units
728 character(len=*),
intent(in) :: dim_names(:)
729 integer,
intent(in) :: dtype
730 real(DP),
intent(in) :: val(:,:)
736 name, desc, units, dim_names,
size(dim_names), dtype, &
740 call log(
'E',
'xxx failed to put associated coordinates')
744 end subroutine fileput2dassociatedcoordinatesrealdp
745 subroutine fileput3dassociatedcoordinatesrealsp( &
753 integer,
intent(in) :: fid
754 character(len=*),
intent(in) :: name
755 character(len=*),
intent(in) :: desc
756 character(len=*),
intent(in) :: units
757 character(len=*),
intent(in) :: dim_names(:)
758 integer,
intent(in) :: dtype
759 real(SP),
intent(in) :: val(:,:,:)
765 name, desc, units, dim_names,
size(dim_names), dtype, &
769 call log(
'E',
'xxx failed to put associated coordinates')
773 end subroutine fileput3dassociatedcoordinatesrealsp
774 subroutine fileput3dassociatedcoordinatesrealdp( &
782 integer,
intent(in) :: fid
783 character(len=*),
intent(in) :: name
784 character(len=*),
intent(in) :: desc
785 character(len=*),
intent(in) :: units
786 character(len=*),
intent(in) :: dim_names(:)
787 integer,
intent(in) :: dtype
788 real(DP),
intent(in) :: val(:,:,:)
794 name, desc, units, dim_names,
size(dim_names), dtype, &
798 call log(
'E',
'xxx failed to put associated coordinates')
802 end subroutine fileput3dassociatedcoordinatesrealdp
803 subroutine fileput4dassociatedcoordinatesrealsp( &
811 integer,
intent(in) :: fid
812 character(len=*),
intent(in) :: name
813 character(len=*),
intent(in) :: desc
814 character(len=*),
intent(in) :: units
815 character(len=*),
intent(in) :: dim_names(:)
816 integer,
intent(in) :: dtype
817 real(SP),
intent(in) :: val(:,:,:,:)
823 name, desc, units, dim_names,
size(dim_names), dtype, &
827 call log(
'E',
'xxx failed to put associated coordinates')
831 end subroutine fileput4dassociatedcoordinatesrealsp
832 subroutine fileput4dassociatedcoordinatesrealdp( &
840 integer,
intent(in) :: fid
841 character(len=*),
intent(in) :: name
842 character(len=*),
intent(in) :: desc
843 character(len=*),
intent(in) :: units
844 character(len=*),
intent(in) :: dim_names(:)
845 integer,
intent(in) :: dtype
846 real(DP),
intent(in) :: val(:,:,:,:)
852 name, desc, units, dim_names,
size(dim_names), dtype, &
856 call log(
'E',
'xxx failed to put associated coordinates')
860 end subroutine fileput4dassociatedcoordinatesrealdp
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
880 name, desc, units, dim_names,
size(dim_names), dtype, &
883 call log(
'E',
'xxx failed to put associated coordinates')
892 subroutine filewrite1dassociatedcoordinatesrealsp( &
896 integer,
intent(in) :: fid
897 character(len=*),
intent(in) :: name
898 real(SP),
intent(in) :: val(:)
906 call log(
'E',
'xxx failed to put associated coordinates')
910 end subroutine filewrite1dassociatedcoordinatesrealsp
911 subroutine filewrite1dassociatedcoordinatesrealdp( &
915 integer,
intent(in) :: fid
916 character(len=*),
intent(in) :: name
917 real(DP),
intent(in) :: val(:)
925 call log(
'E',
'xxx failed to put associated coordinates')
929 end subroutine filewrite1dassociatedcoordinatesrealdp
930 subroutine filewrite2dassociatedcoordinatesrealsp( &
934 integer,
intent(in) :: fid
935 character(len=*),
intent(in) :: name
936 real(SP),
intent(in) :: val(:,:)
944 call log(
'E',
'xxx failed to put associated coordinates')
948 end subroutine filewrite2dassociatedcoordinatesrealsp
949 subroutine filewrite2dassociatedcoordinatesrealdp( &
953 integer,
intent(in) :: fid
954 character(len=*),
intent(in) :: name
955 real(DP),
intent(in) :: val(:,:)
963 call log(
'E',
'xxx failed to put associated coordinates')
967 end subroutine filewrite2dassociatedcoordinatesrealdp
968 subroutine filewrite3dassociatedcoordinatesrealsp( &
972 integer,
intent(in) :: fid
973 character(len=*),
intent(in) :: name
974 real(SP),
intent(in) :: val(:,:,:)
982 call log(
'E',
'xxx failed to put associated coordinates')
986 end subroutine filewrite3dassociatedcoordinatesrealsp
987 subroutine filewrite3dassociatedcoordinatesrealdp( &
991 integer,
intent(in) :: fid
992 character(len=*),
intent(in) :: name
993 real(DP),
intent(in) :: val(:,:,:)
1001 call log(
'E',
'xxx failed to put associated coordinates')
1005 end subroutine filewrite3dassociatedcoordinatesrealdp
1006 subroutine filewrite4dassociatedcoordinatesrealsp( &
1010 integer,
intent(in) :: fid
1011 character(len=*),
intent(in) :: name
1012 real(SP),
intent(in) :: val(:,:,:,:)
1020 call log(
'E',
'xxx failed to put associated coordinates')
1024 end subroutine filewrite4dassociatedcoordinatesrealsp
1025 subroutine filewrite4dassociatedcoordinatesrealdp( &
1029 integer,
intent(in) :: fid
1030 character(len=*),
intent(in) :: name
1031 real(DP),
intent(in) :: val(:,:,:,:)
1039 call log(
'E',
'xxx failed to put associated coordinates')
1043 end subroutine filewrite4dassociatedcoordinatesrealdp
1048 subroutine fileaddvariablenot( &
1058 integer,
intent(out) :: vid
1059 integer,
intent( in) :: fid
1060 character(len=*),
intent( in) :: varname
1061 character(len=*),
intent( in) :: desc
1062 character(len=*),
intent( in) :: units
1063 character(len=*),
intent( in) :: dims(:)
1064 integer,
intent( in) :: dtype
1065 logical,
intent( in),
optional :: tavg
1067 call fileaddvariablerealdp(vid, fid, varname, desc, units, dims, dtype, &
1071 end subroutine fileaddvariablenot
1072 subroutine fileaddvariablerealsp( &
1083 integer,
intent(out) :: vid
1084 integer,
intent( in) :: fid
1085 character(len=*),
intent( in) :: varname
1086 character(len=*),
intent( in) :: desc
1087 character(len=*),
intent( in) :: units
1088 character(len=*),
intent( in) :: dims(:)
1089 integer,
intent( in) :: dtype
1090 real(SP),
intent( in) :: tint
1091 logical,
intent( in),
optional :: tavg
1102 do n = 1, file_vid_count
1103 if ( file_vid_fid_list(n) == fid .and. &
1104 varname == file_vname_list(n) )
then 1105 vid = file_vid_list(n)
1111 write(message,*)
'*** [File] Var registration' 1112 call log(
"I", message)
1113 write(message,*)
'*** variable name: ', trim(varname)
1114 call log(
"I", message)
1116 tint8 =
real(tint,
dp)
1118 if (
present(tavg) )
then 1129 fid, varname, desc, units, dims,
size(dims), dtype, &
1133 call log(
'E',
'xxx failed to add variable: '//trim(varname))
1136 file_vname_list(file_vid_count) = trim(varname)
1137 file_vid_list(file_vid_count) = vid
1138 file_vid_fid_list(file_vid_count) = fid
1139 file_vid_count = file_vid_count + 1
1143 end subroutine fileaddvariablerealsp
1144 subroutine fileaddvariablerealdp( &
1155 integer,
intent(out) :: vid
1156 integer,
intent( in) :: fid
1157 character(len=*),
intent( in) :: varname
1158 character(len=*),
intent( in) :: desc
1159 character(len=*),
intent( in) :: units
1160 character(len=*),
intent( in) :: dims(:)
1161 integer,
intent( in) :: dtype
1162 real(DP),
intent( in) :: tint
1163 logical,
intent( in),
optional :: tavg
1174 do n = 1, file_vid_count
1175 if ( file_vid_fid_list(n) == fid .and. &
1176 varname == file_vname_list(n) )
then 1177 vid = file_vid_list(n)
1183 write(message,*)
'*** [File] Var registration' 1184 call log(
"I", message)
1185 write(message,*)
'*** variable name: ', trim(varname)
1186 call log(
"I", message)
1188 tint8 =
real(tint,
dp)
1190 if (
present(tavg) )
then 1201 fid, varname, desc, units, dims,
size(dims), dtype, &
1205 call log(
'E',
'xxx failed to add variable: '//trim(varname))
1208 file_vname_list(file_vid_count) = trim(varname)
1209 file_vid_list(file_vid_count) = vid
1210 file_vid_fid_list(file_vid_count) = fid
1211 file_vid_count = file_vid_count + 1
1215 end subroutine fileaddvariablerealdp
1229 integer,
intent(out) :: vid
1230 integer,
intent( in) :: fid
1231 character(len=*),
intent( in) :: varname
1232 character(len=*),
intent( in) :: desc
1233 character(len=*),
intent( in) :: units
1234 integer,
intent( in) :: ndims
1235 character(len=*),
intent( in) :: dims(:)
1236 integer,
intent( in) :: dtype
1237 real(DP),
intent( in),
optional :: tint
1238 logical,
intent( in),
optional :: tavg
1249 do n = 1, file_vid_count
1250 if ( file_vid_fid_list(n) == fid .and. &
1251 varname == file_vname_list(n) )
then 1252 vid = file_vid_list(n)
1258 write(message,*)
'*** [File] Var registration' 1259 call log(
"I", message)
1260 write(message,*)
'*** variable name: ', trim(varname)
1261 call log(
"I", message)
1263 if ( .NOT.
present(tint) )
then 1267 if (
present(tavg) )
then 1278 fid, varname, desc, units, dims, ndims, dtype, &
1282 call log(
'E',
'xxx failed to add variable: '//trim(varname))
1285 file_vname_list(file_vid_count) = trim(varname)
1286 file_vid_list(file_vid_count) = vid
1287 file_vid_fid_list(file_vid_count) = fid
1288 file_vid_count = file_vid_count + 1
1303 integer,
intent(in) :: fid
1304 character(len=*),
intent(in) :: vname
1305 character(len=*),
intent(in) :: key
1306 character(len=*),
intent(in) :: val
1315 call log(
'E',
'xxx failed to set attr for axis')
1333 integer,
intent(out) :: dims(:)
1334 character(LEN=*),
intent( in) :: basename
1335 character(LEN=*),
intent( in) :: varname
1336 integer,
intent( in) :: myrank
1337 logical,
intent( in),
optional :: single
1344 logical :: single_ = .false.
1352 if (
present(single) ) single_ = single
1360 fid, varname, 1, .false., &
1365 call log(
'E',
'xxx failed to get data information :'//trim(varname))
1368 if ( dinfo%rank /=
size(dims) )
then 1369 write(message,*)
'xxx rank is different, ',
size(dims), dinfo%rank
1370 call log(
'E', message)
1372 do n = 1,
size(dims)
1373 dims(n) = dinfo%dim_size(n)
1398 character(len=*),
intent(in) :: basename
1399 character(len=*),
intent(in) :: varname
1400 integer,
intent(in) :: myrank
1401 integer,
intent(in) :: istep
1402 logical,
intent(in),
optional :: single
1404 character(len=File_HMID),
intent(out),
optional :: description
1405 character(len=File_HSHORT),
intent(out),
optional :: units
1406 integer,
intent(out),
optional :: datatype
1407 integer,
intent(out),
optional :: dim_rank
1408 character(len=File_HSHORT),
intent(out),
optional :: dim_name(:)
1409 integer,
intent(out),
optional :: dim_size(:)
1410 real(DP),
intent(out),
optional :: time_start
1411 real(DP),
intent(out),
optional :: time_end
1412 character(len=File_HMID),
intent(out),
optional :: time_units
1417 integer :: ndim, idim
1421 logical :: single_ = .false.
1428 if (
present(single) ) single_ = single
1446 call log(
'E',
'xxx data info not found in '//trim(basename))
1449 if (
present(description) ) description = dinfo%description
1450 if (
present(units) ) units = dinfo%units
1451 if (
present(datatype) ) datatype = dinfo%datatype
1452 if (
present(dim_rank) ) dim_rank = dinfo%rank
1454 if (
present(dim_name) )
then 1455 ndim = min( dinfo%rank,
size(dim_name) )
1457 dim_name(idim) = dinfo%dim_name(idim)
1460 if (
present(dim_size) )
then 1461 ndim = min( dinfo%rank,
size(dim_size) )
1463 dim_size(idim) = dinfo%dim_size(idim)
1467 if (
present(time_units) )
then 1468 if ( dinfo%time_units ==
"" )
then 1469 call filegetglobalattribute( fid,
"time_units", time_units )
1471 time_units = dinfo%time_units
1474 if (
present(time_start) )
then 1475 if ( dinfo%time_units ==
"" )
then 1476 call filegetglobalattribute( fid,
"time", time )
1477 time_start = time(1)
1479 time_start = dinfo%time_start
1482 if (
present(time_end) )
then 1483 if ( dinfo%time_units ==
"" )
then 1484 call filegetglobalattribute( fid,
"time", time )
1487 time_end = dinfo%time_end
1516 integer,
intent(in) :: step_limit
1517 integer,
intent(in) :: dim_limit
1518 character(len=*),
intent(in) :: basename
1519 character(len=*),
intent(in) :: varname
1520 integer,
intent(in) :: myrank
1521 integer,
intent(out) :: step_nmax
1522 character(len=File_HMID),
intent(out) :: description
1523 character(len=File_HSHORT),
intent(out) :: units
1524 integer,
intent(out) :: datatype
1525 integer,
intent(out) :: dim_rank
1526 character(len=File_HSHORT),
intent(out) :: dim_name (dim_limit)
1527 integer,
intent(out) :: dim_size (dim_limit)
1528 real(DP),
intent(out) :: time_start(step_limit)
1529 real(DP),
intent(out) :: time_end (step_limit)
1530 character(len=File_HMID),
intent(out) :: time_units
1532 logical,
intent(in),
optional :: single
1538 integer :: istep, idim
1539 logical :: flag_first = .true.
1542 logical :: single_ = .false.
1547 if (
present(single) ) single_ = single
1562 time_start(:) =
rmiss 1565 do istep = 1, step_limit
1576 step_nmax = istep - 1
1580 if ( flag_first )
then 1581 flag_first = .false.
1583 description = dinfo%description
1585 datatype = dinfo%datatype
1586 dim_rank = dinfo%rank
1588 ndim = min( dinfo%rank, dim_limit )
1590 dim_name(idim) = dinfo%dim_name(idim)
1591 dim_size(idim) = dinfo%dim_size(idim)
1594 time_units = dinfo%time_units
1597 time_start(istep) = dinfo%time_start
1598 time_end(istep) = dinfo%time_end
1607 subroutine fileread1drealsp( &
1618 real(SP),
intent(out) :: var(:)
1619 character(LEN=*),
intent( in) :: basename
1620 character(LEN=*),
intent( in) :: varname
1621 integer,
intent( in) :: step
1622 integer,
intent( in) :: myrank
1623 logical,
intent( in),
optional :: allow_missing
1624 logical,
intent( in),
optional :: single
1628 integer :: dim_size(1)
1632 logical :: single_ = .false.
1639 if (
present(single) ) single_ = single
1647 fid, varname, step, .false., &
1652 if (
present(allow_missing) )
then 1653 if ( allow_missing )
then 1654 write(message,*)
'xxx [INPUT]/[File] data not found! : ', &
1655 'varname= ',trim(varname),
', step=',step
1656 call log(
'I', message)
1657 call log(
'I',
'xxx [INPUT]/[File] Value is set to 0.')
1660 call log(
'E',
'xxx failed to get data information :'//trim(varname))
1663 call log(
'E',
'xxx failed to get data information :'//trim(varname))
1667 if ( dinfo%rank /= 1 )
then 1668 write(message,*)
'xxx rank is not 1', dinfo%rank
1669 call log(
'E', message)
1671 dim_size(:) = shape(var)
1673 if ( dinfo%dim_size(n) /= dim_size(n) )
then 1674 write(message,*)
'xxx shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
1675 call log(
'E', message)
1683 call log(
'E',
'xxx failed to get data value')
1687 end subroutine fileread1drealsp
1688 subroutine fileread1drealdp( &
1699 real(DP),
intent(out) :: var(:)
1700 character(LEN=*),
intent( in) :: basename
1701 character(LEN=*),
intent( in) :: varname
1702 integer,
intent( in) :: step
1703 integer,
intent( in) :: myrank
1704 logical,
intent( in),
optional :: allow_missing
1705 logical,
intent( in),
optional :: single
1709 integer :: dim_size(1)
1713 logical :: single_ = .false.
1720 if (
present(single) ) single_ = single
1728 fid, varname, step, .false., &
1733 if (
present(allow_missing) )
then 1734 if ( allow_missing )
then 1735 write(message,*)
'xxx [INPUT]/[File] data not found! : ', &
1736 'varname= ',trim(varname),
', step=',step
1737 call log(
'I', message)
1738 call log(
'I',
'xxx [INPUT]/[File] Value is set to 0.')
1741 call log(
'E',
'xxx failed to get data information :'//trim(varname))
1744 call log(
'E',
'xxx failed to get data information :'//trim(varname))
1748 if ( dinfo%rank /= 1 )
then 1749 write(message,*)
'xxx rank is not 1', dinfo%rank
1750 call log(
'E', message)
1752 dim_size(:) = shape(var)
1754 if ( dinfo%dim_size(n) /= dim_size(n) )
then 1755 write(message,*)
'xxx shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
1756 call log(
'E', message)
1764 call log(
'E',
'xxx failed to get data value')
1768 end subroutine fileread1drealdp
1769 subroutine fileread2drealsp( &
1780 real(SP),
intent(out) :: var(:,:)
1781 character(LEN=*),
intent( in) :: basename
1782 character(LEN=*),
intent( in) :: varname
1783 integer,
intent( in) :: step
1784 integer,
intent( in) :: myrank
1785 logical,
intent( in),
optional :: allow_missing
1786 logical,
intent( in),
optional :: single
1790 integer :: dim_size(2)
1794 logical :: single_ = .false.
1801 if (
present(single) ) single_ = single
1809 fid, varname, step, .false., &
1814 if (
present(allow_missing) )
then 1815 if ( allow_missing )
then 1816 write(message,*)
'xxx [INPUT]/[File] data not found! : ', &
1817 'varname= ',trim(varname),
', step=',step
1818 call log(
'I', message)
1819 call log(
'I',
'xxx [INPUT]/[File] Value is set to 0.')
1822 call log(
'E',
'xxx failed to get data information :'//trim(varname))
1825 call log(
'E',
'xxx failed to get data information :'//trim(varname))
1829 if ( dinfo%rank /= 2 )
then 1830 write(message,*)
'xxx rank is not 2', dinfo%rank
1831 call log(
'E', message)
1833 dim_size(:) = shape(var)
1835 if ( dinfo%dim_size(n) /= dim_size(n) )
then 1836 write(message,*)
'xxx shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
1837 call log(
'E', message)
1845 call log(
'E',
'xxx failed to get data value')
1849 end subroutine fileread2drealsp
1850 subroutine fileread2drealdp( &
1861 real(DP),
intent(out) :: var(:,:)
1862 character(LEN=*),
intent( in) :: basename
1863 character(LEN=*),
intent( in) :: varname
1864 integer,
intent( in) :: step
1865 integer,
intent( in) :: myrank
1866 logical,
intent( in),
optional :: allow_missing
1867 logical,
intent( in),
optional :: single
1871 integer :: dim_size(2)
1875 logical :: single_ = .false.
1882 if (
present(single) ) single_ = single
1890 fid, varname, step, .false., &
1895 if (
present(allow_missing) )
then 1896 if ( allow_missing )
then 1897 write(message,*)
'xxx [INPUT]/[File] data not found! : ', &
1898 'varname= ',trim(varname),
', step=',step
1899 call log(
'I', message)
1900 call log(
'I',
'xxx [INPUT]/[File] Value is set to 0.')
1903 call log(
'E',
'xxx failed to get data information :'//trim(varname))
1906 call log(
'E',
'xxx failed to get data information :'//trim(varname))
1910 if ( dinfo%rank /= 2 )
then 1911 write(message,*)
'xxx rank is not 2', dinfo%rank
1912 call log(
'E', message)
1914 dim_size(:) = shape(var)
1916 if ( dinfo%dim_size(n) /= dim_size(n) )
then 1917 write(message,*)
'xxx shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
1918 call log(
'E', message)
1926 call log(
'E',
'xxx failed to get data value')
1930 end subroutine fileread2drealdp
1931 subroutine fileread3drealsp( &
1942 real(SP),
intent(out) :: var(:,:,:)
1943 character(LEN=*),
intent( in) :: basename
1944 character(LEN=*),
intent( in) :: varname
1945 integer,
intent( in) :: step
1946 integer,
intent( in) :: myrank
1947 logical,
intent( in),
optional :: allow_missing
1948 logical,
intent( in),
optional :: single
1952 integer :: dim_size(3)
1956 logical :: single_ = .false.
1963 if (
present(single) ) single_ = single
1971 fid, varname, step, .false., &
1976 if (
present(allow_missing) )
then 1977 if ( allow_missing )
then 1978 write(message,*)
'xxx [INPUT]/[File] data not found! : ', &
1979 'varname= ',trim(varname),
', step=',step
1980 call log(
'I', message)
1981 call log(
'I',
'xxx [INPUT]/[File] Value is set to 0.')
1984 call log(
'E',
'xxx failed to get data information :'//trim(varname))
1987 call log(
'E',
'xxx failed to get data information :'//trim(varname))
1991 if ( dinfo%rank /= 3 )
then 1992 write(message,*)
'xxx rank is not 3', dinfo%rank
1993 call log(
'E', message)
1995 dim_size(:) = shape(var)
1997 if ( dinfo%dim_size(n) /= dim_size(n) )
then 1998 write(message,*)
'xxx shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
1999 call log(
'E', message)
2007 call log(
'E',
'xxx failed to get data value')
2011 end subroutine fileread3drealsp
2012 subroutine fileread3drealdp( &
2023 real(DP),
intent(out) :: var(:,:,:)
2024 character(LEN=*),
intent( in) :: basename
2025 character(LEN=*),
intent( in) :: varname
2026 integer,
intent( in) :: step
2027 integer,
intent( in) :: myrank
2028 logical,
intent( in),
optional :: allow_missing
2029 logical,
intent( in),
optional :: single
2033 integer :: dim_size(3)
2037 logical :: single_ = .false.
2044 if (
present(single) ) single_ = single
2052 fid, varname, step, .false., &
2057 if (
present(allow_missing) )
then 2058 if ( allow_missing )
then 2059 write(message,*)
'xxx [INPUT]/[File] data not found! : ', &
2060 'varname= ',trim(varname),
', step=',step
2061 call log(
'I', message)
2062 call log(
'I',
'xxx [INPUT]/[File] Value is set to 0.')
2065 call log(
'E',
'xxx failed to get data information :'//trim(varname))
2068 call log(
'E',
'xxx failed to get data information :'//trim(varname))
2072 if ( dinfo%rank /= 3 )
then 2073 write(message,*)
'xxx rank is not 3', dinfo%rank
2074 call log(
'E', message)
2076 dim_size(:) = shape(var)
2078 if ( dinfo%dim_size(n) /= dim_size(n) )
then 2079 write(message,*)
'xxx shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
2080 call log(
'E', message)
2088 call log(
'E',
'xxx failed to get data value')
2092 end subroutine fileread3drealdp
2093 subroutine fileread4drealsp( &
2104 real(SP),
intent(out) :: var(:,:,:,:)
2105 character(LEN=*),
intent( in) :: basename
2106 character(LEN=*),
intent( in) :: varname
2107 integer,
intent( in) :: step
2108 integer,
intent( in) :: myrank
2109 logical,
intent( in),
optional :: allow_missing
2110 logical,
intent( in),
optional :: single
2114 integer :: dim_size(4)
2118 logical :: single_ = .false.
2125 if (
present(single) ) single_ = single
2133 fid, varname, step, .false., &
2138 if (
present(allow_missing) )
then 2139 if ( allow_missing )
then 2140 write(message,*)
'xxx [INPUT]/[File] data not found! : ', &
2141 'varname= ',trim(varname),
', step=',step
2142 call log(
'I', message)
2143 call log(
'I',
'xxx [INPUT]/[File] Value is set to 0.')
2144 var(:,:,:,:) = 0.0_sp
2146 call log(
'E',
'xxx failed to get data information :'//trim(varname))
2149 call log(
'E',
'xxx failed to get data information :'//trim(varname))
2153 if ( dinfo%rank /= 4 )
then 2154 write(message,*)
'xxx rank is not 4', dinfo%rank
2155 call log(
'E', message)
2157 dim_size(:) = shape(var)
2159 if ( dinfo%dim_size(n) /= dim_size(n) )
then 2160 write(message,*)
'xxx shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
2161 call log(
'E', message)
2169 call log(
'E',
'xxx failed to get data value')
2173 end subroutine fileread4drealsp
2174 subroutine fileread4drealdp( &
2185 real(DP),
intent(out) :: var(:,:,:,:)
2186 character(LEN=*),
intent( in) :: basename
2187 character(LEN=*),
intent( in) :: varname
2188 integer,
intent( in) :: step
2189 integer,
intent( in) :: myrank
2190 logical,
intent( in),
optional :: allow_missing
2191 logical,
intent( in),
optional :: single
2195 integer :: dim_size(4)
2199 logical :: single_ = .false.
2206 if (
present(single) ) single_ = single
2214 fid, varname, step, .false., &
2219 if (
present(allow_missing) )
then 2220 if ( allow_missing )
then 2221 write(message,*)
'xxx [INPUT]/[File] data not found! : ', &
2222 'varname= ',trim(varname),
', step=',step
2223 call log(
'I', message)
2224 call log(
'I',
'xxx [INPUT]/[File] Value is set to 0.')
2225 var(:,:,:,:) = 0.0_dp
2227 call log(
'E',
'xxx failed to get data information :'//trim(varname))
2230 call log(
'E',
'xxx failed to get data information :'//trim(varname))
2234 if ( dinfo%rank /= 4 )
then 2235 write(message,*)
'xxx rank is not 4', dinfo%rank
2236 call log(
'E', message)
2238 dim_size(:) = shape(var)
2240 if ( dinfo%dim_size(n) /= dim_size(n) )
then 2241 write(message,*)
'xxx shape is different: ', varname, n, dinfo%dim_size(n), dim_size(n)
2242 call log(
'E', message)
2250 call log(
'E',
'xxx failed to get data value')
2254 end subroutine fileread4drealdp
2259 subroutine filewrite1drealsp( &
2268 real(SP),
intent(in) :: var(:)
2269 integer,
intent(in) :: fid
2270 integer,
intent(in) :: vid
2271 real(DP),
intent(in) :: t_start
2272 real(DP),
intent(in) :: t_end
2277 character(len=100) :: str
2285 do n = 1, file_vid_count
2286 if ( file_vid_list(n) == vid )
then 2287 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2291 call log(
'E', trim(str))
2295 end subroutine filewrite1drealsp
2296 subroutine filewrite1drealdp( &
2305 real(DP),
intent(in) :: var(:)
2306 integer,
intent(in) :: fid
2307 integer,
intent(in) :: vid
2308 real(DP),
intent(in) :: t_start
2309 real(DP),
intent(in) :: t_end
2314 character(len=100) :: str
2322 do n = 1, file_vid_count
2323 if ( file_vid_list(n) == vid )
then 2324 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2328 call log(
'E', trim(str))
2332 end subroutine filewrite1drealdp
2333 subroutine filewrite2drealsp( &
2342 real(SP),
intent(in) :: var(:,:)
2343 integer,
intent(in) :: fid
2344 integer,
intent(in) :: vid
2345 real(DP),
intent(in) :: t_start
2346 real(DP),
intent(in) :: t_end
2351 character(len=100) :: str
2359 do n = 1, file_vid_count
2360 if ( file_vid_list(n) == vid )
then 2361 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2365 call log(
'E', trim(str))
2369 end subroutine filewrite2drealsp
2370 subroutine filewrite2drealdp( &
2379 real(DP),
intent(in) :: var(:,:)
2380 integer,
intent(in) :: fid
2381 integer,
intent(in) :: vid
2382 real(DP),
intent(in) :: t_start
2383 real(DP),
intent(in) :: t_end
2388 character(len=100) :: str
2396 do n = 1, file_vid_count
2397 if ( file_vid_list(n) == vid )
then 2398 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2402 call log(
'E', trim(str))
2406 end subroutine filewrite2drealdp
2407 subroutine filewrite3drealsp( &
2416 real(SP),
intent(in) :: var(:,:,:)
2417 integer,
intent(in) :: fid
2418 integer,
intent(in) :: vid
2419 real(DP),
intent(in) :: t_start
2420 real(DP),
intent(in) :: t_end
2425 character(len=100) :: str
2433 do n = 1, file_vid_count
2434 if ( file_vid_list(n) == vid )
then 2435 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2439 call log(
'E', trim(str))
2443 end subroutine filewrite3drealsp
2444 subroutine filewrite3drealdp( &
2453 real(DP),
intent(in) :: var(:,:,:)
2454 integer,
intent(in) :: fid
2455 integer,
intent(in) :: vid
2456 real(DP),
intent(in) :: t_start
2457 real(DP),
intent(in) :: t_end
2462 character(len=100) :: str
2470 do n = 1, file_vid_count
2471 if ( file_vid_list(n) == vid )
then 2472 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2476 call log(
'E', trim(str))
2480 end subroutine filewrite3drealdp
2481 subroutine filewrite4drealsp( &
2490 real(SP),
intent(in) :: var(:,:,:,:)
2491 integer,
intent(in) :: fid
2492 integer,
intent(in) :: vid
2493 real(DP),
intent(in) :: t_start
2494 real(DP),
intent(in) :: t_end
2499 character(len=100) :: str
2507 do n = 1, file_vid_count
2508 if ( file_vid_list(n) == vid )
then 2509 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2513 call log(
'E', trim(str))
2517 end subroutine filewrite4drealsp
2518 subroutine filewrite4drealdp( &
2527 real(DP),
intent(in) :: var(:,:,:,:)
2528 integer,
intent(in) :: fid
2529 integer,
intent(in) :: vid
2530 real(DP),
intent(in) :: t_start
2531 real(DP),
intent(in) :: t_end
2536 character(len=100) :: str
2544 do n = 1, file_vid_count
2545 if ( file_vid_list(n) == vid )
then 2546 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2550 call log(
'E', trim(str))
2554 end subroutine filewrite4drealdp
2559 subroutine filewritevar1drealsp( &
2567 real(SP),
intent(in) :: var(:)
2568 integer,
intent(in) :: vid
2569 real(DP),
intent(in) :: t_start
2570 real(DP),
intent(in) :: t_end
2575 character(len=100) :: str
2583 do n = 1, file_vid_count
2584 if ( file_vid_list(n) == vid )
then 2585 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2589 call log(
'E', trim(str))
2593 end subroutine filewritevar1drealsp
2594 subroutine filewritevar1drealdp( &
2602 real(DP),
intent(in) :: var(:)
2603 integer,
intent(in) :: vid
2604 real(DP),
intent(in) :: t_start
2605 real(DP),
intent(in) :: t_end
2610 character(len=100) :: str
2618 do n = 1, file_vid_count
2619 if ( file_vid_list(n) == vid )
then 2620 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2624 call log(
'E', trim(str))
2628 end subroutine filewritevar1drealdp
2629 subroutine filewritevar2drealsp( &
2637 real(SP),
intent(in) :: var(:,:)
2638 integer,
intent(in) :: vid
2639 real(DP),
intent(in) :: t_start
2640 real(DP),
intent(in) :: t_end
2645 character(len=100) :: str
2653 do n = 1, file_vid_count
2654 if ( file_vid_list(n) == vid )
then 2655 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2659 call log(
'E', trim(str))
2663 end subroutine filewritevar2drealsp
2664 subroutine filewritevar2drealdp( &
2672 real(DP),
intent(in) :: var(:,:)
2673 integer,
intent(in) :: vid
2674 real(DP),
intent(in) :: t_start
2675 real(DP),
intent(in) :: t_end
2680 character(len=100) :: str
2688 do n = 1, file_vid_count
2689 if ( file_vid_list(n) == vid )
then 2690 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2694 call log(
'E', trim(str))
2698 end subroutine filewritevar2drealdp
2699 subroutine filewritevar3drealsp( &
2707 real(SP),
intent(in) :: var(:,:,:)
2708 integer,
intent(in) :: vid
2709 real(DP),
intent(in) :: t_start
2710 real(DP),
intent(in) :: t_end
2715 character(len=100) :: str
2723 do n = 1, file_vid_count
2724 if ( file_vid_list(n) == vid )
then 2725 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2729 call log(
'E', trim(str))
2733 end subroutine filewritevar3drealsp
2734 subroutine filewritevar3drealdp( &
2742 real(DP),
intent(in) :: var(:,:,:)
2743 integer,
intent(in) :: vid
2744 real(DP),
intent(in) :: t_start
2745 real(DP),
intent(in) :: t_end
2750 character(len=100) :: str
2758 do n = 1, file_vid_count
2759 if ( file_vid_list(n) == vid )
then 2760 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2764 call log(
'E', trim(str))
2768 end subroutine filewritevar3drealdp
2769 subroutine filewritevar4drealsp( &
2777 real(SP),
intent(in) :: var(:,:,:,:)
2778 integer,
intent(in) :: vid
2779 real(DP),
intent(in) :: t_start
2780 real(DP),
intent(in) :: t_end
2785 character(len=100) :: str
2793 do n = 1, file_vid_count
2794 if ( file_vid_list(n) == vid )
then 2795 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2799 call log(
'E', trim(str))
2803 end subroutine filewritevar4drealsp
2804 subroutine filewritevar4drealdp( &
2812 real(DP),
intent(in) :: var(:,:,:,:)
2813 integer,
intent(in) :: vid
2814 real(DP),
intent(in) :: t_start
2815 real(DP),
intent(in) :: t_end
2820 character(len=100) :: str
2828 do n = 1, file_vid_count
2829 if ( file_vid_list(n) == vid )
then 2830 write(str,*)
'xxx failed to write data: ', trim(file_vname_list(n)), mpi_myrank
2834 call log(
'E', trim(str))
2838 end subroutine filewritevar4drealdp
2846 integer,
intent(in) :: fid
2851 if ( fid < 0 )
return 2853 do n = 1, file_fid_count-1
2854 if ( file_fid_list(n) == fid )
exit 2856 if ( fid .NE. file_fid_list(n) )
then 2857 write(message,*)
'xxx in FileEndDef invalid fid' , fid
2858 call log(
'E', message)
2863 write(message,
'(1x,A,i3)')
'*** [File] File enddef : NO.', n
2864 call log(
'I', message)
2865 call log(
'I',
'*** enddef filename: ' // trim(file_fname_list(n)))
2867 call log(
'E',
'xxx failed to exit define mode')
2879 integer,
intent(in) :: fid
2881 character(LEN=File_HLONG) :: fname
2886 if ( fid < 0 )
return 2888 do n = 1, file_fid_count-1
2889 if ( file_fid_list(n) == fid )
exit 2891 if ( n .EQ. file_fid_count )
return 2893 if ( fid /= file_fid_list(n) )
then 2894 write(message,*)
'xxx in FileClose invalid fid ', fid
2895 call log(
'E', message)
2900 write(message,
'(1x,A,i3)')
'*** [File] File Close : NO.', n
2901 call log(
'I', message)
2902 call log(
'I',
'*** closed filename: ' // trim(file_fname_list(n)))
2904 call log(
'E',
'xxx failed to close file')
2907 do n = 1, file_fid_count-1
2908 if ( file_fid_list(n) == fid )
then 2909 file_fid_list(n) = -1
2910 file_fname_list(n) =
'' 2923 do n = 1, file_fid_count-1
2939 character(len=*),
intent(out) :: fname
2940 character(len=*),
intent( in) :: basename
2941 character(len=*),
intent( in) :: prefix
2942 integer,
intent( in) :: myrank
2943 integer,
intent( in) :: len
2946 character(len=17) :: fmt =
"(A, '.', A, I*.*)" 2949 if ( len < 1 .or. len > 9 )
then 2950 call log(
'E',
'xxx len is invalid')
2953 write(fmt(14:14),
'(I1)') len
2954 write(fmt(16:16),
'(I1)') len
2955 write(fname, fmt) trim(basename), trim(prefix), myrank
2960 subroutine filegetfid( &
2968 integer,
intent(out) :: fid
2969 logical,
intent(out) :: existed
2970 character(LEN=*),
intent( in) :: basename
2971 integer,
intent( in) :: mode
2972 logical,
intent( in) :: single
2975 character(LEN=File_HSHORT) :: rwname(0:2)
2976 data rwname /
'READ',
'WRITE',
'APPEND' /
2978 character(LEN=File_HLONG) :: fname
2986 fname = trim(basename)//
'.peall' 2993 do n = 1, file_fid_count-1
2994 if ( fname==file_fname_list(n) ) fid = file_fid_list(n)
2997 if ( fid >= 0 )
then 3006 call log(
'E',
'xxx failed to open file :'//trim(fname)//
'.nc')
3009 write(message,*)
'*** [File] File registration : ',trim(rwname(mode)),
' -', fid
3010 call log(
"I", message)
3011 write(message,*)
'*** filename: ', trim(fname)
3012 call log(
"I", message)
3014 file_fname_list(file_fid_count) = trim(fname)
3015 file_fid_list(file_fid_count) = fid
3016 file_fid_count = file_fid_count + 1
3021 end subroutine filegetfid
integer, parameter, public log_lmsg
integer, parameter, public dp
subroutine, public log(type, message)
integer, parameter, public sp