drww / newhall

A Java implementation of the Newhall model for soil temperature and moisture regime determination. Given a year of monthly averages for precipitation and temperature at a location, the model will simulate the recharge and discharge of moisture through the underlying soil.
Other
5 stars 2 forks source link

Edge case on high-temp, southern locations. Tempcal ntd[] is full of nulls out of the model. #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Occurs on datasets 169013 and 20080, these will be added to the unit tests 
after this has been completed.

When model produces a results object, the input ntd[] array is full of nulls 
for some reason.  This has a negative impact on everything else as a result.

Original issue reported on code.google.com by edwalt...@gmail.com on 26 Jul 2011 at 7:55

GoogleCodeExporter commented 9 years ago
None of the conditions to set ntd[] variables in BasicSimulationModel are being 
hit during the execution of these datasets.  These population routines are all 
inside an if() block that checks to see if:

if (tc != 0 || tu != 0) {

These conditions are not being satisfied.

Original comment by edwalt...@gmail.com on 26 Jul 2011 at 8:06

GoogleCodeExporter commented 9 years ago
In one of the test datasets, MEAD89, the following is true for its run:

tc = -1, tu = 0

Original comment by edwalt...@gmail.com on 26 Jul 2011 at 8:08

GoogleCodeExporter commented 9 years ago
In MEAD89, the tc variable is only ever modified twice, two set it to -1 both 
times.  Conditions to set tc to -1 does not occur in 169013 and 20080.

The condition skipTo890 has been flagged true, setting tc to 0.  Again around 
920, tc is getting set to 0 again, this is because tempUnder8C has been flagged 
false, which speaks toward the kind of datasets that we are encountering this.

Two conditions cause skipTo890 to occur:  np = 0 and wt <= 5

Original comment by edwalt...@gmail.com on 26 Jul 2011 at 8:21

GoogleCodeExporter commented 9 years ago
The temperature calculator is short circuiting because no temperatures under 8 
degrees Celsius are being detected.  As such, the entire temperature calendar 
would be full of 8's for "in excess of 8C".

What should occur is the total population of the temperature calendar with 8's. 
 However, I will verify what the BASIC model does under DOS with these datasets.

Original comment by edwalt...@gmail.com on 26 Jul 2011 at 8:25

GoogleCodeExporter commented 9 years ago
Added special behavior for this edge case in the model.  Seems to fix 
everything and match FLEXNSM behavior.  Unit tests still required.

Original comment by edwalt...@gmail.com on 26 Jul 2011 at 9:29

GoogleCodeExporter commented 9 years ago
Unit tests added, and they pass.  Problem fixed in 1.4.5.

Original comment by edwalt...@gmail.com on 26 Jul 2011 at 9:38