32 integer (c_int) :: inumberoflanduses
33 logical (c_bool) :: larelengthsequal
34 character (len=:),
allocatable :: stemp
38 character (len=32) :: str_buffer
39 real (c_float),
allocatable :: temp_values(:)
40 integer (c_int) :: indx
41 integer (c_int) :: status
42 integer (c_int) :: count_gdd_start
43 integer (c_int) :: count_killing_frost_end
44 integer (c_int) :: count_grow_start
45 integer (c_int) :: count_grow_end
49 call params%get_parameters( skey=stemp, &
55 call sl_temp_list%clear()
56 call sl_temp_list%append(
"First_day_of_growing_season")
57 call sl_temp_list%append(
"First_DOY_growing_season")
58 call sl_temp_list%append(
"Growing_season_start")
59 call sl_temp_list%append(
"Growing_season_begin")
61 call params%get_parameters( slkeys=sl_temp_list, &
62 slvalues=sl_growing_season_begin, &
68 call assert( status==0,
"Problem allocating memory.", __file__, __line__ )
70 if ( sl_growing_season_begin%count == inumberoflanduses &
71 .and. sl_growing_season_begin%count_matching(
"<NA>") == 0 )
then
73 do indx = 1, sl_growing_season_begin%count
74 str_buffer = sl_growing_season_begin%get( indx )
90 call sl_temp_list%clear()
91 call sl_temp_list%append(
"Last_day_of_growing_season")
92 call sl_temp_list%append(
"Last_DOY_growing_season")
93 call sl_temp_list%append(
"Growing_season_end")
94 call sl_temp_list%append(
"Growing_season_stop")
96 call params%get_parameters( slkeys=sl_temp_list, &
97 slvalues=sl_growing_season_end, &
103 call assert( status==0,
"Problem allocating memory.", __file__, __line__ )
105 if ( sl_growing_season_end%count == inumberoflanduses &
106 .and. sl_growing_season_end%count_matching(
"<NA>") == 0 )
then
108 do indx = 1, sl_growing_season_end%count
109 str_buffer = sl_growing_season_end%get( indx )
124 call sl_temp_list%clear()
125 call sl_temp_list%append(
"GDD_first_day_of_growing_season")
126 call sl_temp_list%append(
"GDD_start_of_growing_season")
127 call sl_temp_list%append(
"GDD_growing_season_start")
129 call params%get_parameters( slkeys=sl_temp_list, &
130 fvalues=temp_values, &
133 larelengthsequal = ( ubound(temp_values,1) == ubound(
ilandusecodes,1) )
135 if ( larelengthsequal )
then
141 call warn( smessage=
"The number of landuses does not match the number of GDD values " &
142 //
"specified for defining the beginning of the growing season.", &
143 smodule=__file__, iline=__line__, lfatal=
false )
146 call assert( status==0,
"Problem allocating memory.", __file__, __line__)
153 call sl_temp_list%clear()
154 call sl_temp_list%append(
"Killing_frost_temperature")
155 call sl_temp_list%append(
"Air_temperature_end_of_growing_season")
156 call sl_temp_list%append(
"Air_temperature_growing_season_end")
158 call params%get_parameters( slkeys=sl_temp_list, &
159 fvalues=temp_values, &
162 larelengthsequal = ( ubound(temp_values,1) == ubound(
ilandusecodes,1) )
164 if ( larelengthsequal )
then
170 call warn( smessage=
"The number of landuses does not match the number of killing frost values " &
171 //
"specified to define the end of the growing season.", &
172 smodule=__file__, iline=__line__, lfatal=
false )
175 call assert( status==0,
"Problem allocating memory.", __file__, __line__)
186 if ( (count_gdd_start == 0) .and. (count_killing_frost_end == 0) &
187 .and. (count_grow_start == 0) .and. (count_grow_end == 0) ) &
188 call warn( smessage=
"A pair of values (GDD or DOY) must be given to " &
189 //
"define the start and end of the growing season for each landuse" &
190 //
" present in the lookup table.", lfatal=
true)
192 if ( count_gdd_start /= count_killing_frost_end ) &
193 call warn( smessage=
"Unequal numbers of values given for defining the " &
194 //
"start (GDD_first_day_of_growing_season) and end (Killing_frost_temperature) " &
195 //
"of the growing season.", smodule=__file__, iline=__line__, lfatal=
true )
197 if ( count_grow_start /= count_grow_end ) &
198 call warn( smessage=
"Unequal numbers of values given for defining the " &
199 //
"start (Growing_season_start) and end (Growing_season_end) of the " &
200 //
"growing season.", smodule=__file__, iline=__line__, lfatal=
true )
202 if ( ( (count_gdd_start + count_grow_start) /= ubound(
ilandusecodes, 1) ) &
203 .and. ( (count_gdd_start + count_grow_start) > 0 ) ) &
204 call warn( smessage=
"Two growing season start definitions " &
205 //
"(GDD_first_day_of_growing_season and Growing_season_start) are " &
206 //
"provided for one or more land uses. Only one of these values " &
207 //
"should be non-zero for each entry the lookup table.", &
208 smodule=__file__, iline=__line__, lfatal=
true )
210 if ( ( (count_killing_frost_end + count_grow_end) /= ubound(
ilandusecodes, 1) ) &
211 .and. ( (count_killing_frost_end + count_grow_end) > 0) ) &
212 call warn( smessage=
"Two growing season ending definitions " &
213 //
"(Killing_frost_temperature and Growing_season_end) are " &
214 //
"provided for one or more land uses. Only one of these values " &
215 //
"should be non-zero for each entry the lookup table.", &
216 smodule=__file__, iline=__line__, lfatal=
true )