4.2.4. IMPLND Water Movement and Storage

Water movement and storage calculations, logic, and data structures for impervious land segments (IMPLND).

4.2.4.1. locaHimpwat.py

Replacement for HSPsquared himpwat that provides for water movement and storage in impervious land segments, IMPLND.

Had to replace HSP2 himpwat so that can break into the main time loop at the beginning and end of each day. This required fundamentally restructuring the storage and memory allocation within HSP2.

locaHimpwat functions as a module handling storage for global IMPLND variables as well as for parameter and constant definitions.

Internal time unit DELT60 is in hours for IMPLND.

locaHimpwat.BAD_OUTPUT_LIST = []

Currently unsupported outputs

locaHimpwat.CSNOFG = None

Switch to turn on consideration of snow accumulation and melt.

SNOW is not currently supported.

locaHimpwat.DEF_DT = None

The data type specification for time series structured array or record array

locaHimpwat.DELT60 = None

Time step in hours to use in calculations

locaHimpwat.ERRMSG = ['IWATER: IROUTE Newton Method did not converge']

Defined error messages from HSPF.

Used with errorsV for error handling. Currently, these messages written to the log file as errors when encountered.

locaHimpwat.FLAG_DT = None

The data type specification for flag record arrays

locaHimpwat.FLAG_GOOD = ['CSNOFG', 'RTLIFG', 'RTOPFG', 'VNNFG', 'VRSFG']

Flags that are at least referenced in mHSP2.

locaHimpwat.FLAG_UNUSED = []

Flags that are completely unused in mHSP2

locaHimpwat.GOOD_OUTPUT_LIST = ['IMPEV', 'IMPS', 'PET', 'PETADJ', 'RETS', 'SUPY', 'SURI', 'SURO', 'SURS']

List of currently supported outputs that can be written to the HDF5 file

locaHimpwat.HOLD_DEC = None

Carry over calculation variable in case simulation is not daily

locaHimpwat.HOLD_MSUPY = None

Value of MSUPY to cover over between time steps

locaHimpwat.HOLD_SRC = None

Carry over calculation variable in case simulation is not daily

locaHimpwat.HR1FG = None

True at 1 am every day

locaHimpwat.IMPEV = None

Total simulated ET for impervious, inches/ivld

locaHimpwat.IMPS = None

Total water stored in impervious lands, inches

locaHimpwat.INFLOW_TS_GOOD = ['PREC', 'PETINP']

All supported inflow time series in mHSP2

locaHimpwat.INFLOW_TS_UNUSED = ['AIRTMP', 'GATMP', 'DTMPG', 'WINMOV', 'SOLRAD', 'CLOUD', 'SLSLD', 'IQADFX', 'IQADCN', 'RAINF', 'SNOCOV', 'WYIELD', 'PACKI']

Unsupported inflow time series

locaHimpwat.I_RETS = None

Initial retention, or interception, storage in inches

locaHimpwat.I_SURS = None

Initial surface or overland flow storage in inches

locaHimpwat.KEY_TS_PET = 'PETINP'

External time series key for input PET

locaHimpwat.KEY_TS_PRECIP = 'PREC'

External time series key for precipitation

locaHimpwat.LATIN_CONTROL = None

Control structure telling which lateral inflows are active

locaHimpwat.LAT_INFLOW_TS = ['SURLI']

List of possible lateral inflow time series

locaHimpwat.LSUR = None

Length of the assumed overland flow plane in feet

locaHimpwat.MAXLOOPS = 100

Newton method max loop iterations.

locaHimpwat.MON_FLAGS = ['VNNFG', 'VRSFG']

Flag names for monthly flags

locaHimpwat.MON_PARAMS = ['NSURM', 'RETSCM']

Parameter names for values that can be specified as monthly

locaHimpwat.NSUR = None

Manning’s n for the assumed overland flow plane use English/Standard units versions from tables.

locaHimpwat.NSURM = None

Monthly overland flow Manning’s n

locaHimpwat.OUTPUT_CONTROL = None

