Skip to content

Add range constraints to model inputs and throw error for out of range inputs #278

@dlebauer

Description

@dlebauer

Increase validation of inputs (especially .param and .clim), by enforcing bounds, including:

  • many parameters have a lower bound at 0,
    • e.g. first order rate parameters (k values)
    • precip, irrigation, events
  • most or all fraction parameters should be bound [0,1] <-- exceptions to be confirmed
    • variables with 'frac', in name
    • variables with 'allocation' in name, but note:
      • ensureAllocation() checks each is <1 and all sum to 1, but not that individual terms are non-negative
      • coarseRootAllocation is computed internally and out of scope for this issue
    • frozenSoilEff, frozenSoilFolREff
    • Clarify nVolatilizationFrac and nLeachingFrac units. These are fraction per day (day^-1), but state.h calls them unitless fractions
  • anaerobicTransExp should be bound at >=1 (per docs, empirically)

Error if inputs are out of bounds. Current behavior mixes clipping and errors, prefer errors to avoid making upstream errors invisible.

Out of scope:

  • physics/biogeochem-informed bounds except where part of documented model structure (anaerobicTransExp)
  • bounds on internal variables and outputs. For some of these we could use very wide sanity-check bounds like those in https://betydb.org/api/v1/variables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions