pywatershed.StarfitFlowNode#

class pywatershed.StarfitFlowNode(control, grand_id, initial_storage, start_time, end_time, inflow_mean, NORhi_min, NORhi_max, NORhi_alpha, NORhi_beta, NORhi_mu, NORlo_min, NORlo_max, NORlo_alpha, NORlo_beta, NORlo_mu, Release_min, Release_max, Release_alpha1, Release_alpha2, Release_beta1, Release_beta2, Release_p1, Release_p2, Release_c, GRanD_CAP_MCM, Obs_MEANFLOW_CUMECS, calc_method=None, io_in_cfs=True, compute_daily=False, nhrs_substep=np.float64(1.0), budget_type=None)[source]#

STARFIT FlowNode: Storage Targets And Release Function Inference Tool

This FlowNode implementation allows STARFIT solutions to be computed in a FlowGraph. The solution has the option for subtimestep or daily computations.

Daily computations have the same outflows on the substeps of a day and outflows and storages are calculated on the last subtimestep. On the first subtimestep, we use the inflow of the first subtimestep as representative of the mean inflow of the previous day in order to calculate an average outflow for the first timestep.

The STARFIT reference:

Sean W.D. Turner, Jennie Clarice Steyaert, Laura Condon, Nathalie Voisin, Water storage and release policies for all large reservoirs of conterminous United States, Journal of Hydrology, Volume 603, Part A, 2021, 126843, ISSN 0022-1694, https://doi.org/10.1016/j.jhydrol.2021.126843.

IMMM-SFA/starfit

Adapted from STARFIT implementation in the [MOSART-WM model](IMMM-SFA/mosartwmpy) Thurber, T., Rexer, E., Vernon, C., Sun, N., Turner, S., Yoon, J., Broman, D., & Voisin, N. (2022). mosartwmpy (Version 0.2.7) [Computer software]. IMMM-SFA/mosartwmpy

See FlowGraph for discussion and a worked example. The notebook examples/06_flow_graph_starfit.ipynb highlights adding a StarfitFlowNode a FlowGraph otherwised comprised of PRMSChannelFlowNodes using the helper functions prms_channel_flow_graph_to_model_dict() and prms_channel_flow_graph_postprocess().

Noah Knowles (USGS) and James McCreight (UCAR/USGS)

__init__(control, grand_id, initial_storage, start_time, end_time, inflow_mean, NORhi_min, NORhi_max, NORhi_alpha, NORhi_beta, NORhi_mu, NORlo_min, NORlo_max, NORlo_alpha, NORlo_beta, NORlo_mu, Release_min, Release_max, Release_alpha1, Release_alpha2, Release_beta1, Release_beta2, Release_p1, Release_p2, Release_c, GRanD_CAP_MCM, Obs_MEANFLOW_CUMECS, calc_method=None, io_in_cfs=True, compute_daily=False, nhrs_substep=np.float64(1.0), budget_type=None)[source]#

Initialize a StarfitFlowNode.

Parameters:
  • control (Control) – A Control object

  • grand_id (int64) – the GRanD id,

  • initial_storage (float64) – initial storage value, may be NaN to use the middle of the normal operating range.

  • start_time (datetime64) – May be NaN, the optional time at which to start simulating with STARFIT.

  • end_time (datetime64) – As for start_Time.

  • inflow_mean (float64) – STARFIT parameter.

  • NORhi_min (float64) – STARFIT parameter.

  • NORhi_max (float64) – STARFIT parameter.

  • NORhi_alpha (float64) – STARFIT parameter.

  • NORhi_beta (float64) – STARFIT parameter.

  • NORhi_mu (float64) – STARFIT parameter.

  • NORlo_min (float64) – STARFIT parameter.

  • NORlo_max (float64) – STARFIT parameter.

  • NORlo_alpha (float64) – STARFIT parameter.

  • NORlo_beta (float64) – STARFIT parameter.

  • NORlo_mu (float64) – STARFIT parameter.

  • Release_min (float64) – STARFIT parameter.

  • Release_max (float64) – STARFIT parameter.

  • Release_alpha1 (float64) – STARFIT parameter.

  • Release_alpha2 (float64) – STARFIT parameter.

  • Release_beta1 (float64) – STARFIT parameter.

  • Release_beta2 (float64) – STARFIT parameter.

  • Release_p1 (float64) – STARFIT parameter.

  • Release_p2 (float64) – STARFIT parameter.

  • Release_c (float64) – STARFIT parameter.

  • GRanD_CAP_MCM (float64) – STARFIT parameter.

  • Obs_MEANFLOW_CUMECS (float64) – STARFIT parameter.

  • calc_method (Literal['numba', 'numpy']) – One of “numba” or “numpy”.

  • io_in_cfs (bool) – Are the units in cubic feet per second? False gives units of cubic meters per second.

  • compute_daily (bool) – Daily or subtimestep calculation?

  • nhrs_substep (int) – Number of hours in the subtimestep.

  • budget_type (Literal['defer', None, 'warn', 'error']) – One of “defer”, “warn”, or “error”.

Methods

__init__(control, grand_id, initial_storage, ...)

Initialize a StarfitFlowNode.

advance()

Advance this FlowNode to the next timestep.

calculate_subtimestep(isubstep, ...)

Calculate the subtimestep.

finalize_timestep()

Finalize the current timestep at this FlowNode.

get_mass_budget_terms()

Get a dictionary of variable names for mass budget terms.

prepare_timestep()

Prepare the subtimestep for subtimestep calculations.

Attributes

outflow

The average outflow of the FlowNode over the current timestep.

outflow_substep

The outflow of the FlowNode over the sub-timestep.

release

The release component of the STARFIT outflow.

sink_source

The sink or source amount of the FlowNode at the current subtimestep.

spill

The spill component of the STARFIT outflow.

storage

The storage of the FlowNode at the current subtimestep.

storage_change

The storage change of the FlowNode at the current subtimestep.

advance()[source]#

Advance this FlowNode to the next timestep.

calculate_subtimestep(isubstep, inflow_upstream, inflow_lateral)#

Calculate the subtimestep.

Parameters:
  • isubstep (int) – Zero-based integer indicating the index of the current substep.

  • inflow_upstream (float) – The in-channel flows to this FlowNode on the current substep.

  • inflow_lateral (float) – The later flows to this FlowNode on the current substep.

finalize_timestep()[source]#

Finalize the current timestep at this FlowNode.

static get_mass_budget_terms()[source]#

Get a dictionary of variable names for mass budget terms.

property outflow: float64#

The average outflow of the FlowNode over the current timestep.

property outflow_substep: float64#

The outflow of the FlowNode over the sub-timestep.

prepare_timestep()[source]#

Prepare the subtimestep for subtimestep calculations.

property release: float64#

The release component of the STARFIT outflow.

property sink_source: float64#

The sink or source amount of the FlowNode at the current subtimestep.

property spill: float64#

The spill component of the STARFIT outflow.

property storage: float64#

The storage of the FlowNode at the current subtimestep.

property storage_change: float64#

The storage change of the FlowNode at the current subtimestep.