Skip to content

config/parameters.py — unused entries, duplicate literal values, and dual-purpose parameter #127

Description

@danbroman

Cleanup notes for config/parameters.py

While reviewing config/parameters.py against the rest of the codebase, I found a few issues worth tracking for later cleanup.


1. A couple of hardcoded values in reservoirs/state.py that should really be named parameters

There are two bare numbers in reservoirs/state.py that aren't defined anywhere in parameters.py.

Line 24:

self.reservoir_storage_operation_year_start = 0.85 * grid.reservoir_storage_capacity

This sets the initial fill level (as a fraction of capacity) for reservoir_storage_operation_year_start — basically a snapshot of storage taken at the start of each operating year, used later in the Biemans k-factor calculation.

Line 27:

default_storage = 0.9 * grid.reservoir_storage_capacity

This is just the default starting reservoir storage used when no initial storage is provided.

Suggested fix: add two new parameters and pass them into initialize_reservoir_state():

reservoir_initial_op_year_storage_fraction = 0.85   # cold-start fill for op-year-start storage
reservoir_default_initial_storage_fraction = 0.9    # default value when no value is provided in the reservoir parameters file

2. A few parameters that aren't actually used anywhere

Three entries in Parameters.__init__ are defined but never referenced anywhere else in the code:

Parameter Value Comment in file
small_value 1.0e-10 "small value, for less precise arithmetic"
effective_tracer_velocity 10.0 "liquid/ice effective velocity" (already flagged with a TODO)
ICE_TRACER 1 Paired with LIQUID_TRACER, but the ice path was never built

3. One parameter is doing two unrelated jobs

reservoir_runoff_capacity_parameter = 0.1 is currently used for two unrelated purposes:

  1. Minimum storage floor (reservoirs/grid.py:65,69) — used as a fallback for reservoir_minimum_storage when CAP_MIN is missing or invalid. Here it's interpreted as a fraction of storage capacity.
  2. Runoff-capacity threshold (reservoirs/release.py:67, reservoirs/regulation.py:46) — used as a threshold in the Biemans release condition and as a minimum-flow floor during regulation. Here it's interpreted as a flow-to-capacity ratio.

4. General state of parameters.py

There's already a TODO on line 10 acknowledging that documentation and configurability need work. A lot of entries are missing docstrings or units, which makes it harder to tell what's safe to change. As a follow-up, it'd be good to add units and short descriptions to each parameter, and think about whether some of these should live in config_defaults.yaml instead of being hardcoded, edit-only Python constants.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions