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
501 type ( GENERAL_GRID_T ),
pointer :: pGrdBase
504 if (
present(sproj4_string) )
then
505 this%sSourcePROJ4_string = trim(sproj4_string)
507 this%sSourcePROJ4_string =
bnds%sPROJ4_string
524 this%lGridIsPersistent =
true
525 this%sFilenameTemplate = trim(sfilename)
537 call this%nullify_pointers()
540 rx0=
bnds%fX_ll, ry0=
bnds%fY_ll, rgridcellsize=
bnds%fGridCellSize, idatatype=idatatype)
542 this%pGrdBase%sPROJ4_string =
bnds%sPROJ4_string
543 this%pGrdBase%sFilename = this%sSourceFilename
545 this%sSourceFileType =
"NETCDF"
546 this%iSourceFileType = this%get_filetype()
548 this%iTargetDataType = idatatype
558 type (DATETIME_T),
optional :: dt
586 call assert(
false,
"Unsupported data source specified", &
593 if ( this%lGridHasChanged )
then
599 dusersuboffset=this%dUserSubOffset, &
600 duserscalefactor=this%dUserScaleFactor, &
601 duseraddoffset=this%dUserAddOffset )
606 dusersuboffset=this%dUserSubOffset, &
607 duserscalefactor=this%dUserScaleFactor, &
608 duseraddoffset=this%dUserAddOffset )
612 call die(
"Unsupported data type specified", __file__, __line__)
624 real (c_float),
intent(out) :: fresult
625 real (c_float),
intent(in) :: fvalue
626 real (c_double),
intent(in) :: duserscalefactor
627 real (c_double),
intent(in) :: dusersuboffset
628 real (c_double),
intent(in) :: duseraddoffset
630 fresult = ( (fvalue - dusersuboffset) * duserscalefactor ) + duseraddoffset
638 integer (c_int),
intent(out) :: iresult
639 integer (c_int),
intent(in) :: ivalue
640 real (c_double),
intent(in) :: duserscalefactor
641 real (c_double),
intent(in) :: dusersuboffset
642 real (c_double),
intent(in) :: duseraddoffset
644 iresult = ( ( real( ivalue, c_float) - dusersuboffset ) * duserscalefactor ) + duseraddoffset
654 if ( .not.
associated(this%pGrdBase) ) &
655 call die(
"Internal programming error--attempt to use null pointer", __file__, __line__)
657 select case (this%iSourceDataType)
661 this%lGridHasChanged =
true
663 this%pGrdBase%rData = this%rConstantValue
667 this%lGridHasChanged =
true
669 this%pGrdBase%iData = this%iConstantValue
675 call assert(
false,
"INTERNAL PROGRAMMING ERROR - Unhandled data type: " &
676 //
"name="//
dquote(this%sDescription) &
677 //
"; value="//trim(
ascharacter(this%iSourceDataType)), &
689 type (DATETIME_T),
intent(in) :: dt
691 integer (c_int) :: indx
693 integer (c_int) :: status_code
696 type (FSTRING_LIST_T) :: slDateValues
698 if ( .not.
associated(this%pGrdBase) ) &
699 call die(
"Internal programming error--attempt to use null pointer", __file__, __line__)
701 if ( .not. this%lTableValuesHaveBeenRetrieved )
then
703 this%lTableValuesHaveBeenRetrieved =
true
706 select case (this%iSourceDataType)
710 call params%get_parameters(skey=
"date", slvalues=sldatevalues)
712 n = sldatevalues%count
716 allocate(this%table_dates(n), stat=status_code)
717 allocate(this%table_values_real(n), stat=status_code)
719 call this%table_dates(1)%setDateFormat(this%sDefaultDateFormat)
721 call params%get_parameters(skey=this%sValueColumnName, fvalues=this%table_values_real)
723 if ( (
size( this%table_values_real,1) /= n) &
724 .or. (
size( this%table_values_real,1) == 1 ) ) &
725 call die(
"Did not find values associated with a required table entry ("//
squote(this%sValueColumnName)//
"). ", &
729 call this%table_dates(indx)%parseDate(sldatevalues%get(indx),__file__, __line__)
739 call assert(
false,
"INTERNAL PROGRAMMING ERROR - Unhandled data type: " &
740 //
"name="//
dquote(this%sDescription) &
741 //
"; value="//trim(
ascharacter(this%iSourceDataType)), &
750 if ( this%table_indx < lbound(this%table_dates,1))
exit
751 if ( this%table_indx > ubound(this%table_dates,1))
exit
753 if (this%table_dates(this%table_indx) < dt)
then
754 this%table_indx = this%table_indx + 1
755 elseif (this%table_dates(this%table_indx) > dt)
then
756 this%table_indx = this%table_indx - 1
763 if ( this%table_dates(this%table_indx) == dt )
then
765 select case (this%iSourceDataType)
769 this%lGridHasChanged =
true
771 this%pGrdBase%rData = this%table_values_real(this%table_indx)
779 call assert(
false,
"INTERNAL PROGRAMMING ERROR - Unhandled data type: " &
780 //
"name="//
dquote(this%sDescription) &
781 //
"; value="//trim(
ascharacter(this%iSourceDataType)), &
788 call die(
"Missing or out-of-order value supplied for "//
squote(this%sValueColumnName), &
801 call logs%write(
"---------------------------------------------------")
802 call logs%write(
"DATA STRUCTURE DETAILS:")
803 call logs%write(
"---------------------------------------------------")
805 call logs%write(
" catalog key word: "//
dquote( this%sKeyWord ) )
807 call logs%write(
" source data form: "//trim(
ascharacter(this%iSourceDataForm)) )
808 call logs%write(
" source data type: "//trim(
ascharacter(this%iSourceDataType)) )
809 call logs%write(
" source file type: "//trim(
ascharacter(this%iSourceFileType)) )
810 call logs%write(
" description: "//trim(this%sDescription) )
811 call logs%write(
" source PROJ4 string: "//trim(this%sSourcePROJ4_string) )
812 call logs%write(
" source file type: "//trim(this%sSourceFileType) )
813 call logs%write(
" filename template: "//trim(this%sFilenameTemplate) )
814 call logs%write(
" source filename: "//trim(this%sSourceFilename) )
826 type (DATETIME_T),
optional :: dt
827 logical (c_bool) :: lExist
828 logical (c_bool) :: lOpened
830 this%lGridHasChanged =
false
835 this%iSourceFileType ==
filetype_surfer,
"INTERNAL PROGRAMMING ERROR -" &
836 //
" improper file type in use for a call to this subroutine", &
841 if(.not.
present(dt) ) &
842 call assert(
false,
"INTERNAL PROGRAMMING ERROR - datetime object" &
843 //
" must be supplied when calling this subroutine in a " &
844 //
"dynamic mode.", __file__, __line__)
847 call this%make_filename(dt)
852 if ( this%sOldFilename .strequal. this%sSourceFilename )
exit
854 this%sOldFilename = this%sSourceFilename
856 inquire(file=this%sSourceFilename, exist=lexist, opened=lopened)
859 if (.not. lexist )
then
860 if ( this%lAllowMissingFiles )
then
864 "Could not find input data file~filename:"//
dquote(this%sSourceFilename) &
865 //
"~data description: "//trim(this%sDescription))
869 call logs%write(
"Opening file "//
dquote(this%sSourceFilename) &
870 //
" for "//trim(this%sDescription)//
" data.", iloglevel=
log_all, lecho=
true )
872 if ( this%lGridIsPersistent .and.
associated(this%pGrdNative) )
then
875 sfiletype=this%sSourceFileType, &
876 pgrd=this%pGrdNative )
880 this%pGrdNative =>
grid_read( sfilename=this%sSourceFilename, &
881 sfiletype=this%sSourceFileType, &
882 idatatype=this%iSourceDataType )
885 this%pGrdNative%sPROJ4_string = this%sSourcePROJ4_string
888 this%lGridHasChanged =
true
890 select case (this%iTargetDataType)
894 call this%handle_missing_values(this%pGrdNative%rData)
895 call this%enforce_limits(this%pGrdNative%rData)
904 call assert(
false,
"INTERNAL PROGRAMMING ERROR - Unhandled data type: value=" &
910 call this%transform_native_to_base()
912 if ( .not. this%lGridIsPersistent )
call grid_destroy( this%pGrdNative )
925 real (c_double),
optional :: rX(:)
926 real (c_double),
optional :: rY(:)
928 if (.not.
associated(this%pGrdNative) ) &
929 call die(
"INTERNAL PROGRAMMING ERROR--Null pointer detected.", __file__, __line__)
931 if ( .not.
associated(this%pGrdBase) ) &
933 rgridcellsize=
bnds%fGridCellSize, idatatype=this%iTargetDataType )
936 if (.not. ( this%pGrdNative%sPROJ4_string .strequal. this%pGrdBase%sPROJ4_string ) )
then
938 call logs%write(
"Transforming gridded data in file: "//
dquote(this%sSourceFilename), ilinesbefore=1 )
939 call logs%write(
"FROM: "//
squote(this%sSourcePROJ4_string), itab=2 )
940 call logs%write(
"TO: "//
squote(this%pGrdBase%sPROJ4_string), itab=2 )
942 if (
present(rx) .and.
present(ry))
then
944 sfromproj4=this%sSourcePROJ4_string, &
945 stoproj4=
bnds%sPROJ4_string, &
950 sfromproj4=this%sSourcePROJ4_string, &
951 stoproj4=
bnds%sPROJ4_string )
959 if ( this%lRequireCompleteSpatialCoverage ) &
961 "Transformed grid read from file "//
dquote(this%sSourceFilename) &
962 //
" does not completely cover your model domain.")
964 select case (this%iTargetDataType)
969 pgrdto=this%pGrdBase )
974 pgrdto=this%pGrdBase, &
975 lusemajorityfilter=this%lUseMajorityFilter )
979 call assert(
false,
"INTERNAL PROGRAMMING ERROR - Unhandled data type: value=" &
993 integer (c_int) :: iValue
995 this%iConstantValue = ivalue
1004 real (c_float) :: rValue
1006 this%rConstantValue = rvalue
1015 integer (c_int) :: iValue
1016 integer (c_int),
optional :: iYear
1018 this%iFileCount = ivalue
1020 if (
present(iyear) ) this%iFileCountYear = iyear
1030 this%iFileCount = this%iFileCount + 1
1049 integer (c_int) :: iYear
1051 if (iyear /= this%iFileCountYear )
then
1053 this%iFileCountYear = iyear
1063 type (DATETIME_T),
intent(in),
optional :: dt
1066 character (len=256) :: sNewFilename
1067 character (len=256) :: sUppercaseFilename
1068 character (len=256) :: sCWD
1069 character (len=256) :: sBuf2
1070 integer (c_int) :: iPos_Y, iPos_D, iPos_M, iPos_0D, iPos_0M, iPos_B, &
1071 iPos_BF, iPos_j, iPos, iPos2, iLen, iCount
1072 integer (c_int) :: iNumZeros, iNumZerosToPrint
1073 logical (c_bool) :: lMatch
1074 logical (c_bool) :: lExist
1075 character (len=16) :: sBuf
1076 character (len=12) :: sNumber
1077 character (len=1) :: sDelimiter
1078 integer (c_int) :: iStatus
1079 logical (c_bool) :: lAnnual
1081 ipos_y = 0; ipos_m = 0; ipos_d = 0; ipos = 0; ipos_b = 0; ipos_bf = 0; snumber =
""
1094 snewfilename = this%sFilenameTemplate
1102 ipos_y = max(index(snewfilename,
"%Y"), index(snewfilename,
"%y") )
1104 if (ipos_y > 0)
then
1106 ilen=len_trim(snewfilename)
1107 snewfilename = snewfilename(1:ipos_y - 1)//trim(
ascharacter(dt%iYear)) &
1108 //snewfilename(ipos_y + 2:ilen)
1115 ipos = index(snewfilename,
"#")
1121 ipos2 = index(snewfilename(1:ipos),
"%", back=
true)
1123 inumzeros = max(0, ipos - ipos2 - 1)
1125 if (inumzeros > 0)
then
1126 inumzerostoprint = max(0,inumzeros - len_trim(sbuf2) + 1)
1127 snumber = repeat(
"0", inumzerostoprint )//trim(sbuf2)
1129 snumber = trim(sbuf2)
1134 ilen=len_trim(snewfilename)
1135 snewfilename = snewfilename(1:ipos-2-inumzeros)//trim(snumber) &
1136 //snewfilename(ipos+1:ilen)
1141 ipos_m = index(snewfilename,
"%m")
1142 ipos_0m = index(snewfilename,
"%0m")
1143 ipos_b = index(snewfilename,
"%b")
1144 ipos_bf = index(snewfilename,
"%B")
1146 if ( ipos_0m > 0 )
then
1150 write (unit=sbuf, fmt=
"(i2.2)") dt%iMonth
1152 ilen=len_trim(snewfilename)
1153 snewfilename = snewfilename(1:ipos_0m - 1)//trim(sbuf) &
1154 //snewfilename(ipos_0m + 3:ilen)
1156 elseif ( ipos_m > 0 )
then
1162 ilen=len_trim(snewfilename)
1163 snewfilename = snewfilename(1:ipos_m - 1)//trim(sbuf) &
1164 //snewfilename(ipos_m + 2:ilen)
1166 elseif ( ipos_b > 0 )
then
1171 select case ( this% iFilename_Monthname_Capitalization_Rule )
1175 sbuf =
months( dt%iMonth )%sName
1180 sbuf =
months( dt%iMonth )%sName
1185 sbuf =
months( dt%iMonth )%sName
1189 ilen=len_trim(snewfilename)
1190 snewfilename = snewfilename(1:ipos_b - 1)//trim(sbuf) &
1191 //snewfilename(ipos_b + 2:ilen)
1193 elseif ( ipos_bf > 0 )
then
1198 select case ( this% iFilename_Monthname_Capitalization_Rule )
1202 sbuf =
months( dt%iMonth )%sFullName
1207 sbuf =
months( dt%iMonth )%sFullName
1212 sbuf =
months( dt%iMonth )%sFullName
1216 ilen=len_trim(snewfilename)
1217 snewfilename = snewfilename(1:ipos_bf - 1)//trim(sbuf) &
1218 //snewfilename( ( ipos_bf + len_trim(sbuf) - 1):ilen)
1223 ipos_j = max(index(snewfilename,
"%J"),index(snewfilename,
"%j") )
1225 if (ipos_j > 0)
then
1228 write (unit=sbuf, fmt=
"(i3.3)") dt%getDayOfYear()
1229 ilen=len_trim(snewfilename)
1230 snewfilename = snewfilename(1:ipos_j - 1)//trim(sbuf) &
1231 //snewfilename(ipos_j + 2:ilen)
1237 ipos_d = max(index(snewfilename,
"%D"),index(snewfilename,
"%d") )
1238 ipos_0d = max(index(snewfilename,
"%0D"), index(snewfilename,
"%0d") )
1240 if (ipos_0d > 0)
then
1243 write (unit=sbuf, fmt=
"(i2.2)") dt%iDay
1244 ilen=len_trim(snewfilename)
1245 snewfilename = snewfilename(1:ipos_0d - 1)//trim(sbuf) &
1246 //snewfilename(ipos_0d + 3:ilen)
1248 elseif ( ipos_d > 0 )
then
1254 ilen=len_trim(snewfilename)
1255 snewfilename = snewfilename(1:ipos_d - 1)//trim(sbuf) &
1256 //snewfilename(ipos_d + 2:ilen)
1260 if (.not. lmatch)
exit
1265 if (icount > 4)
exit
1269 if( index(string=scwd, substring=
forwardslash) > 0 )
then
1276 this%sSourceFilename = trim(snewfilename)
1278 this%lIsAnnualGrid = lannual
1290 logical (c_bool) :: lexist
1291 integer (c_int) :: idaysleftinmonth
1292 integer (c_int) :: ipos
1293 logical (c_bool) :: lneedtopaddata
1297 lneedtopaddata =
false
1299 ipos = scan(string=trim(this%sSourceFilename), set=
"http://")
1303 if (this%sSourceFilename(ipos:ipos+6) ==
"http://")
then
1310 inquire( file=this%sSourceFilename, exist=lexist )
1315 if ( lexist .and. ( .not. this%lIsAnnualGrid ) )
exit
1319 if (dt%iMonth == 12 )
then
1321 idaysleftinmonth = 31 - dt%iDay
1323 if ( dt%isLeapYear() )
then
1325 if ( idaysleftinmonth <= this%iDaysToPadIfLeapYear )
then
1327 lneedtopaddata =
true
1334 if ( idaysleftinmonth <= this%iDaysToPadAtYearsEnd )
then
1336 lneedtopaddata =
true
1347 call assert(lexist,
"The filename created from your template refers to " &
1348 //
"a nonexistent file. ~ Attempted to open filename "&
1349 //
dquote(this%sSourceFilename), __file__, __line__)
1364 type (DATETIME_T),
intent(in) :: dt
1367 integer (c_int) :: iTimeIndex
1368 integer (c_int) :: iStat
1369 logical (c_bool) :: lDateTimeFound
1370 real (c_double) :: dAddOffset
1371 real (c_double) :: dScaleFactor
1372 integer (c_int) :: iMonth
1373 integer (c_int) :: iDay
1374 integer (c_int) :: iYear
1376 if ( .not.
associated(this%pGrdBase) ) &
1377 call die(
"Internal programming error--attempt to use null pointer", __file__, __line__)
1379 this%lPadValues =
false
1382 if ( this%iFileCountYear < 0 )
call this%set_filecount(-1, dt%iYear)
1392 ijulianday=int(dt%iJulianDay, c_int) ) )
then
1404 call this%increment_filecount()
1407 call this%reset_at_yearend_filecount(dt%iYear)
1411 call this%make_filename( dt )
1413 this%lPadValues = this%test_for_need_to_pad_values(dt)
1420 if (.not. this%lPadValues)
then
1422 if (this%lPerformFullInitialization )
then
1424 if( ( len_trim( this%sSourcePROJ4_string ) > 0 ) &
1425 .and. ( .not. ( this%sSourcePROJ4_string .strequal.
"<NA>") ) )
then
1429 call this%calc_project_boundaries(pgrdbase=this%pGrdBase)
1431 if ( this%lRequireCompleteSpatialCoverage )
then
1434 sfilename=this%sSourceFilename, &
1435 lfliphorizontal=this%lFlipHorizontal, &
1436 lflipvertical=this%lFlipVertical, &
1437 lallowautomaticdataflipping=this%lAllowAutomaticDataFlipping, &
1438 rx_coord_addoffset = this%rX_Coord_AddOffset, &
1439 ry_coord_addoffset = this%rY_Coord_AddOffset, &
1440 svariableorder=this%sVariableOrder, &
1441 svarname_x=this%sVariableName_x, &
1442 svarname_y=this%sVariableName_y, &
1443 svarname_z=this%sVariableName_z, &
1444 svarname_time=this%sVariableName_time, &
1445 rcoordinatetolerance=this%rCoordinateTolerance, &
1446 tgridbounds=this%GRID_BOUNDS_NATIVE )
1451 sfilename=this%sSourceFilename, &
1452 lfliphorizontal=this%lFlipHorizontal, &
1453 lflipvertical=this%lFlipVertical, &
1454 lallowautomaticdataflipping=this%lAllowAutomaticDataFlipping, &
1455 rx_coord_addoffset = this%rX_Coord_AddOffset, &
1456 ry_coord_addoffset = this%rY_Coord_AddOffset, &
1457 svariableorder=this%sVariableOrder, &
1458 svarname_x=this%sVariableName_x, &
1459 svarname_y=this%sVariableName_y, &
1460 svarname_z=this%sVariableName_z, &
1461 svarname_time=this%sVariableName_time, &
1462 rcoordinatetolerance=this%rCoordinateTolerance )
1471 sfilename=this%sSourceFilename, &
1472 lfliphorizontal=this%lFlipHorizontal, &
1473 lflipvertical=this%lFlipVertical, &
1474 lallowautomaticdataflipping=this%lAllowAutomaticDataFlipping, &
1475 svariableorder=this%sVariableOrder, &
1476 svarname_x=this%sVariableName_x, &
1477 svarname_y=this%sVariableName_y, &
1478 svarname_z=this%sVariableName_z, &
1479 rcoordinatetolerance=this%rCoordinateTolerance, &
1480 svarname_time=this%sVariableName_time )
1482 this%NCFILE%iNX = this%pGrdBase%iNX
1483 this%NCFILE%iNY = this%pGrdBase%iNY
1484 this%NCFILE%rX(
nc_left) = this%pGrdBase%rX0
1485 this%NCFILE%rY(
nc_bottom) = this%pGrdBase%rY0
1486 this%NCFILE%rX(
nc_right) = this%pGrdBase%rX1
1487 this%NCFILE%rY(
nc_top) = this%pGrdBase%rY1
1491 this%rX_coordinate_subset = this%NCFILE%rX_Coords(this%NCFILE%iColBounds(
nc_left):this%NCFILE%iColBounds(
nc_right))
1492 this%rY_coordinate_subset = this%NCFILE%rY_Coords(this%NCFILE%iRowBounds(
nc_top):this%NCFILE%iRowBounds(
nc_bottom))
1502 this%iSourceDataType = this%NCFILE%iVarType(
nc_z)
1508 if (
associated(this%pGrdNative) )
call grid_destroy (this%pGrdNative)
1510 this%pGrdNative =>
grid_create( inx=this%NCFILE%iNX, &
1511 iny=this%NCFILE%iNY, &
1512 rx0=this%NCFILE%rX(
nc_left), &
1515 ry1=this%NCFILE%rY(
nc_top), &
1516 idatatype=this%iTargetDataType )
1529 if( len_trim( this%sSourcePROJ4_string ) > 0 )
then
1531 this%pGrdNative%sPROJ4_string = this%sSourcePROJ4_string
1534 this%pGrdNative%sFilename = this%sSourceFilename
1539 this%lPerformFullInitialization =
false
1551 ijulianday=int(dt%iJulianDay, c_int) ) )
then
1555 elseif ( scan(this%sSourceFilename,
"#") /= 0 )
then
1559 call logs%write(
"Did not find the current date in the file "//
dquote(this%sSourceFilename)//
"~" &
1561 //
"~current JD: "//
ascharacter(dt%iJulianDay)//
"~ Will increment sequential file number and try again.", &
1562 ilinesbefore=1, ilinesafter=1 )
1566 call gregorian_date(this%NCFILE%iFirstDayJD,iyear, imonth, iday )
1567 call logs%write(
"NetCDF start date: "//trim(
ascharacter(imonth,
"i2.2")) &
1572 call logs%write(
"NetCDF end date: "//trim(
ascharacter(imonth,
"i2.2")) &
1575 call gregorian_date(int(dt%iJulianDay, c_int),iyear, imonth, iday )
1576 call logs%write(
"Current SWB simulation date: "//trim(
ascharacter(imonth,
"i2.2")) &
1579 call assert (
false,
"Date range for currently open NetCDF file" &
1580 //
" does not include the current simulation date.", &
1593 if (.not. this%lPadValues)
then
1597 ijulianday=int(dt%iJulianDay, c_int) )
1599 if (.not. ldatetimefound)
then
1600 this%lPadValues =
true
1605 this%lGridHasChanged =
true
1611 daddoffset = this%NCFILE%rAddOffset(
nc_z)
1612 dscalefactor = this%NCFILE%rScaleFactor(
nc_z)
1614 this%pGrdNative%rData = this%pGrdNative%rData * dscalefactor + daddoffset
1616 call this%handle_missing_values(this%pGrdNative%rData)
1617 call this%enforce_limits(this%pGrdNative%rData)
1623 if (this%lPadValues)
then
1625 if (this%lPadReplaceWithZero)
then
1627 this%pGrdNative%rData = 0_c_float
1628 this%pGrdNative%iData = 0_c_int
1632 call logs%write( repeat(
"=", 60) )
1633 call logs%write(
"Missing day found in NetCDF file - padding values" )
1634 call logs%write( repeat(
"=", 60) )
1638 if (this%lCreateLocalNetCDFArchive) &
1639 call this%put_values_to_archive(int(dt%iMonth,c_int), &
1640 int(dt%iDay,c_int), dt%iYear)
1642 call this%transform_native_to_base( rx=this%rX_coordinate_subset, &
1643 ry=this%rY_coordinate_subset)
1650 real (c_float),
dimension(:,:) :: variable
1651 character (len=*),
intent(in) :: varname
1652 real (c_float),
intent(in) :: nodata_value
1655 integer (c_int) :: iCount
1656 character (len=20) :: sVarname
1657 character (len=14) :: sMin
1658 character (len=14) :: sMax
1659 character (len=14) :: sMean
1660 character (len=10) :: sCount
1662 write (svarname, fmt=
"(a20)") adjustl(varname)
1664 if (
size( variable, 1) > 0 )
then
1665 write (smin, fmt=
"(g14.3)") minval(variable, variable < nodata_value )
1666 write (smax, fmt=
"(g14.3)") maxval(variable, variable < nodata_value )
1667 write (smean, fmt=
"(g14.3)") sum(variable, variable < nodata_value ) / count( variable < nodata_value )
1668 write (scount, fmt=
"(i10)") count( variable < nodata_value )
1670 write (smin, fmt=
"(g14.3)") -9999.
1671 write (smax, fmt=
"(g14.3)") -9999.
1672 write (smean, fmt=
"(g14.3)") -9999.
1673 write (scount, fmt=
"(i10)") 0
1677 print *, adjustl(svarname)//
" | "//adjustl(smin)//
" | "//adjustl(smax) &
1678 //
" | "//adjustl(smean)//
" | "//adjustl(scount)
1690 integer (c_int) :: iStat
1691 real (c_double) :: dAddOffset
1692 real (c_double) :: dScaleFactor
1694 if ( .not.
associated(this%pGrdBase) ) &
1695 call die(
"Internal programming error--attempt to use null pointer", __file__, __line__)
1699 if (this%lPerformFullInitialization )
then
1701 if( ( len_trim( this%sSourcePROJ4_string ) > 0 ) &
1702 .and. ( .not. ( this%sSourcePROJ4_string .strequal.
"<NA>") ) )
then
1706 call this%calc_project_boundaries(pgrdbase=this%pGrdBase)
1708 if ( this%lRequireCompleteSpatialCoverage )
then
1710 sfilename=this%sSourceFilename, &
1711 lfliphorizontal=this%lFlipHorizontal, &
1712 lflipvertical=this%lFlipVertical, &
1713 svariableorder=this%sVariableOrder, &
1714 svarname_x=this%sVariableName_x, &
1715 svarname_y=this%sVariableName_y, &
1716 svarname_z=this%sVariableName_z, &
1717 svarname_time=this%sVariableName_time, &
1718 tgridbounds=this%GRID_BOUNDS_NATIVE )
1721 sfilename=this%sSourceFilename, &
1722 lfliphorizontal=this%lFlipHorizontal, &
1723 lflipvertical=this%lFlipVertical, &
1724 svariableorder=this%sVariableOrder, &
1725 svarname_x=this%sVariableName_x, &
1726 svarname_y=this%sVariableName_y, &
1727 svarname_z=this%sVariableName_z, &
1728 svarname_time=this%sVariableName_time )
1736 sfilename=this%sSourceFilename, &
1737 lfliphorizontal=this%lFlipHorizontal, &
1738 lflipvertical=this%lFlipVertical, &
1739 svariableorder=this%sVariableOrder, &
1740 svarname_x=this%sVariableName_x, &
1741 svarname_y=this%sVariableName_y, &
1742 svarname_z=this%sVariableName_z, &
1743 svarname_time=this%sVariableName_time )
1745 this%NCFILE%iNX = this%pGrdBase%iNX
1746 this%NCFILE%iNY = this%pGrdBase%iNY
1747 this%NCFILE%rX(
nc_left) = this%pGrdBase%rX0
1748 this%NCFILE%rY(
nc_bottom) = this%pGrdBase%rY0
1749 this%NCFILE%rX(
nc_right) = this%pGrdBase%rX1
1750 this%NCFILE%rY(
nc_top) = this%pGrdBase%rY1
1756 this%iSourceDataType = this%NCFILE%iVarType(
nc_z)
1762 if (
associated(this%pGrdNative) )
call grid_destroy (this%pGrdNative)
1764 this%pGrdNative =>
grid_create( inx=this%NCFILE%iNX, &
1765 iny=this%NCFILE%iNY, &
1766 rx0=this%NCFILE%rX(
nc_left), &
1769 ry1=this%NCFILE%rY(
nc_top), &
1770 idatatype=this%iTargetDataType )
1784 if( len_trim( this%sSourcePROJ4_string ) > 0 )
then
1786 this%pGrdNative%sPROJ4_string = this%sSourcePROJ4_string
1789 this%pGrdNative%sFilename = this%sSourceFilename
1794 this%lPerformFullInitialization =
false
1812 daddoffset = this%NCFILE%rAddOffset(
nc_z)
1813 dscalefactor = this%NCFILE%rScaleFactor(
nc_z)
1814 this%pGrdNative%rData = this%pGrdNative%rData * dscalefactor + daddoffset
1816 call this%handle_missing_values(this%pGrdNative%rData)
1818 call this%enforce_limits(this%pGrdNative%rData)
1820 call this%transform_native_to_base( )
1829 integer (c_int) :: iMonth
1830 integer (c_int) :: iDay
1831 integer (c_int) :: iYear
1834 integer (c_size_t) :: iNumRows, iNumCols, iNumRecs
1839 ncfile_archive=this%NCFILE_ARCHIVE, &
1840 ioriginmonth=imonth, ioriginday=iday, ioriginyear=iyear, &
1841 istartyear=this%iStartYear, iendyear=this%iEndYear)
1847 inumrows = int(
size(this%pGrdNative%rData, 2), c_size_t)
1848 inumcols = int(
size(this%pGrdNative%rData, 1), c_size_t)
1849 inumrecs = this%iNCFILE_RECNUM
1852 ivarid=this%NCFILE_ARCHIVE%iVarID(
nc_z), &
1853 istart=[inumrecs, 0_c_size_t, 0_c_size_t], &
1854 icount=[1_c_size_t, inumrows, inumcols], &
1855 istride=[1_c_size_t,1_c_size_t,1_c_size_t], &
1856 rvalues=this%pGrdNative%rData)
1859 ivarid=this%NCFILE_ARCHIVE%iVarID(
nc_time), &
1860 istart=[this%iNCFILE_RECNUM], &
1861 icount=[1_c_size_t], &
1862 istride=[1_c_size_t], &
1863 rvalues=[real(this%iNCFILE_RECNUM, c_float)])
1865 this%iNCFILE_RECNUM = this%iNCFILE_RECNUM + 1
1874 integer (c_int) :: ifiletype
1876 if ( (this%sSourceFileType .strequal.
"ARC_GRID") &
1877 .or. (this%sSourceFileType .strequal.
"ARC_ASCII") )
then
1881 elseif ( this%sSourceFileType .strequal.
"SURFER" )
then
1885 elseif ( this%sSourceFileType .strequal.
"NETCDF" )
then
1891 call assert(
false,
"Unknown input file type specified. ~"&
1892 //
" filename: "//
dquote(this%sSourceFilename) &
1893 //
"~ file type specified as: "//
dquote(this%sSourceFileType), &
1905 character (len=*),
optional :: sPROJ4_string
1907 this%sSourcePROJ4_string = sproj4_string
1916 character (len=*),
optional :: sPROJ4_string
1918 this%sTargetPROJ4_string = sproj4_string
1928 this%lAllowAutomaticDataFlipping =
false
1938 this%lFlipHorizontal =
true
1948 this%lFlipVertical =
true
1958 this%lAllowMissingFiles =
true
1967 character (len=*) :: sVariableOrder
1969 this%sVariableOrder = svariableorder
1978 real (c_double) :: dScaleFactor
1980 this%dUserScaleFactor = dscalefactor
1989 logical (c_bool) :: lValue
1991 this%lCreateLocalNetCDFArchive = lvalue
2000 real (c_double) :: rXOffset
2002 this%rX_Coord_AddOffset = rxoffset
2011 real (c_double) :: rYOffset
2013 this%rY_Coord_AddOffset = ryoffset
2022 real (c_double) :: rCoordinateTolerance
2024 this%rCoordinateTolerance = rcoordinatetolerance
2033 real (c_double) :: dAddOffset
2035 this%dUserAddOffset = daddoffset
2044 real (c_double) :: dSubOffset
2046 this%dUserSubOffset = dsuboffset
2055 logical (c_bool) :: lUseMajorityFilter
2057 this%lUseMajorityFilter = lusemajorityfilter
2066 integer (c_int) :: iMissingVal
2068 this%iMissingValuesCode = imissingval
2077 integer (c_int) :: rMissingVal
2079 this%rMissingValuesCode = rmissingval
2088 logical (c_bool),
intent(in) :: lRequireCompleteSpatialCoverage
2090 this%lRequireCompleteSpatialCoverage = lrequirecompletespatialcoverage
2099 integer (c_int) :: iMinVal
2101 this%iMinAllowedValue = iminval
2110 integer (c_int) :: iMaxVal
2112 this%iMaxAllowedValue = imaxval
2121 real (c_float) :: rMinVal
2123 this%rMinAllowedValue = rminval
2132 real (c_float) :: rMaxVal
2134 this%rMaxAllowedValue = rmaxval
2143 type ( GENERAL_GRID_T ),
pointer :: pGrdBase
2146 integer (c_int) :: iRetVal
2147 real (c_float) :: rMultiplier = 0.
2148 real (c_double),
dimension(4) :: rX, rY
2151 rx(1) = pgrdbase%rX0
2152 ry(1) = pgrdbase%rY0
2153 rx(2) = pgrdbase%rX1
2154 ry(2) = pgrdbase%rY0
2155 rx(3) = pgrdbase%rX0
2156 ry(3) = pgrdbase%rY1
2157 rx(4) = pgrdbase%rX1
2158 ry(4) = pgrdbase%rY1
2161 if ( .not. trim( pgrdbase%sPROJ4_string) == trim(this%sSourcePROJ4_string))
then
2167 trim(this%sSourcePROJ4_string)//c_null_char, &
2168 __file__//c_null_char, &
2174 sfromproj4=trim(pgrdbase%sPROJ4_string), &
2175 stoproj4=trim(this%sSourcePROJ4_string))
2185 if ( ( this%sSourcePROJ4_string .containssimilar.
"latlon" ) &
2186 .or. ( this%sSourcePROJ4_string .containssimilar.
"latlong" ) &
2187 .or. ( this%sSourcePROJ4_string .containssimilar.
"lonlat" ) &
2188 .or. ( this%sSourcePROJ4_string .containssimilar.
"longlat" ) )
then
2197 this%GRID_BOUNDS_NATIVE%rXll = rx(1); this%GRID_BOUNDS_NATIVE%rXlr = rx(2)
2198 this%GRID_BOUNDS_NATIVE%rYll = ry(1); this%GRID_BOUNDS_NATIVE%rYlr = ry(2)
2199 this%GRID_BOUNDS_NATIVE%rXul = rx(3); this%GRID_BOUNDS_NATIVE%rXur = rx(4)
2200 this%GRID_BOUNDS_NATIVE%rYul = ry(3); this%GRID_BOUNDS_NATIVE%rYur = ry(4)
2204 print *,
" routine 'calc_project_boundaries'"
2205 print *, trim(__file__),
": ", __line__
2206 print *,
"-- BASE GRID BOUNDS projected to DATA NATIVE COORDS"
2207 print *,
"FROM: ",
dquote(pgrdbase%sPROJ4_string)
2208 print *,
"TO: ",
dquote(this%sSourcePROJ4_string)
2209 print *,
"file: ",
dquote(this%sSourceFileName)
2211 print *,
"LL: ", this%GRID_BOUNDS_NATIVE%rXll, this%GRID_BOUNDS_NATIVE%rYll
2212 print *,
"LR: ", this%GRID_BOUNDS_NATIVE%rXlr, this%GRID_BOUNDS_NATIVE%rYlr
2213 print *,
"UL: ", this%GRID_BOUNDS_NATIVE%rXul, this%GRID_BOUNDS_NATIVE%rYul
2214 print *,
"UR: ", this%GRID_BOUNDS_NATIVE%rXur, this%GRID_BOUNDS_NATIVE%rYur
2224 integer (c_int),
dimension(:,:) :: iValues
2227 integer (c_int) :: iMin, iMax
2229 imin = this%iMinAllowedValue
2230 imax = this%iMaxAllowedValue
2232 where ( ivalues < imin ) ivalues = imin
2233 where ( ivalues > imax ) ivalues = imax
2242 real (c_float),
dimension(:,:) :: rValues
2245 real (c_float) :: rMin, rMax
2247 rmin = real(this%rMinAllowedValue, c_float)
2248 rmax = real(this%rMaxAllowedValue, c_float)
2250 where ( rvalues < rmin ) rvalues = rmin
2251 where ( rvalues > rmax ) rvalues = rmax
2260 real (c_float),
dimension(:,:),
intent(inout) :: rValues
2263 real (c_float) :: rMissing, rMean
2265 rmissing = real(this%rMissingValuesCode, c_float)
2270 if ( trim(this%sMissingValuesOperator) .ne.
"&&" )
then
2272 select case (this%iMissingValuesAction)
2276 select case (trim(this%sMissingValuesOperator))
2280 where (rvalues <= rmissing) rvalues =
rzero
2284 where (rvalues < rmissing) rvalues =
rzero
2288 where (rvalues >= rmissing) rvalues =
rzero
2292 where (rvalues > rmissing) rvalues =
rzero
2296 call assert(
false,
"Unknown missing values code was supplied " &
2297 //
"for processing data "//
squote(this%sDescription)//
": " &
2298 //
dquote(this%sMissingValuesOperator) )
2304 select case (this%sMissingValuesOperator)
2308 rmean = sum(rvalues, rvalues > rmissing ) / count(rvalues > rmissing )
2310 where (rvalues <= rmissing) rvalues = rmean
2314 rmean = sum(rvalues, rvalues >= rmissing ) / count(rvalues >= rmissing )
2316 where (rvalues < rmissing) rvalues = rmean
2320 rmean = sum(rvalues, rvalues < rmissing ) / count(rvalues < rmissing )
2322 where (rvalues >= rmissing) rvalues = rmean
2326 rmean = sum(rvalues, rvalues <= rmissing ) / count(rvalues <= rmissing )
2328 where (rvalues > rmissing) rvalues = rmean
2332 call assert(
false,
"Unknown missing values code was supplied " &
2333 //
"for processing data "//
squote(this%sDescription)//
": " &
2334 //
dquote(this%sMissingValuesOperator) )
2340 call assert(
false,
"INTERNAL PROGRAMMING ERROR - unhandled iMissingValuesAction", &
2353 integer (c_int),
dimension(:,:),
intent(inout) :: iValues
2356 integer (c_int) :: iMissing, iMean
2358 imissing = this%iMissingValuesCode
2359 if ( trim(this%sMissingValuesOperator) .ne.
"&&" )
then
2361 select case (this%iMissingValuesAction)
2365 select case (trim(this%sMissingValuesOperator))
2369 where (ivalues <= imissing) ivalues =
izero
2373 where (ivalues < imissing) ivalues =
izero
2377 where (ivalues >= imissing) ivalues =
izero
2381 where (ivalues > imissing) ivalues =
izero
2385 call assert(
false,
"Unknown missing values code was supplied " &
2386 //
"for processing data "//
squote(this%sDescription)//
": " &
2387 //
dquote(this%sMissingValuesOperator) )
2393 select case (this%sMissingValuesOperator)
2397 imean = sum(ivalues, ivalues > imissing ) &
2398 / count(ivalues > imissing )
2400 where (ivalues <= imissing) ivalues = imean
2404 imean = sum(ivalues, ivalues >= imissing ) &
2405 / count(ivalues >= imissing )
2407 where (ivalues < imissing) ivalues = imean
2411 imean = sum(ivalues, ivalues < imissing ) &
2412 / count(ivalues < imissing )
2414 where (ivalues >= imissing) ivalues = imean
2418 imean = sum(ivalues, ivalues <= imissing ) &
2419 / count(ivalues <= imissing )
2421 where (ivalues > imissing) ivalues = imean
2425 call assert(
false,
"Unknown missing values code was supplied " &
2426 //
"for processing data "//
squote(this%sDescription)//
": " &
2427 //
dquote(this%sMissingValuesOperator) )
2433 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_missing_value_real_sub(this, rmissingval)
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
subroutine minmaxmean_float(variable, varname, nodata_value)
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_missing_value_int_sub(this, imissingval)
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