Control structure telling which time series are to be output

locaHimpwat.PARAM_GOOD = ['LSUR', 'NSUR', 'PETMAX', 'PETMIN', 'RETSC', 'SLSUR']

Input, non-state parameters that are used in mHSP2

locaHimpwat.PARAM_UNUSED = []

Input parameters that unused in mHSP2

locaHimpwat.PET = None

Potential evapotranspiration, inches/ivld

locaHimpwat.PETADJ = None

Adjusted PET from air temperature limits, inches/ivld

locaHimpwat.PETMAX = None

Air temperature below which ET will be arbitrarily reduced.

Only used if CSNOFG == 1. Units are degrees Fahrenheit. SNOW is not supported so this is not used.

locaHimpwat.PETMIN = None

Air temperature below which ET will be set to zero.

Only used if CSNOFG == 1. Units are degrees Fahrenheit. SNOW is not supported and this is not used.

locaHimpwat.RETS = None

Retention storage, inches

locaHimpwat.RETSC = None

Retention, or interception, storage capacity of the surface in inches

locaHimpwat.RETSCM = None

Monthly retention, or interception, storage capacity of the surface in inches

locaHimpwat.RTLIFG = None

Flag for handling retention storage on lateral surface inflow.

If == 1, then lateral surface inflow is subject to retention. For 0, not subject to retention

locaHimpwat.RTOPFG = None

Flag to select algorithm for overland flow.

RTOPFG == 1 then overland flow done as in predeccesor models - HSPX, ARM, and NPS. RTOPFG == 0 then a different algorithm is used.

locaHimpwat.SLSUR = None

Slope of the assumed overland flow plane, ft/ft

locaHimpwat.SPEC_DT = None

The data type specification for the calculation and input record arrays

locaHimpwat.STATE_PARMS = ['RETS', 'SURS']

The list of state parameters

locaHimpwat.SUPY = None

Moisture supplied to the land segment by precipitation, inches/ivld

locaHimpwat.SURI = None

Surface storage inflow, inches/ivld

locaHimpwat.SURLI = None

Surface storage lateral inflow external time series, inches/ivld

locaHimpwat.SURO = None

Surface storage outflow, inches/ivld

locaHimpwat.SURS = None

Surface storage, inches

locaHimpwat.TOLERANCE = 0.01

Tolerance for Newton method convergence

locaHimpwat.VNNFG = None

Flag for using monthly variation in Manning’s n for overland flow

locaHimpwat.VRSFG = None

Flag for using monthly variation in retention storage capacity

locaHimpwat.WS_AREAS = None

Areas of impervious segments in acres

locaHimpwat.configExternalTS(sim_len, TSMapList, AllTSDict)

Transfer external time series from HDF5 input to module data structures

Parameters
  • sim_len (int) – the length of the simulation

  • TSMapList (list) –

    nested list with sublists, L, of time series metadata for a particular target ID

    1. time series type

    2. time series ID

    3. target ID

  • AllTSDict (dict) – dictionary of time series by time series ID

Returns

function status; 0 == success

Return type

int

locaHimpwat.configFlagsParams(targID, cFlagVals, allIndexes)

Set and configure flags and parameters for PERLND

Parameters
  • targID (str) – the target location ID

  • cFlagVals (dict) – collected flag values

  • allIndexes (list) – list of indexes for cFlagVals

Returns

function status; 0 == success

Return type

int

locaHimpwat.errorsV = array([0])

Error tracking in liftedloop

locaHimpwat.getLatInflowByTypeTarget(targID, liType, iI)

Get a lateral inflow by type and target

Parameters
  • targID (str) – target ID

  • liType (str) – lateral inflow type

  • iI (int) – current time index

locaHimpwat.getSURObyTargTS(iI, targID)

Get the total outflow from impervious land, inches/day

Parameters
  • iI (int) – time step index to extract the storage values

  • targID (str) – current PERLND target

Returns

suro, total outflow in inches/day

Return type

float

locaHimpwat.getWatershedAreabyTarg(targID)

Get WS_AREA or watershed area by target id

Parameters

targID (str) – current PERLND target

Returns

watershed areas in acres

Return type

float

locaHimpwat.iwater_liftedloop(iI, mon, targID)

Modified version of liftedloop to do a single time step and return to the main time loop.

Module-wide recarrays are used to store all results and calculation variables between calls. Modified real number comparisons to be more numerically reliable.

Parameters
  • iI (int) – index of current time step (0 to (sim_len-1))

  • mon (int) – current simulation month

  • targID (str) – ID for recarray columns

Returns

count of the number of errors. Should be 0, but this

provides a way to reference errorsV for error handling

Return type

int

locaHimpwat.setDelT(sim_delt)

Set the impervious land delt for calculations.

The delt is stored as a module wide global

Parameters

sim_delt (float) – overall simulation time step in minutes

locaHimpwat.setGoodFlag(targID, tFlag, fVal)

Set the value for the specified flag structure

Parameters
  • targID (str) – ID or recarray header to set

  • tFlag (str) – flag string to identify the data structure

  • fVal (int) – flag value to set

locaHimpwat.setGoodParam(targID, tParam, pVal)

Set the value for the specified parameter structure

Parameters
  • targID (str) – ID or recarray header to set

  • tParam (str) – param string to identify the data structure

  • pVal (float) – parameter value to set

locaHimpwat.setLatInflowTS(sim_len, targID, inflowType, tsVals)

Method to setup lateral inflow time series

Parameters
  • sim_len (int) – the simulation length

  • targID (str) – target ID

  • inflowType (str) – type of lateral inflow

  • tsVals (np.array) – array of time series values

locaHimpwat.setMonthlyParams(targID, monName, monTuple)

Set the value for the specified monthly parameter structures

Parameters
  • targID (str) – ID or recarray header to set

  • monName (str) – name for data structure to set the monthly values

  • monTuple (tuple) – tuple of 12 floats which are the values.

locaHimpwat.setOutputControlFlags(targID, savetable, stTypes)

Set the output control flags

Parameters
  • targID (str) – target id

  • savetable (np.array or dict) – boolean array of which outputs to save

  • stTypes (list) – keys or indexes to save

Returns

function status; 0 == success

Return type

int

locaHimpwat.setPETTS(targID, npTS)

Set the PET time series from one data set to one target.

PET is where pet is stored for calculations. Might be adjusted by various activities.

Parameters
  • targID (str) – the target identifier - must be same as used to create the rec array

  • npTS (np.array) – 1D array with the time series values

locaHimpwat.setPrecipTS(targID, npTS)

Set the precipitation time series from one data set to one target.

SUPY is where precipitation is stored for calculations

Parameters
  • targID (str) – the target identifier - must be same as used to create the rec array

  • npTS (np.array) – 1D array with the time series values

locaHimpwat.setStateParams(targID, tParam, pVal)

Set the value for the specified initial state structure

Parameters
  • targID (str) – ID or recarray header to set

  • tParam (str) – param string to identify the data structure

  • pVal (float) – parameter value to set

locaHimpwat.setUpRecArrays(pwList, sim_len)

Create and initialize impervious land output arrays

Parameters
  • pwList (list) – list of IDs for this target type

  • sim_len (int) – number of output intervals in the simulation

locaHimpwat.setWSAreas(targID, area)

Set the watershed area to the global information structure.

Area is in acres

Parameters
  • targID (str) – ID or recarray header to set

  • area (float) – area in acres

locaHimpwat.setupHR1FG(tIndex)

Set the module-level global HR1FG

Parameters

tIndex (pd.DateIndex) – datetime index for the simulation output

locaHimpwat.writeOutputs(store, tIndex)

Write the outputs to the hdf file at the end of the simulation

Parameters
  • store (pd.HDFStore) – hdf5 file store to write to

  • tIndex (pd.DateIndex) – time index for the simulation

Returns

function status; 0 == success

Return type

int