DrylandEcology / STEPWAT2

folder
4 stars 5 forks source link

Resolve patch temporarily put into place to ensure identical weather for each grid cell for the same seed #531

Open kpalmqui opened 1 year ago

kpalmqui commented 1 year ago

The following commit implemented a temporary patch to ensure that weather is identical among grid cells:

https://github.com/DrylandEcology/STEPWAT2/commit/47ad7e3cb9759106036d4561d89132e21f20acef

This patch needs to be resolved with a permanent solution once this commit is merged into the Seed_Dispersal branch.

The problem the patch addressed: gridded mode reproduces weather almost but not exactly among cells. The problem was that gridded mode used the last values in a year of one cell as first values of the next cell. This went mostly unnoticed but when the last day contains precipitation, then this affects the weather generator's behavior for the first day of the next cell.

The patch: (i) SOILWAT2's SW_WTH_init_run() did not zero out yesterday's weather values; this was an issue only for STEPWAT2's gridded mode which does not deconstruct/construct each SOILWAT2 run (fixed with commit https://github.com/DrylandEcology/STEPWAT2/commit/8a0a7546a01b9224d85481e848c81956374d6aeb). (ii) STEPWAT2's load_cell() did not call SW_CTL_init_run() (and SW_WTH_init_run()) or equivalently to prevent the carry-over of values from one cell to the next (fixed with this commit).

However and ideally, a grid cell should continue with the state that it ended at during the previous year (and not be zeroed out). This is especially not ideal for soil moisture because the patch re-sets SOILWAT2's variables at the beginning of each year (and each cell!) to zero.

Potential solutions: