3 use iso_c_binding,
only : c_short, c_int, c_float, c_double, c_bool
15 real (c_float),
allocatable ::
tmin(:)
16 real (c_float),
allocatable ::
tmax(:)
17 real (c_float),
allocatable ::
precip(:)
28 type (FSTRING_LIST_T) :: slList
29 integer (kind=c_int) :: indx
30 integer (kind=c_int) :: iStat
31 character (len=:),
allocatable :: date_str
32 type (DATETIME_T) :: tempdate
33 type (DATETIME_T) :: firstdate
34 type (DATETIME_T) :: lastdate
35 integer (c_int) :: error_count
39 call params%get_parameters(skey=
"TMIN", fvalues=
tmin)
40 call params%get_parameters(skey=
"TMAX", fvalues=
tmax)
43 call params%get_parameters( skey=
"Date", slvalues=sllist)
46 call assert( istat==0,
"Failed to allocate memory for WEATHER_DATE array", &
49 call logs%write(
" Date | PRCP | TMIN | TMAX")
50 call logs%write(
"-------------|---------------|--------------|--------------")
52 call weather_date(1)%setDateFormat(sdateformat=
"YYYY-MM-DD")
54 print *,
"Scanning weather data file for anomalies... There are "//
ascharacter(sllist%count)//
" entries."
59 do indx=1, sllist%count
61 date_str = sllist%get(indx)
62 call weather_date(indx)%parsedate( date_str, __file__, __line__ )
67 if ( ( tempdate <
sim_dt%start ) .or. ( tempdate >
sim_dt%end ) )
then
73 elseif ( (
weather_date(indx) == tempdate) .and. (error_count == 0))
then
85 elseif ((
weather_date(indx) == tempdate) .and. (error_count > 0))
then
87 call warn(
"Missing or out of order date sequence "//
ascharacter(error_count)//
" value(s) in" &
88 //
" single-station weather data file. Problem date(s) span "//firstdate%prettydate()//
" to " &
89 //lastdate%prettydate()//
".", lfatal=
true)
92 elseif (error_count == 0)
then
95 error_count = error_count + 1
97 call tempdate%addDay()
101 error_count = error_count + 1
102 call tempdate%addDay()
109 call tempdate%addDay()
115 call weather_date(1)%setDateFormat(sdateformat=
"MM-DD-YYYY")
123 type (DATETIME_T),
intent(in) :: dt
125 integer (c_int) :: indx
126 logical (c_bool) :: date_found
140 call assert(date_found,
"Failed to find a matching date value in the daily weather data table.", &
149 type (DATETIME_T),
intent(in) :: dt
150 real (kind=c_float),
intent(out) :: precip_value
162 type (DATETIME_T),
intent(in) :: dt
163 real (kind=c_float),
intent(out) :: tmax_value
174 type (DATETIME_T),
intent(in) :: dt
175 real (kind=c_float),
intent(out) :: tmin_value
This module contains physical constants and convenience functions aimed at performing unit conversion...
logical(c_bool), parameter, public true
logical(c_bool), parameter, public false
real(c_double), parameter, public m_per_foot
This module contains the DATETIME_T class and associated time and date-related routines,...
subroutine, public warn(smessage, smodule, iline, shints, lfatal, iloglevel, lecho)
subroutine, public die(smessage, smodule, iline, shints, scalledby, icalledbyline)
real(c_float), parameter, private na_float
real(c_float), parameter, public na_float
type(logfile_t), public logs
type(parameters_t), public params
type(date_range_t), public sim_dt
subroutine weather_data_tabular_initialize()
subroutine weather_data_tabular_get_tmin(dt, tmin_value)
subroutine weather_data_find_date_indx(dt)
real(c_float), dimension(:), allocatable tmax
real(c_float), dimension(:), allocatable precip
real(c_float), dimension(:), allocatable tmin
subroutine weather_data_tabular_get_precip(dt, precip_value)
integer(c_int), save, private date_indx
subroutine weather_data_tabular_get_tmax(dt, tmax_value)
type(datetime_t), dimension(:), allocatable weather_date