IDEMSInternational / R-Instat

A statistics software package powered by R
http://r-instat.org/
GNU General Public License v3.0
38 stars 102 forks source link

Reducing Evaporation in the Transform => Water Balance Dialogue not working as expected #8891

Closed jkmusyoka closed 1 month ago

jkmusyoka commented 4 months ago

@MeSophie and @lilyclements see below feedback from CIMH about reducing evaporation in the transform dialogue

"One more thing we have noticed in the water balance under transform, 'reducing' evaporation doesn't work, we are getting the same values as though it wasn't selected. When 'reducing' is selected the reduction in available water/water balance should decrease at a decreasing rate if available water/water balance is less than the critical value. It gives the same values as if not selected"

lilyclements commented 4 months ago

@jkmusyoka thanks for this. Is this in the Transform dialog, not the "End Rains" dialog (under the "End of Season" tab)? I believe it's not yet set up in the transform dialog, so I'm very sorry for the confusion there. Does it work in the end of season dialog for them, or is that an issue too?

jkmusyoka commented 4 months ago

@lilyclements the reducing evaporation in the end of season dialogue works ok

MeSophie commented 3 months ago

@lilyclements Here is the code comes from Climatic Transform Water dialog without reducing

transform_calculation <- instat_calculation$new(type="calculation", function_exp="Reduce(function(x, y) pmin(pmax(x + y - 5, 0), 60), rain, accumulate=TRUE)", result_name="water", manipulations=list(), save=2, before=FALSE, adjacent_column="rain", calculated_from=list("dodoma"="rain"))
data_book$run_instat_calculation(calc=transform_calculation, display=FALSE)
rm(transform_calculation)

Please I'm correct to Said that the code for reducing we be like this?

transform_calculation <- instat_calculation$new(type="calculation", function_exp="Reduce(function(x, y) pmin(pmax(x + y - WB_evaporation(x , 0.5, 100, 5, y), 0), 60), rain, accumulate=TRUE)", result_name="water", manipulations=list(), save=2, before=FALSE, adjacent_column="rain", calculated_from=list("dodoma"="rain"))
data_book$run_instat_calculation(calc=transform_calculation, display=FALSE)
rm(transform_calculation)

Do I also need to change Reduce function to accumulate/accumulate2?

lilyclements commented 3 months ago

@MeSophie do we want this dialog to work the same as the End of Seasons dialog? That was my understanding, but perhaps there's some amendments wanted by @rdstern. @rdstern can you confirm?

rdstern commented 3 months ago

It should work exacly the same as the End of Season. It is just a transformation of the daily data, so you should be able to examine, or summarise those data and understand the results from the end of season dialog better.