Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rte): Fixed issues pertaining to
fhr
.
One of the changes by MESH-Model/MESH_Code@52c7367 "LongSimFix" was to revise the use of `fhr` from tracking incremental hours in the simulation to always being equal to `1`. When originally implemented, a temporary fix for observed variables arbitrarily allocated these arrays to `999999` blocks (observation hours). This caused issues for simulations exceeding 999999 hours (approx.. 114 years); for example, climate simulations from 1980 to 2100, which likely would cause an index out-of-bounds error in 2094 or later. Changes by @mee067 to address this removed the allocation of these variables from `999999` to `(:, 1)`, setting the current record `fhr` always equal to `1`. However, the change only initialized `fhr = 1` when resumed from `seq` format resume files. `fhr` not being properly initialized without this condition seems to have contributed to the corruption of data used by the module, i.e., the record of observations index by gauge ID, causing the indexing issue observed with the streamflow observations printed by `save_basin_output`. Adding the same condition, `fhr = 1`, during initialization resolves this issue. ```f90 !> Set fhr to 1 (the counting of incremental hours in the routing simulation is not used like it is in standalone WATROUTE). fhr = 1 ``` Setting `fhr = 1` was correctly implemented in ab89db4. However, further modifications have been carried over to allocate the affected variables to `fhr` than to `1`, so the connection to this dimension is clearer. Changes have also been made when resuming from the `seq` format resume files for the case when the file was written by a previous version of the code where `fhr /= 1`. ```f90 real(kind = 4), dimension(:, :), allocatable :: lake_elv_temp ... if (fms%rsvr%n > 0) then allocate(lake_elv_temp(noresv, fhr)) read(iun) lake_elv_temp(:, fhr) lake_elv(:, 1) = lake_elv_temp(:, fhr) else read(iun) end if ... !> Set fhr to 1 (the counting of incremental hours in the routing simulation is not used like it is in standalone WATROUTE). fhr = 1 ```
- Loading branch information