47 character (len=:),
allocatable :: skeyword
51 integer (c_int) :: isourcedataform =
no_grid
56 character (len=256) :: sdescription =
""
57 character (len=256) :: ssourceproj4_string =
""
58 character (len=256) :: stargetproj4_string =
""
59 character (len=256) :: ssourcefiletype =
""
60 character (len=512) :: ssourcefilename =
""
61 character (len=512) :: sfilenametemplate =
""
63 character (len=512) :: soldfilename =
""
64 character (len=256) :: sdatecolumnname =
""
65 character (len=10) :: sdefaultdateformat =
"YYYY-MM-DD"
66 character (len=256) :: svaluecolumnname =
""
68 real (c_float),
allocatable :: table_values_real(:)
70 integer (c_int) :: table_indx
72 logical (c_bool) :: ltablevalueshavebeenretrieved =
false
74 integer (c_int) :: ifilecount = -1
75 integer (c_int) :: ifilecountyear = -9999
76 real (c_float) :: rminallowedvalue = -
rbigval
77 real (c_float) :: rmaxallowedvalue =
rbigval
78 integer (c_int) :: iminallowedvalue = -
ibigval
79 integer (c_int) :: imaxallowedvalue =
ibigval
80 real (c_float) :: rmissingvaluescode = -
rbigval
81 integer (c_int) :: imissingvaluescode = -
ibigval
82 character (len=2) :: smissingvaluesoperator =
"&&"
83 integer (c_int) :: imissingvaluesaction = 0
85 real (c_double) :: duserscalefactor = 1_c_double
86 real (c_double) :: duseraddoffset = 0_c_double
87 real (c_double) :: dusersuboffset = 0_c_double
88 real (c_double) :: rx_coord_addoffset = 0.0_c_double
89 real (c_double) :: ry_coord_addoffset = 0.0_c_double
90 real (c_double) :: rcoordinatetolerance = 0.0_c_double
92 real (c_double),
allocatable :: rx_coordinate_subset(:)
93 real (c_double),
allocatable :: ry_coordinate_subset(:)
95 logical (c_bool) :: lallowmissingfiles =
false
96 logical (c_bool) :: lallowautomaticdataflipping =
true
97 logical (c_bool) :: lfliphorizontal =
false
98 logical (c_bool) :: lflipvertical =
false
99 logical (c_bool) :: lusemajorityfilter =
false
100 logical (c_bool) :: lrequirecompletespatialcoverage =
true
102 integer (c_int) :: idaystopadatyearsend = 0
103 integer (c_int) :: idaystopadifleapyear = 1
104 integer (c_int) :: istartyear = -9999
105 integer (c_int) :: iendyear = -9999
106 logical (c_bool) :: lpadreplacewithzero =
false
107 logical (c_bool) :: lpadvalues =
false
108 logical (c_bool) :: lisannualgrid =
false
111 character (len=32) :: svariablename_x =
"x"
112 character (len=32) :: svariablename_y =
"y"
113 character (len=32) :: svariablename_z =
""
114 character (len=32) :: svariablename_time =
"time"
115 character (len=8) :: svariableorder =
"tyx"
125 integer (c_size_t) :: incfile_recnum = 0
127 integer (c_int) :: iconstantvalue = 0
128 real (c_float) :: rconstantvalue = 0.0
134 logical (c_bool) :: lgridispersistent =
false
135 logical (c_bool) :: lgridhaschanged =
false
136 logical (c_bool) :: lperformfullinitialization =
true
137 logical (c_bool) :: lcreatelocalnetcdfarchive =
false
181 procedure :: do_not_allow_netcdf_grid_data_flipping &
255 if (
associated(this%pGrdNative))
call grid_destroy(this%pGrdNative)
256 if (
associated(this%pGrdBase))
call grid_destroy(this%pGrdBase)
259 nullify(this%pGrdNative)
260 nullify(this%pGrdBase)
273 character (len=*),
intent(in) :: sKeyword
275 this%sKeyword = skeyword
284 integer (c_int),
intent(in) :: iCol
285 integer (c_int),
intent(in) :: iRow
286 integer (c_int),
intent(out) :: iValue
288 if ( .not.
associated(this%pGrdBase) ) &
289 call die(
"Internal programming error--attempt to use null pointer", __file__, __line__)
291 if (icol <= ubound(this%pGrdBase%iData,1) .and. irow <= ubound(this%pGrdBase%iData,2) )
then
292 ivalue = this%pGrdBase%iData(icol, irow)
305 integer (c_int),
intent(in) :: iCol
306 integer (c_int),
intent(in) :: iRow
307 real (c_float),
intent(out) :: fValue
309 if ( .not.
associated(this%pGrdBase) ) &
310 call die(
"Internal programming error--attempt to use null pointer", __file__, __line__)
312 if (icol <= ubound(this%pGrdBase%iData,1) .and. irow <= ubound(this%pGrdBase%iData,2) )
then
313 fvalue = this%pGrdBase%rData(icol, irow)
328 character (len=*),
intent(in) :: sDescription
329 integer (c_int),
intent(in) :: iConstant
331 this%iConstantValue = iconstant
332 this%sDescription = trim(sdescription)
338 call this%nullify_pointers()
343 this%pGrdBase%sPROJ4_string = trim(
bnds%sPROJ4_string )
344 this%pGrdBase%sFilename =
"None: constant value entered from control file."
355 character (len=*),
intent(in) :: sDescription
356 real (c_float),
intent(in) :: rConstant
358 this%rConstantValue = rconstant
359 this%sDescription = trim(sdescription)
365 call this%nullify_pointers()
370 this%pGrdBase%sPROJ4_string = trim(
bnds%sPROJ4_string )
371 this%pGrdBase%sFilename =
"None: constant value entered from control file."
380 character (len=*),
intent(in) :: sDescription
381 character (len=*),
intent(in) :: sDateColumnName
382 character (len=*),
intent(in) :: sValueColumnName
383 character (len=*),
intent(in) :: sType
385 this%sDescription = trim(sdescription)
390 this%sDateColumnName = sdatecolumnname
391 this%sValueColumnName = svaluecolumnname
393 call this%nullify_pointers()
397 case (
"float",
"real" )
404 case (
"int",
"integer")
413 this%pGrdBase%sPROJ4_string =
bnds%sPROJ4_string
414 this%pGrdBase%sFilename =
"None: daily value found in table of values."
428 character (len=*),
intent(in) :: sDescription
429 character (len=*),
intent(in) :: sFileType
430 character (len=*),
intent(in) :: sFilename
431 integer (c_int) :: iDataType
432 character (len=*),
intent(in),
optional :: sPROJ4_string
434 if (
present(sproj4_string) )
then
435 this%sSourcePROJ4_string = trim(sproj4_string)
437 this%sSourcePROJ4_string =
bnds%sPROJ4_string
444 if ( scan(string=sfilename, set=
"%#") > 0 )
then
447 this%lGridIsPersistent =
true
448 this%sFilenameTemplate = trim( this%sSourceFilename )
453 this%lGridIsPersistent =
false
454 this%sFilenameTemplate =
""
458 this%sSourceFileType = sfiletype
459 this%iSourceFileType = this%get_filetype()
461 this%iSourceDataType = idatatype
462 this%iTargetDataType = idatatype
464 this%sDescription = trim(sdescription)
468 //
"Surfer grids are supported as static grid inputs (for now).", &
473 //
"real data types are supported as static grid inputs.", &
476 call this%nullify_pointers()
479 rx0=
bnds%fX_ll, ry0=
bnds%fY_ll, rgridcellsize=
bnds%fGridCellSize, idatatype=idatatype)
481 this%pGrdBase%sPROJ4_string =
bnds%sPROJ4_string
482 this%pGrdBase%sFilename = this%sSourceFilename
495 character (len=*),
intent(in) :: sDescription
496 integer (c_int),
intent(in) :: iDataType
497 character (len=*),
intent(in) :: sFilename
498 character (len=*),
intent(in),
optional :: sPROJ4_string
503 if (
present(sproj4_string) )
then
504 this%sSourcePROJ4_string = trim(sproj4_string)
506 this%sSourcePROJ4_string =
bnds%sPROJ4_string
523 this%lGridIsPersistent =
true
524 this%sFilenameTemplate = trim(sfilename)
536 call this%nullify_pointers()
539 rx0=
bnds%fX_ll, ry0=
bnds%fY_ll, rgridcellsize=
bnds%fGridCellSize, idatatype=idatatype)
541 this%pGrdBase%sPROJ4_string =
bnds%sPROJ4_string
542 this%pGrdBase%sFilename = this%sSourceFilename
544 this%sSourceFileType =
"NETCDF"
545 this%iSourceFileType = this%get_filetype()
547 this%iTargetDataType = idatatype
557 type (DATETIME_T),
optional :: dt
585 call assert(
false,
"Unsupported data source specified", &
592 if ( this%lGridHasChanged )
then
598 dusersuboffset=this%dUserSubOffset, &
599 duserscalefactor=this%dUserScaleFactor, &
600 duseraddoffset=this%dUserAddOffset )
605 dusersuboffset=this%dUserSubOffset, &
606 duserscalefactor=this%dUserScaleFactor, &
607 duseraddoffset=this%dUserAddOffset )
611 call die(
"Unsupported data type specified", __file__, __line__)
623 real (c_float),
intent(inout) :: fresult
624 real (c_float),
intent(in) :: fvalue
625 real (c_double),
intent(in) :: duserscalefactor
626 real (c_double),
intent(in) :: dusersuboffset
627 real (c_double),
intent(in) :: duseraddoffset
629 fresult = real(( (fvalue - dusersuboffset) * duserscalefactor ) + duseraddoffset, c_float)
637 integer (c_int),
intent(inout) :: iresult
638 integer (c_int),
intent(in) :: ivalue
639 real (c_double),
intent(in) :: duserscalefactor
640 real (c_double),
intent(in) :: dusersuboffset
641 real (c_double),
intent(in) :: duseraddoffset
643 iresult = int(( ( real( ivalue, c_float) - dusersuboffset ) * duserscalefactor ) + duseraddoffset, c_int)
653 if ( .not.
associated(this%pGrdBase) ) &
654 call die(
"Internal programming error--attempt to use null pointer", __file__, __line__)
656 select case (this%iSourceDataType)
660 this%lGridHasChanged =
true
662 this%pGrdBase%rData = this%rConstantValue
666 this%lGridHasChanged =
true
668 this%pGrdBase%iData = this%iConstantValue
674 call assert(
false,
"INTERNAL PROGRAMMING ERROR - Unhandled data type: " &
675 //
"name="//
dquote(this%sDescription) &
676 //
"; value="//trim(
ascharacter(this%iSourceDataType)), &
688 type (DATETIME_T),
intent(in) :: dt
690 integer (c_int) :: indx
692 integer (c_int) :: status_code
695 type (FSTRING_LIST_T) :: slDateValues
697 if ( .not.
associated(this%pGrdBase) ) &
698 call die(
"Internal programming error--attempt to use null pointer", __file__, __line__)
700 if ( .not. this%lTableValuesHaveBeenRetrieved )
then
702 this%lTableValuesHaveBeenRetrieved =
true
705 select case (this%iSourceDataType)
709 call params%get_parameters(skey=
"date", slvalues=sldatevalues)
711 n = sldatevalues%count
715 allocate(this%table_dates(n), stat=status_code)
716 allocate(this%table_values_real(n), stat=status_code)
718 call this%table_dates(1)%setDateFormat(this%sDefaultDateFormat)
720 call params%get_parameters(skey=this%sValueColumnName, fvalues=this%table_values_real)
722 if ( (
size( this%table_values_real,1) /= n) &
723 .or. (
size( this%table_values_real,1) == 1 ) ) &
724 call die(
"Did not find values associated with a required table entry ("//
squote(this%sValueColumnName)//
"). ", &
728 call this%table_dates(indx)%parseDate(sldatevalues%get(indx),__file__, __line__)
738 call assert(
false,
"INTERNAL PROGRAMMING ERROR - Unhandled data type: " &
739 //
"name="//
dquote(this%sDescription) &
740 //
"; value="//trim(
ascharacter(this%iSourceDataType)), &
749 if ( this%table_indx < lbound(this%table_dates,1))
exit
750 if ( this%table_indx > ubound(this%table_dates,1))
exit
752 if (this%table_dates(this%table_indx) < dt)
then
753 this%table_indx = this%table_indx + 1
754 elseif (this%table_dates(this%table_indx) > dt)
then
755 this%table_indx = this%table_indx - 1
762 if ( this%table_dates(this%table_indx) == dt )
then
764 select case (this%iSourceDataType)
768 this%lGridHasChanged =
true
770 this%pGrdBase%rData = this%table_values_real(this%table_indx)
778 call assert(
false,
"INTERNAL PROGRAMMING ERROR - Unhandled data type: " &
779 //
"name="//
dquote(this%sDescription) &
780 //
"; value="//trim(
ascharacter(this%iSourceDataType)), &
787 call die(
"Missing or out-of-order value supplied for "//
squote(this%sValueColumnName), &
800 call logs%write(
"---------------------------------------------------")
801 call logs%write(
"DATA STRUCTURE DETAILS:")
802 call logs%write(
"---------------------------------------------------")
804 call logs%write(
" catalog key word: "//
dquote( this%sKeyWord ) )
806 call logs%write(
" source data form: "//trim(
ascharacter(this%iSourceDataForm)) )
807 call logs%write(
" source data type: "//trim(
ascharacter(this%iSourceDataType)) )
808 call logs%write(
" source file type: "//trim(
ascharacter(this%iSourceFileType)) )
809 call logs%write(
" description: "//trim(this%sDescription) )
810 call logs%write(
" source PROJ4 string: "//trim(this%sSourcePROJ4_string) )
811 call logs%write(
" source file type: "//trim(this%sSourceFileType) )
812 call logs%write(
" filename template: "//trim(this%sFilenameTemplate) )
813 call logs%write(
" source filename: "//trim(this%sSourceFilename) )
825 type (DATETIME_T),
optional :: dt
829 this%lGridHasChanged =
false
834 this%iSourceFileType ==
filetype_surfer,
"INTERNAL PROGRAMMING ERROR -" &
835 //
" improper file type in use for a call to this subroutine", &
840 if(.not.
present(dt) ) &
841 call assert(
false,
"INTERNAL PROGRAMMING ERROR - datetime object" &
842 //
" must be supplied when calling this subroutine in a " &
843 //
"dynamic mode.", __file__, __line__)
846 call this%make_filename(dt)
851 if ( this%sOldFilename .strequal. this%sSourceFilename )
exit
853 this%sOldFilename = this%sSourceFilename
855 inquire(file=this%sSourceFilename, exist=lexist, opened=lopened)
858 if (.not. lexist )
then
859 if ( this%lAllowMissingFiles )
then
863 "Could not find input data file~filename:"//
dquote(this%sSourceFilename) &
864 //
"~data description: "//trim(this%sDescription))
868 call logs%write(
"Opening file "//
dquote(this%sSourceFilename) &
869 //
" for "//trim(this%sDescription)//
" data.", iloglevel=
log_all, lecho=
true )
871 if ( this%lGridIsPersistent .and.
associated(this%pGrdNative) )
then
874 sfiletype=this%sSourceFileType, &
875 pgrd=this%pGrdNative )
879 this%pGrdNative =>
grid_read( sfilename=this%sSourceFilename, &
880 sfiletype=this%sSourceFileType, &
881 idatatype=this%iSourceDataType )
884 this%pGrdNative%sPROJ4_string = this%sSourcePROJ4_string
887 this%lGridHasChanged =
true
889 select case (this%iTargetDataType)
893 call this%handle_missing_values(this%pGrdNative%rData)
894 call this%enforce_limits(this%pGrdNative%rData)
903 call assert(
false,
"INTERNAL PROGRAMMING ERROR - Unhandled data type: value=" &
909 call this%transform_native_to_base()
911 if ( .not. this%lGridIsPersistent )
call grid_destroy( this%pGrdNative )
924 real (c_double),
optional :: rX(:)
925 real (c_double),
optional :: rY(:)
927 if (.not.
associated(this%pGrdNative) ) &
928 call die(
"INTERNAL PROGRAMMING ERROR--Null pointer detected.", __file__, __line__)
930 if ( .not.
associated(this%pGrdBase) ) &
932 rgridcellsize=
bnds%fGridCellSize, idatatype=this%iTargetDataType )
935 if (.not. ( this%pGrdNative%sPROJ4_string .strequal. this%pGrdBase%sPROJ4_string ) )
then
937 call logs%write(
"Transforming gridded data in file: "//
dquote(this%sSourceFilename), ilinesbefore=1 )
938 call logs%write(
"FROM: "//
squote(this%sSourcePROJ4_string), itab=2 )
939 call logs%write(
"TO: "//
squote(this%pGrdBase%sPROJ4_string), itab=2 )
941 if (
present(rx) .and.
present(ry))
then
943 sfromproj4=this%sSourcePROJ4_string, &
944 stoproj4=
bnds%sPROJ4_string, &
949 sfromproj4=this%sSourcePROJ4_string, &
950 stoproj4=
bnds%sPROJ4_string )
958 if ( this%lRequireCompleteSpatialCoverage ) &
960 "Transformed grid read from file "//
dquote(this%sSourceFilename) &
961 //
" does not completely cover your model domain.")
963 select case (this%iTargetDataType)
968 pgrdto=this%pGrdBase )
973 pgrdto=this%pGrdBase, &
974 lusemajorityfilter=this%lUseMajorityFilter )
978 call assert(
false,
"INTERNAL PROGRAMMING ERROR - Unhandled data type: value=" &
992 integer (c_int) :: iValue
994 this%iConstantValue = ivalue
1003 real (c_float) :: rValue
1005 this%rConstantValue = rvalue
1014 integer (c_int) :: iValue
1015 integer (c_int),
optional :: iYear
1017 this%iFileCount = ivalue
1019 if (
present(iyear) ) this%iFileCountYear = iyear
1029 this%iFileCount = this%iFileCount + 1
1048 integer (c_int) :: iYear
1050 if (iyear /= this%iFileCountYear )
then
1052 this%iFileCountYear = iyear
1062 type (DATETIME_T),
intent(in),
optional :: dt
1065 character (len=512) :: sNewFilename
1066 character (len=256) :: sCWD
1067 character (len=256) :: sBuf2
1068 integer (c_int) :: iPos_Y, iPos_D, iPos_M, iPos_0D, iPos_0M, iPos_B, &
1069 iPos_BF, iPos_j, iPos, iPos2, iLen, iCount
1070 integer (c_int) :: iNumZeros, iNumZerosToPrint
1071 logical (c_bool) :: lMatch
1072 character (len=16) :: sBuf
1073 character (len=12) :: sNumber
1074 character (len=1) :: sDelimiter
1075 logical (c_bool) :: lAnnual
1077 ipos_y = 0; ipos_m = 0; ipos_d = 0; ipos = 0; ipos_b = 0; ipos_bf = 0; snumber =
""
1090 snewfilename = this%sFilenameTemplate
1098 ipos_y = max(index(snewfilename,
"%Y"), index(snewfilename,
"%y") )
1100 if (ipos_y > 0)
then
1102 ilen=len_trim(snewfilename)
1103 snewfilename = snewfilename(1:ipos_y - 1)//trim(
ascharacter(dt%iYear)) &
1104 //snewfilename(ipos_y + 2:ilen)
1111 ipos = index(snewfilename,
"#")
1117 ipos2 = index(snewfilename(1:ipos),
"%", back=
true)
1119 inumzeros = max(0, ipos - ipos2 - 1)
1121 if (inumzeros > 0)
then
1122 inumzerostoprint = max(0,inumzeros - len_trim(sbuf2) + 1)
1123 snumber = repeat(
"0", inumzerostoprint )//trim(sbuf2)
1125 snumber = trim(sbuf2)
1130 ilen=len_trim(snewfilename)
1131 snewfilename = snewfilename(1:ipos-2-inumzeros)//trim(snumber) &
1132 //snewfilename(ipos+1:ilen)
1137 ipos_m = index(snewfilename,
"%m")
1138 ipos_0m = index(snewfilename,
"%0m")
1139 ipos_b = index(snewfilename,
"%b")
1140 ipos_bf = index(snewfilename,
"%B")
1142 if ( ipos_0m > 0 )
then
1146 write (unit=sbuf, fmt=
"(i2.2)") dt%iMonth
1148 ilen=len_trim(snewfilename)
1149 snewfilename = snewfilename(1:ipos_0m - 1)//trim(sbuf) &
1150 //snewfilename(ipos_0m + 3:ilen)
1152 elseif ( ipos_m > 0 )
then
1158 ilen=len_trim(snewfilename)
1159 snewfilename = snewfilename(1:ipos_m - 1)//trim(sbuf) &
1160 //snewfilename(ipos_m + 2:ilen)
1162 elseif ( ipos_b > 0 )
then
1167 select case ( this% iFilename_Monthname_Capitalization_Rule )
1171 sbuf =
months( dt%iMonth )%sName
1176 sbuf =
months( dt%iMonth )%sName
1181 sbuf =
months( dt%iMonth )%sName
1185 ilen=len_trim(snewfilename)
1186 snewfilename = snewfilename(1:ipos_b - 1)//trim(sbuf) &
1187 //snewfilename(ipos_b + 2:ilen)
1189 elseif ( ipos_bf > 0 )
then
1194 select case ( this% iFilename_Monthname_Capitalization_Rule )
1198 sbuf =
months( dt%iMonth )%sFullName
1203 sbuf =
months( dt%iMonth )%sFullName
1208 sbuf =
months( dt%iMonth )%sFullName
1212 ilen=len_trim(snewfilename)
1213 snewfilename = snewfilename(1:ipos_bf - 1)//trim(sbuf) &
1214 //snewfilename( ( ipos_bf + len_trim(sbuf) - 1):ilen)
1219 ipos_j = max(index(snewfilename,
"%J"),index(snewfilename,
"%j") )
1221 if (ipos_j > 0)
then
1224 write (unit=sbuf, fmt=
"(i3.3)") dt%getDayOfYear()
1225 ilen=len_trim(snewfilename)
1226 snewfilename = snewfilename(1:ipos_j - 1)//trim(sbuf) &
1227 //snewfilename(ipos_j + 2:ilen)
1233 ipos_d = max(index(snewfilename,
"%D"),index(snewfilename,
"%d") )
1234 ipos_0d = max(index(snewfilename,
"%0D"), index(snewfilename,
"%0d") )
1236 if (ipos_0d > 0)
then
1239 write (unit=sbuf, fmt=
"(i2.2)") dt%iDay
1240 ilen=len_trim(snewfilename)
1241 snewfilename = snewfilename(1:ipos_0d - 1)//trim(sbuf) &
1242 //snewfilename(ipos_0d + 3:ilen)
1244 elseif ( ipos_d > 0 )
then
1250 ilen=len_trim(snewfilename)
1251 snewfilename = snewfilename(1:ipos_d - 1)//trim(sbuf) &
1252 //snewfilename(ipos_d + 2:ilen)
1256 if (.not. lmatch)
exit
1261 if (icount > 4)
exit
1265 if( index(string=scwd, substring=
forwardslash) > 0 )
then
1272 this%sSourceFilename = trim(snewfilename)
1274 this%lIsAnnualGrid = lannual
1287 integer (c_int) :: idaysleftinmonth
1288 integer (c_int) :: ipos
1289 logical (c_bool) :: lneedtopaddata
1293 lneedtopaddata =
false
1295 ipos = scan(string=trim(this%sSourceFilename), set=
"http://")
1299 if (this%sSourceFilename(ipos:ipos+6) ==
"http://")
then
1306 inquire( file=this%sSourceFilename, exist=lexist )
1311 if ( lexist .and. ( .not. this%lIsAnnualGrid ) )
exit
1315 if (dt%iMonth == 12 )
then
1317 idaysleftinmonth = 31 - dt%iDay
1319 if ( dt%isLeapYear() )
then
1321 if ( idaysleftinmonth <= this%iDaysToPadIfLeapYear )
then
1323 lneedtopaddata =
true
1330 if ( idaysleftinmonth <= this%iDaysToPadAtYearsEnd )
then
1332 lneedtopaddata =
true
1343 call assert(lexist,
"The filename created from your template refers to " &
1344 //
"a nonexistent file. ~ Attempted to open filename "&
1345 //
dquote(this%sSourceFilename), __file__, __line__)
1360 type (DATETIME_T),
intent(in) :: dt
1363 logical (c_bool) :: lDateTimeFound
1364 real (c_double) :: dAddOffset
1365 real (c_double) :: dScaleFactor
1366 integer (c_int) :: iMonth
1367 integer (c_int) :: iDay
1368 integer (c_int) :: iYear
1370 if ( .not.
associated(this%pGrdBase) ) &
1371 call die(
"Internal programming error--attempt to use null pointer", __file__, __line__)
1373 this%lPadValues =
false
1376 if ( this%iFileCountYear < 0 )
call this%set_filecount(-1, dt%iYear)
1386 ijulianday=int(dt%iJulianDay, c_int) ) )
then
1398 call this%increment_filecount()
1401 call this%reset_at_yearend_filecount(dt%iYear)
1405 call this%make_filename( dt )
1407 this%lPadValues = this%test_for_need_to_pad_values(dt)
1414 if (.not. this%lPadValues)
then
1416 if (this%lPerformFullInitialization )
then
1418 if( ( len_trim( this%sSourcePROJ4_string ) > 0 ) &
1419 .and. ( .not. ( this%sSourcePROJ4_string .strequal.
"<NA>") ) )
then
1423 call this%calc_project_boundaries(pgrdbase=this%pGrdBase)
1425 if ( this%lRequireCompleteSpatialCoverage )
then
1428 sfilename=this%sSourceFilename, &
1429 lfliphorizontal=this%lFlipHorizontal, &
1430 lflipvertical=this%lFlipVertical, &
1431 lallowautomaticdataflipping=this%lAllowAutomaticDataFlipping, &
1432 rx_coord_addoffset = this%rX_Coord_AddOffset, &
1433 ry_coord_addoffset = this%rY_Coord_AddOffset, &
1434 svariableorder=this%sVariableOrder, &
1435 svarname_x=this%sVariableName_x, &
1436 svarname_y=this%sVariableName_y, &
1437 svarname_z=this%sVariableName_z, &
1438 svarname_time=this%sVariableName_time, &
1439 rcoordinatetolerance=this%rCoordinateTolerance, &
1440 tgridbounds=this%GRID_BOUNDS_NATIVE )
1445 sfilename=this%sSourceFilename, &
1446 lfliphorizontal=this%lFlipHorizontal, &
1447 lflipvertical=this%lFlipVertical, &
1448 lallowautomaticdataflipping=this%lAllowAutomaticDataFlipping, &
1449 rx_coord_addoffset = this%rX_Coord_AddOffset, &
1450 ry_coord_addoffset = this%rY_Coord_AddOffset, &
1451 svariableorder=this%sVariableOrder, &
1452 svarname_x=this%sVariableName_x, &
1453 svarname_y=this%sVariableName_y, &
1454 svarname_z=this%sVariableName_z, &
1455 svarname_time=this%sVariableName_time, &
1456 rcoordinatetolerance=this%rCoordinateTolerance )
1465 sfilename=this%sSourceFilename, &
1466 lfliphorizontal=this%lFlipHorizontal, &
1467 lflipvertical=this%lFlipVertical, &
1468 lallowautomaticdataflipping=this%lAllowAutomaticDataFlipping, &
1469 svariableorder=this%sVariableOrder, &
1470 svarname_x=this%sVariableName_x, &
1471 svarname_y=this%sVariableName_y, &
1472 svarname_z=this%sVariableName_z, &
1473 rcoordinatetolerance=this%rCoordinateTolerance, &
1474 svarname_time=this%sVariableName_time )
1476 this%NCFILE%iNX = this%pGrdBase%iNX
1477 this%NCFILE%iNY = this%pGrdBase%iNY
1478 this%NCFILE%rX(
nc_left) = this%pGrdBase%rX0
1479 this%NCFILE%rY(
nc_bottom) = this%pGrdBase%rY0
1480 this%NCFILE%rX(
nc_right) = this%pGrdBase%rX1
1481 this%NCFILE%rY(
nc_top) = this%pGrdBase%rY1
1485 this%rX_coordinate_subset = this%NCFILE%rX_Coords(this%NCFILE%iColBounds(
nc_left):this%NCFILE%iColBounds(
nc_right))
1486 this%rY_coordinate_subset = this%NCFILE%rY_Coords(this%NCFILE%iRowBounds(
nc_top):this%NCFILE%iRowBounds(
nc_bottom))
1496 this%iSourceDataType = this%NCFILE%iVarType(
nc_z)
1502 if (
associated(this%pGrdNative) )
call grid_destroy (this%pGrdNative)
1504 this%pGrdNative =>
grid_create( inx=this%NCFILE%iNX, &
1505 iny=this%NCFILE%iNY, &
1506 rx0=this%NCFILE%rX(
nc_left), &
1509 ry1=this%NCFILE%rY(
nc_top), &
1510 idatatype=this%iTargetDataType )
1523 if( len_trim( this%sSourcePROJ4_string ) > 0 )
then
1525 this%pGrdNative%sPROJ4_string = this%sSourcePROJ4_string
1528 this%pGrdNative%sFilename = this%sSourceFilename
1533 this%lPerformFullInitialization =
false
1545 ijulianday=int(dt%iJulianDay, c_int) ) )
then
1549 elseif ( scan(this%sSourceFilename,
"#") /= 0 )
then
1553 call logs%write(
"Did not find the current date in the file "//
dquote(this%sSourceFilename)//
"~" &
1555 //
"~current JD: "//
ascharacter(dt%iJulianDay)//
"~ Will increment sequential file number and try again.", &
1556 ilinesbefore=1, ilinesafter=1 )
1560 call gregorian_date(this%NCFILE%iFirstDayJD,iyear, imonth, iday )
1561 call logs%write(
"NetCDF start date: "//trim(
ascharacter(imonth,
"i2.2")) &
1566 call logs%write(
"NetCDF end date: "//trim(
ascharacter(imonth,
"i2.2")) &
1569 call gregorian_date(int(dt%iJulianDay, c_int),iyear, imonth, iday )
1570 call logs%write(
"Current SWB simulation date: "//trim(
ascharacter(imonth,
"i2.2")) &
1573 call assert (
false,
"Date range for currently open NetCDF file" &
1574 //
" does not include the current simulation date.", &
1587 if (.not. this%lPadValues)
then
1591 ijulianday=int(dt%iJulianDay, c_int) )
1593 if (.not. ldatetimefound)
then
1594 this%lPadValues =
true
1599 this%lGridHasChanged =
true
1605 daddoffset = this%NCFILE%rAddOffset(
nc_z)
1606 dscalefactor = this%NCFILE%rScaleFactor(
nc_z)
1608 this%pGrdNative%rData = real(this%pGrdNative%rData * dscalefactor + daddoffset, c_float)
1610 call this%handle_missing_values(this%pGrdNative%rData)
1611 call this%enforce_limits(this%pGrdNative%rData)
1617 if (this%lPadValues)
then
1619 if (this%lPadReplaceWithZero)
then
1621 this%pGrdNative%rData = 0_c_float
1622 this%pGrdNative%iData = 0_c_int
1626 call logs%write( repeat(
"=", 60) )
1627 call logs%write(
"Missing day found in NetCDF file - padding values" )
1628 call logs%write( repeat(
"=", 60) )
1632 if (this%lCreateLocalNetCDFArchive) &
1633 call this%put_values_to_archive(int(dt%iMonth,c_int), &
1634 int(dt%iDay,c_int), dt%iYear)
1636 call this%transform_native_to_base( rx=this%rX_coordinate_subset, &
1637 ry=this%rY_coordinate_subset)
1650 real (c_double) :: dAddOffset
1651 real (c_double) :: dScaleFactor
1653 if ( .not.
associated(this%pGrdBase) ) &
1654 call die(
"Internal programming error--attempt to use null pointer", __file__, __line__)
1658 if (this%lPerformFullInitialization )
then
1660 if( ( len_trim( this%sSourcePROJ4_string ) > 0 ) &
1661 .and. ( .not. ( this%sSourcePROJ4_string .strequal.
"<NA>") ) )
then
1665 call this%calc_project_boundaries(pgrdbase=this%pGrdBase)
1667 if ( this%lRequireCompleteSpatialCoverage )
then
1669 sfilename=this%sSourceFilename, &
1670 lfliphorizontal=this%lFlipHorizontal, &
1671 lflipvertical=this%lFlipVertical, &
1672 svariableorder=this%sVariableOrder, &
1673 svarname_x=this%sVariableName_x, &
1674 svarname_y=this%sVariableName_y, &
1675 svarname_z=this%sVariableName_z, &
1676 svarname_time=this%sVariableName_time, &
1677 tgridbounds=this%GRID_BOUNDS_NATIVE )
1680 sfilename=this%sSourceFilename, &
1681 lfliphorizontal=this%lFlipHorizontal, &
1682 lflipvertical=this%lFlipVertical, &
1683 svariableorder=this%sVariableOrder, &
1684 svarname_x=this%sVariableName_x, &
1685 svarname_y=this%sVariableName_y, &
1686 svarname_z=this%sVariableName_z, &
1687 svarname_time=this%sVariableName_time )
1695 sfilename=this%sSourceFilename, &
1696 lfliphorizontal=this%lFlipHorizontal, &
1697 lflipvertical=this%lFlipVertical, &
1698 svariableorder=this%sVariableOrder, &
1699 svarname_x=this%sVariableName_x, &
1700 svarname_y=this%sVariableName_y, &
1701 svarname_z=this%sVariableName_z, &
1702 svarname_time=this%sVariableName_time )
1704 this%NCFILE%iNX = this%pGrdBase%iNX
1705 this%NCFILE%iNY = this%pGrdBase%iNY
1706 this%NCFILE%rX(
nc_left) = this%pGrdBase%rX0
1707 this%NCFILE%rY(
nc_bottom) = this%pGrdBase%rY0
1708 this%NCFILE%rX(
nc_right) = this%pGrdBase%rX1
1709 this%NCFILE%rY(
nc_top) = this%pGrdBase%rY1
1715 this%iSourceDataType = this%NCFILE%iVarType(
nc_z)
1721 if (
associated(this%pGrdNative) )
call grid_destroy (this%pGrdNative)
1723 this%pGrdNative =>
grid_create( inx=this%NCFILE%iNX, &
1724 iny=this%NCFILE%iNY, &
1725 rx0=this%NCFILE%rX(
nc_left), &
1728 ry1=this%NCFILE%rY(
nc_top), &
1729 idatatype=this%iTargetDataType )
1743 if( len_trim( this%sSourcePROJ4_string ) > 0 )
then
1745 this%pGrdNative%sPROJ4_string = this%sSourcePROJ4_string
1748 this%pGrdNative%sFilename = this%sSourceFilename
1753 this%lPerformFullInitialization =
false
1771 daddoffset = this%NCFILE%rAddOffset(
nc_z)
1772 dscalefactor = this%NCFILE%rScaleFactor(
nc_z)
1773 this%pGrdNative%rData = real(this%pGrdNative%rData * dscalefactor + daddoffset, c_float)
1775 call this%handle_missing_values(this%pGrdNative%rData)
1777 call this%enforce_limits(this%pGrdNative%rData)
1779 call this%transform_native_to_base( )
1788 integer (c_int) :: iMonth
1789 integer (c_int) :: iDay
1790 integer (c_int) :: iYear
1793 integer (c_size_t) :: iNumRows, iNumCols, iNumRecs
1798 ncfile_archive=this%NCFILE_ARCHIVE, &
1799 ioriginmonth=imonth, ioriginday=iday, ioriginyear=iyear, &
1800 istartyear=this%iStartYear, iendyear=this%iEndYear)
1806 inumrows = int(
size(this%pGrdNative%rData, 2), c_size_t)
1807 inumcols = int(
size(this%pGrdNative%rData, 1), c_size_t)
1808 inumrecs = this%iNCFILE_RECNUM
1811 ivarid=this%NCFILE_ARCHIVE%iVarID(
nc_z), &
1812 istart=[inumrecs, 0_c_size_t, 0_c_size_t], &
1813 icount=[1_c_size_t, inumrows, inumcols], &
1814 istride=[1_c_size_t,1_c_size_t,1_c_size_t], &
1815 rvalues=this%pGrdNative%rData)
1818 ivarid=this%NCFILE_ARCHIVE%iVarID(
nc_time), &
1819 istart=[this%iNCFILE_RECNUM], &
1820 icount=[1_c_size_t], &
1821 istride=[1_c_size_t], &
1822 rvalues=[real(this%iNCFILE_RECNUM, c_float)])
1824 this%iNCFILE_RECNUM = this%iNCFILE_RECNUM + 1
1833 integer (c_int) :: ifiletype
1837 if ( (this%sSourceFileType .strequal.
"ARC_GRID") &
1838 .or. (this%sSourceFileType .strequal.
"ARC_ASCII") )
then
1842 elseif ( this%sSourceFileType .strequal.
"SURFER" )
then
1846 elseif ( this%sSourceFileType .strequal.
"NETCDF" )
then
1852 call assert(
false,
"Unknown input file type specified. ~"&
1853 //
" filename: "//
dquote(this%sSourceFilename) &
1854 //
"~ file type specified as: "//
dquote(this%sSourceFileType), &
1866 character (len=*),
optional :: sPROJ4_string
1868 this%sSourcePROJ4_string = sproj4_string
1877 character (len=*),
optional :: sPROJ4_string
1879 this%sTargetPROJ4_string = sproj4_string
1889 this%lAllowAutomaticDataFlipping =
false
1899 this%lFlipHorizontal =
true
1909 this%lFlipVertical =
true
1919 this%lAllowMissingFiles =
true
1928 character (len=*) :: sVariableOrder
1930 this%sVariableOrder = svariableorder
1939 real (c_double) :: dScaleFactor
1941 this%dUserScaleFactor = dscalefactor
1950 logical (c_bool) :: lValue
1952 this%lCreateLocalNetCDFArchive = lvalue
1961 real (c_double) :: rXOffset
1963 this%rX_Coord_AddOffset = rxoffset
1972 real (c_double) :: rYOffset
1974 this%rY_Coord_AddOffset = ryoffset
1983 real (c_double) :: rCoordinateTolerance
1985 this%rCoordinateTolerance = rcoordinatetolerance
1994 real (c_double) :: dAddOffset
1996 this%dUserAddOffset = daddoffset
2005 real (c_double) :: dSubOffset
2007 this%dUserSubOffset = dsuboffset
2016 logical (c_bool) :: lUseMajorityFilter
2018 this%lUseMajorityFilter = lusemajorityfilter
2030 logical (c_bool),
intent(in) :: lRequireCompleteSpatialCoverage
2032 this%lRequireCompleteSpatialCoverage = lrequirecompletespatialcoverage
2041 integer (c_int) :: iMinVal
2043 this%iMinAllowedValue = iminval
2052 integer (c_int) :: iMaxVal
2054 this%iMaxAllowedValue = imaxval
2063 real (c_float) :: rMinVal
2065 this%rMinAllowedValue = rminval
2074 real (c_float) :: rMaxVal
2076 this%rMaxAllowedValue = rmaxval
2085 type ( GENERAL_GRID_T ),
pointer :: pGrdBase
2088 integer (c_int) :: iRetVal
2089 real (c_double),
dimension(4) :: rX, rY
2092 rx(1) = pgrdbase%rX0
2093 ry(1) = pgrdbase%rY0
2094 rx(2) = pgrdbase%rX1
2095 ry(2) = pgrdbase%rY0
2096 rx(3) = pgrdbase%rX0
2097 ry(3) = pgrdbase%rY1
2098 rx(4) = pgrdbase%rX1
2099 ry(4) = pgrdbase%rY1
2102 if ( .not. trim( pgrdbase%sPROJ4_string) == trim(this%sSourcePROJ4_string))
then
2108 trim(this%sSourcePROJ4_string)//c_null_char, &
2109 __file__//c_null_char, &
2115 sfromproj4=trim(pgrdbase%sPROJ4_string), &
2116 stoproj4=trim(this%sSourcePROJ4_string))
2126 if ( ( this%sSourcePROJ4_string .containssimilar.
"latlon" ) &
2127 .or. ( this%sSourcePROJ4_string .containssimilar.
"latlong" ) &
2128 .or. ( this%sSourcePROJ4_string .containssimilar.
"lonlat" ) &
2129 .or. ( this%sSourcePROJ4_string .containssimilar.
"longlat" ) )
then
2138 this%GRID_BOUNDS_NATIVE%rXll = rx(1); this%GRID_BOUNDS_NATIVE%rXlr = rx(2)
2139 this%GRID_BOUNDS_NATIVE%rYll = ry(1); this%GRID_BOUNDS_NATIVE%rYlr = ry(2)
2140 this%GRID_BOUNDS_NATIVE%rXul = rx(3); this%GRID_BOUNDS_NATIVE%rXur = rx(4)
2141 this%GRID_BOUNDS_NATIVE%rYul = ry(3); this%GRID_BOUNDS_NATIVE%rYur = ry(4)
2145 print *,
" routine 'calc_project_boundaries'"
2146 print *, trim(__file__),
": ", __line__
2147 print *,
"-- BASE GRID BOUNDS projected to DATA NATIVE COORDS"
2148 print *,
"FROM: ",
dquote(pgrdbase%sPROJ4_string)
2149 print *,
"TO: ",
dquote(this%sSourcePROJ4_string)
2150 print *,
"file: ",
dquote(this%sSourceFileName)
2152 print *,
"LL: ", this%GRID_BOUNDS_NATIVE%rXll, this%GRID_BOUNDS_NATIVE%rYll
2153 print *,
"LR: ", this%GRID_BOUNDS_NATIVE%rXlr, this%GRID_BOUNDS_NATIVE%rYlr
2154 print *,
"UL: ", this%GRID_BOUNDS_NATIVE%rXul, this%GRID_BOUNDS_NATIVE%rYul
2155 print *,
"UR: ", this%GRID_BOUNDS_NATIVE%rXur, this%GRID_BOUNDS_NATIVE%rYur
2165 integer (c_int),
dimension(:,:) :: iValues
2168 integer (c_int) :: iMin, iMax
2170 imin = this%iMinAllowedValue
2171 imax = this%iMaxAllowedValue
2173 where ( ivalues < imin ) ivalues = imin
2174 where ( ivalues > imax ) ivalues = imax
2183 real (c_float),
dimension(:,:) :: rValues
2186 real (c_float) :: rMin, rMax
2188 rmin = real(this%rMinAllowedValue, c_float)
2189 rmax = real(this%rMaxAllowedValue, c_float)
2191 where ( rvalues < rmin ) rvalues = rmin
2192 where ( rvalues > rmax ) rvalues = rmax
2201 real (c_float),
dimension(:,:),
intent(inout) :: rValues
2204 real (c_float) :: rMissing, rMean
2206 rmissing = real(this%rMissingValuesCode, c_float)
2211 if ( trim(this%sMissingValuesOperator) .ne.
"&&" )
then
2213 select case (this%iMissingValuesAction)
2217 select case (trim(this%sMissingValuesOperator))
2221 where (rvalues <= rmissing) rvalues =
rzero
2225 where (rvalues < rmissing) rvalues =
rzero
2229 where (rvalues >= rmissing) rvalues =
rzero
2233 where (rvalues > rmissing) rvalues =
rzero
2237 call assert(
false,
"Unknown missing values code was supplied " &
2238 //
"for processing data "//
squote(this%sDescription)//
": " &
2239 //
dquote(this%sMissingValuesOperator) )
2245 select case (this%sMissingValuesOperator)
2249 rmean = sum(rvalues, rvalues > rmissing ) / count(rvalues > rmissing )
2251 where (rvalues <= rmissing) rvalues = rmean
2255 rmean = sum(rvalues, rvalues >= rmissing ) / count(rvalues >= rmissing )
2257 where (rvalues < rmissing) rvalues = rmean
2261 rmean = sum(rvalues, rvalues < rmissing ) / count(rvalues < rmissing )
2263 where (rvalues >= rmissing) rvalues = rmean
2267 rmean = sum(rvalues, rvalues <= rmissing ) / count(rvalues <= rmissing )
2269 where (rvalues > rmissing) rvalues = rmean
2273 call assert(
false,
"Unknown missing values code was supplied " &
2274 //
"for processing data "//
squote(this%sDescription)//
": " &
2275 //
dquote(this%sMissingValuesOperator) )
2281 call assert(
false,
"INTERNAL PROGRAMMING ERROR - unhandled iMissingValuesAction", &
2294 integer (c_int),
dimension(:,:),
intent(inout) :: iValues
2297 integer (c_int) :: iMissing, iMean
2299 imissing = this%iMissingValuesCode
2300 if ( trim(this%sMissingValuesOperator) .ne.
"&&" )
then
2302 select case (this%iMissingValuesAction)
2306 select case (trim(this%sMissingValuesOperator))
2310 where (ivalues <= imissing) ivalues =
izero
2314 where (ivalues < imissing) ivalues =
izero
2318 where (ivalues >= imissing) ivalues =
izero
2322 where (ivalues > imissing) ivalues =
izero
2326 call assert(
false,
"Unknown missing values code was supplied " &
2327 //
"for processing data "//
squote(this%sDescription)//
": " &
2328 //
dquote(this%sMissingValuesOperator) )
2334 select case (this%sMissingValuesOperator)
2338 imean = sum(ivalues, ivalues > imissing ) &
2339 / count(ivalues > imissing )
2341 where (ivalues <= imissing) ivalues = imean
2345 imean = sum(ivalues, ivalues >= imissing ) &
2346 / count(ivalues >= imissing )
2348 where (ivalues < imissing) ivalues = imean
2352 imean = sum(ivalues, ivalues < imissing ) &
2353 / count(ivalues < imissing )
2355 where (ivalues >= imissing) ivalues = imean
2359 imean = sum(ivalues, ivalues <= imissing ) &
2360 / count(ivalues <= imissing )
2362 where (ivalues > imissing) ivalues = imean
2366 call assert(
false,
"Unknown missing values code was supplied " &
2367 //
"for processing data "//
squote(this%sDescription)//
": " &
2368 //
dquote(this%sMissingValuesOperator) )
2374 call assert(
false,
"INTERNAL PROGRAMMING ERROR - unhandled iMissingValuesAction", &
This module contains physical constants and convenience functions aimed at performing unit conversion...
logical(c_bool), parameter, public true
integer(c_int), parameter izero
type(bounds_t), public bnds
real(c_float), parameter, public rzero
integer(c_int), parameter datatype_real
logical(c_bool), parameter, public false
real(c_float), parameter, public rbigval
integer(c_int), parameter datatype_int
integer(c_int), parameter datatype_na
integer(c_int), parameter, public ibigval
subroutine initialize_gridded_data_object_sub(this, sdescription, sfiletype, idatatype, sfilename, sproj4_string)
subroutine set_coordinate_tolerance_sub(this, rcoordinatetolerance)
subroutine data_gridhandlemissingdata_real(this, rvalues)
subroutine set_minimum_allowable_value_real_sub(this, rminval)
integer(c_int), parameter filetype_ascii_table
integer(c_int), parameter static_grid
subroutine set_majority_filter_flag_sub(this, lusemajorityfilter)
subroutine getvalues_dynamic_netcdf_sub(this, dt)
subroutine data_gridhandlemissingdata_int(this, ivalues)
subroutine make_filename_from_template(this, dt)
integer(c_int), parameter table_lookup
type(general_grid_t), pointer, public pgrd
subroutine transform_grid_to_grid_sub(this, rx, ry)
subroutine set_variable_order_sub(this, svariableorder)
subroutine nullify_pointers_sub(this)
subroutine get_value_float_sub(this, icol, irow, fvalue)
elemental subroutine apply_scale_and_offset_int(iresult, ivalue, duserscalefactor, dusersuboffset, duseraddoffset)
subroutine set_maximum_allowable_value_real_sub(this, rmaxval)
subroutine set_do_not_allow_netcdf_grid_data_flipping_sub(this)
subroutine set_y_coord_offset_sub(this, ryoffset)
subroutine get_value_int_sub(this, icol, irow, ivalue)
subroutine set_sub_offset_sub(this, dsuboffset)
subroutine set_maximum_allowable_value_int_sub(this, imaxval)
integer(c_int), parameter, public missing_values_replace_with_mean
subroutine set_x_coord_offset_sub(this, rxoffset)
subroutine initialize_netcdf_data_object_sub(this, sdescription, idatatype, sfilename, sproj4_string)
subroutine set_filecount(this, ivalue, iyear)
subroutine calc_project_boundaries_sub(this, pgrdbase)
subroutine set_keyword_sub(this, skeyword)
subroutine set_target_proj4_string_sub(this, sproj4_string)
integer(c_int), parameter, public file_template_uppercase_monthname
subroutine data_gridenforcelimits_real(this, rvalues)
integer(c_int), parameter, public dynamic_grid
subroutine set_complete_spatial_coverage_flag_sub(this, lrequirecompletespatialcoverage)
subroutine getvalues_gridded_sub(this, dt)
subroutine getvalues_from_lookup_table(this, dt)
subroutine data_gridenforcelimits_int(this, ivalues)
integer(c_int), parameter filetype_arc_ascii
integer(c_int), parameter, public missing_values_zero_out
integer(c_int), parameter static_netcdf_grid
integer(c_int), parameter, public netcdf_file_open
subroutine set_minimum_allowable_value_int_sub(this, iminval)
integer(c_int), parameter filetype_surfer
subroutine set_grid_flip_vertical_sub(this)
subroutine increment_filecount(this)
integer(c_int), parameter no_grid
integer(c_int), parameter filetype_none
integer(c_int), parameter filetype_netcdf
subroutine set_constant_value_real(this, rvalue)
subroutine put_values_to_local_netcdf_sub(this, imonth, iday, iyear)
integer(c_int), parameter, public netcdf_file_closed
elemental subroutine apply_scale_and_offset_float(fresult, fvalue, duserscalefactor, dusersuboffset, duseraddoffset)
integer(c_int) function get_source_filetype_fn(this)
integer(c_int), parameter, public file_template_capitalized_monthname
subroutine getvalues_static_netcdf_sub(this)
subroutine initialize_table_sub(this, sdescription, sdatecolumnname, svaluecolumnname, stype)
subroutine reset_at_yearend_filecount(this, iyear)
subroutine set_constant_value_int(this, ivalue)
subroutine set_grid_flip_horizontal_sub(this)
subroutine getvalues_constant_sub(this)
logical(c_bool) function test_for_need_to_pad_values_fn(this, dt)
subroutine initialize_constant_int_data_object_sub(this, sdescription, iconstant)
subroutine set_archive_local_sub(this, lvalue)
subroutine set_add_offset_sub(this, daddoffset)
subroutine dump_data_structure_sub(this)
integer(c_int), parameter, public file_template_lowercase_monthname
subroutine set_allow_missing_files_flag_sub(this)
subroutine set_scale_sub(this, dscalefactor)
subroutine reset_filecount(this)
integer(c_int), parameter dynamic_netcdf_grid
integer(c_int), parameter constant_grid
subroutine initialize_constant_real_data_object_sub(this, sdescription, rconstant)
subroutine getvalues_sub(this, dt)
subroutine set_source_proj4_string_sub(this, sproj4_string)
This module contains the DATETIME_T class and associated time and date-related routines,...
type(month_t), dimension(12), target, public months
Month information.
subroutine, public gregorian_date(ijd, iyear, imonth, iday, iorigin)
subroutine, public die(smessage, smodule, iline, shints, scalledby, icalledbyline)
character(len=:) function, allocatable, public fully_qualified_filename(filename, pathname)
character(len=1), parameter, public forwardslash
character(len=1), parameter, public backslash
Provides support for input and output of gridded ASCII data, as well as for creation and destruction ...
logical(c_bool) function, public grid_completelycover(pbasegrd, pothergrd, rtolerance)
type(general_grid_t) function, pointer, public grid_read(sfilename, sfiletype, idatatype)
subroutine, public grid_dumpgridextent(pgrd)
integer(c_int), parameter, public grid_datatype_int
subroutine, public grid_destroy(pgrd)
subroutine, public grid_gridtogrid_int(pgrdfrom, pgrdto, lusemajorityfilter)
integer(c_int), parameter, public grid_datatype_real
subroutine, public grid_readexisting(sfilename, sfiletype, pgrd)
subroutine, public grid_gridtogrid_sgl(pgrdfrom, pgrdto)
subroutine, public grid_checkforproj4error(iretval, sfromproj4, stoproj4)
subroutine, public grid_transform(pgrd, sfromproj4, stoproj4, rx, ry)
Call PROJ4 to transform coordinates.
type(logfile_t), public logs
Provide support for use of netCDF files as input for time-varying, gridded meteorlogic data,...
integer(c_int), parameter, public nc_bottom
subroutine, public netcdf_nullify_data_struct(ncfile)
integer(c_int), parameter, public nc_top
integer(c_int), parameter, public nc_right
subroutine, public netcdf_get_variable_slice(ncfile, rvalues, dpvalues, ivalues)
subroutine, public netcdf_close_file(ncfile)
integer(c_int), parameter, public nc_time
@TODO: implement a more flexible way of tracking variable IDs; presently the code can break if lat an...
subroutine, public netcdf_open_file(ncfile, sfilename, ilu)
subroutine, public netcdf_open_and_prepare_as_input(ncfile, sfilename, lfliphorizontal, lflipvertical, lallowautomaticdataflipping, rx_coord_addoffset, ry_coord_addoffset, svariableorder, svarname_x, svarname_y, svarname_z, svarname_time, rcoordinatetolerance, tgridbounds, ilu)
logical(c_bool) function, public netcdf_date_within_range(ncfile, ijulianday)
integer(c_int), parameter, public nc_left
subroutine, public netcdf_put_variable_array(ncfile, ivarid, istart, icount, istride, ivalues, i2values, rvalues, dpvalues)
subroutine, public netcdf_put_variable_vector(ncfile, ivarid, istart, icount, istride, ivalues, i2values, rvalues, dpvalues)
subroutine, public netcdf_open_and_prepare_as_output_archive(ncfile, ncfile_archive, ioriginmonth, ioriginday, ioriginyear, istartyear, iendyear)
logical(c_bool) function, public netcdf_update_time_starting_index(ncfile, ijulianday)
integer(c_int), parameter, public nc_z
type(parameters_t), public params
interface to C code that provides a simplified entry point to PROJ4 capabilities: it has been modifie...