respec / HSPsquared

Hydrologic Simulation Program Python (HSPsquared)
GNU Affero General Public License v3.0
43 stars 17 forks source link

Implement GENER and related operations #57

Closed aufdenkampe closed 2 years ago

aufdenkampe commented 2 years ago

The GENER module is used extensively to compute (within the model) constituent loads based on input flow and concentration, with one or both being a time series.

These capabilities are used extensively several of our HSP2 use cases

@ptomasula is getting started on this.

aufdenkampe commented 2 years ago

From @ptomasula's 2021-08-20 "HSP2: GENER Module LOE" email:

Supporting the GENER functionality as implemented by our use case test is notably more complicated than just writing the GENER module (which in itself is actually relatively straight forward).

Here’s a rough outline of the steps that need to be taken:

  1. Update the UCI reader:
    • Modify function that processes OPSEQ block to import both the COPY and GENER operations.
    • Also import the GENER and COPY block, which necessitates adding new tables to the HDF5 files and writing new functions in the UCI reader.
    • Modify functions that process NETWORK and SEQUENCE blocks to import COPY and GENER related links.
    • Modify function that processes EXT SOURCES block to import COPY related lines.
  2. Write COPY module, which should essentially be a class that reads timeseries as specified in EXT SOURCES and holds those timeseries in memory. There’s also the option to apply scaling factors, but we can use the main.read_timeseries function as a template.
  3. Write GENER module, which is also a class that should be able to hold the timeseries, post calculation, in memory.
  4. Add new dictionaries to main.py to store and track COPY and GENER class instances.
  5. Add new function that can be called at beginning of RCHRES, PERLAN, and IMPLND to fetch data from the appropriate COPY/GENER instances where applicable. This is similar to the existing get_flows function in main.py but with some notable differences that warrant this being a separate function.
aufdenkampe commented 2 years ago

This PR https://github.com/LimnoTech/HSPsquared/pull/41 largely addresses the need for GENER and related operations. Although there are a few related capabilities that have not been addressed, we can close this issue after LimnoTech issues a PR to RESPEC.

aufdenkampe commented 2 years ago

Merging PR #61 will close this issue.

aufdenkampe commented 2 years ago

Closed with #62 and release 0.9.3.