Closed BrianCollinss closed 5 years ago
when I add a new module which calculates hourly temperature and VPD, APSIM-NG throws an exception
Do you mean you've added a new model to the source code? If so, could you do a git push
of this change so that I can checkout your branch?
Otherwise, could you upload an .apsimx file which demonstrates the bug?
I have added something to my own branch which I am not ready to push. The problem is simply that when Tmin and Tmax are equal (and the shouldn't!), VPD would be zero which is wrong. I added two lines to make sure when this happens, Tmax=Tmin+1, i.e. a dirty fix. My issue is general, i.e. met data should be checked, if they are currently not. Cheers.
Why can't TMax = TMin? There have been days when the temperature doesn't change at all. Rare but possible.
I don't say it cannot be. I just say then VPD would be zero the whole day (at least by assuming that Tmin=Tdew). I can hardly imagine a day without even a tiny fluctuation in temperature and VPD.
get
{
const double SVPfrac = 0.66;
double VPDmint = MetUtilities.svp((float)MinT) - VP;
VPDmint = Math.Max(VPDmint, 0.0);
double VPDmaxt = MetUtilities.svp((float)MaxT) - VP;
VPDmaxt = Math.Max(VPDmaxt, 0.0);
return SVPfrac * VPDmaxt + (1 - SVPfrac) * VPDmint;
}
I agree with Dean. There's no logical reason why you can't have a day with near-zero variation in temperature. For that matter, a result of 0 VPD actually makes sense under those conditions - a near-zero temperature variation would be most likely to occur under situations with very moist air. I can recall seeing a few foggy winter days that came pretty close to that scenario.
I agree with both of you. But if you look at the example I provided, you will see that the day before the highlighted day had a nearly similar vapour pressure (~18 hPa) and precipitation (~1 mm), while the diurnal temperature range is 11 degrees. Again, I do agree with the near zero variation, but not zero. Zero variation would cause a lot of 'computational' issues. For example in a TE-based approach what one should do with VPD=0 in the denominator of the equation (https://github.com/APSIMInitiative/ApsimX/blob/master/Models/Functions/DemandFunctions/TEWaterDemandFunction.cs)? Anyway, it was just a suggestion. I close the issue. Cheers.
I found this record in the SILO met file of the station Corrigin, with minimum and maximum temperature being equal. This has never caused APSIM-NG and classic APSIM to fail, but when I add a new module which calculates hourly temperature and VPD, APSIM-NG throws an exception. Some checking rules could be very helpful, if there is not any. For example, to replace maximum temperature with minimum temperature +1, if maximum and minimum are equal (just an example). I couldn't find any rules in ApsimTextFile.cs. Maybe it's not the right place to look at.