pywatershed.PRMSSnow#

class pywatershed.PRMSSnow(control, discretization, parameters, orad_hru, soltab_horad_potsw, swrad, hru_intcpevap, hru_ppt, potet, pptmix, prmx, tavgc, tmaxc, tminc, net_ppt, net_rain, net_snow, transp_on, budget_type='defer', calc_method=None, verbose=None)[source]#

PRMS snow pack.

A snow representation from PRMS.

Implementation based on PRMS 5.2.1 with theoretical documentation given in the PRMS-IV documentation:

Markstrom, S. L., Regan, R. S., Hay, L. E., Viger, R. J., Webb, R. M., Payn, R. A., & LaFontaine, J. H. (2015). PRMS-IV, the precipitation-runoff modeling system, version 4. US Geological Survey Techniques and Methods, 6, B7.

Parameters:
  • control (Control) – a Control object

  • discretization (Parameters) – a discretization of class Parameters

  • parameters (Parameters) – a parameter object of class Parameters

  • orad_hru (Union[str, Path, ndarray, Adapter]) – Solar radiation on a horizontal surface for each HRU

  • soltab_horad_potsw (Union[str, Path, ndarray, Adapter]) – Potential solar radiation on a horizontal plane for each Julian Day for each

  • swrad (Union[str, Path, ndarray, Adapter]) – Shortwave radiation distributed to each HRU

  • hru_intcpevap (Union[str, Path, ndarray, Adapter]) – HRU area-weighted average evaporation from the canopy for each HRU

  • hru_ppt (Union[str, Path, ndarray, Adapter]) – Precipitation distributed to each HRU

  • potet (Union[str, Path, ndarray, Adapter]) – Potential ET for each HRU

  • pptmix (Union[str, Path, ndarray, Adapter]) – Flag to indicate if precipitation is a mixture of rain and snow for each HRU

  • prmx (Union[str, Path, ndarray, Adapter]) – Fraction of rain in a mixed precipitation event for each HRU

  • tavgc (Union[str, Path, ndarray, Adapter]) – Average air temperature distributed to each HRU

  • tmaxc (Union[str, Path, ndarray, Adapter]) – Maximum air temperature distributed to each HRU

  • tminc (Union[str, Path, ndarray, Adapter]) – Minimum air temperature distributed to each HRU

  • net_ppt (Union[str, Path, ndarray, Adapter]) – Precipitation (rain and/or snow) that falls through the canopy for each HRU

  • net_rain (Union[str, Path, ndarray, Adapter]) – Rain that falls through canopy for each HRU

  • net_snow (Union[str, Path, ndarray, Adapter]) – Snow that falls through canopy for each HRU

  • transp_on (Union[str, Path, ndarray, Adapter]) – Flag indicating whether transpiration is occurring (0=no;1=yes)

  • budget_type (Literal['defer', None, 'warn', 'error']) – one of [“defer”, None, “warn”, “error”] with “defer” being the default and defering to control.options[“budget_type”] when available. When control.options[“budget_type”] is not avaiable, budget_type is set to “warn”.

  • calc_method (Literal['numba', 'numpy']) – one of [“fortran”, “numba”, “numpy”]. None defaults to “numba”.

  • verbose (bool) – Print extra information or not?

__init__(control, discretization, parameters, orad_hru, soltab_horad_potsw, swrad, hru_intcpevap, hru_ppt, potet, pptmix, prmx, tavgc, tmaxc, tminc, net_ppt, net_rain, net_snow, transp_on, budget_type='defer', calc_method=None, verbose=None)[source]#

Methods

__init__(control, discretization, ...[, ...])

advance()

Advance the Process in time.

calculate(time_length, **kwargs)

Calculate Process terms for a time step

description()

A dictionary description of this Process.

finalize()

Finalizes the Process, including output methods.

get_dimensions()

Get a tuple of dimension names for this Process.

get_init_values()

Get a dictionary of initialization values for each public variable.

get_inputs()

Get a tuple of input variable names for this Process.

get_mass_budget_terms()

Get a dictionary of variable names for mass budget terms.

get_parameters()

Get a tuple of parameter names for this Process.

get_restart_variables()

Get a list of restart varible names.

get_variables()

Get a tuple of (public) variable names for this Process.

initialize_netcdf([output_dir, ...])

Initialize NetCDF output.

output()

Output data to previously initialized output types.

output_to_csv(pth)

Save each output variable to separate csv file in specified path

set_input_to_adapter(input_variable_name, ...)

Set input variables to adapter.current and manage the adapter.

set_snow_zero()

Attributes

dimensions

A tuple of parameter names.

init_values

A dictionary of initial values for each public variable.

inputs

A tuple of input variable names.

mass_budget_terms

A dictionary of variable names for the mass budget terms.

parameters

A tuple of parameter names.

restart_variables

A tuple of restart variable names.

variables

A tuple of public variable names.

advance()#

Advance the Process in time.

Returns:

None

calculate(time_length, **kwargs)#

Calculate Process terms for a time step

Parameters:

simulation_time – current simulation time

Return type:

None

Returns:

None

classmethod description()#

A dictionary description of this Process.

Return type:

dict

Returns:

All metadata for all variables in inputs, variables,parameters, and mass_budget_terms for this Process.

property dimensions: tuple#

A tuple of parameter names.

finalize()#

Finalizes the Process, including output methods. :rtype: None :returns: None

static get_dimensions()[source]#

Get a tuple of dimension names for this Process.

Return type:

tuple

static get_init_values()[source]#

Get a dictionary of initialization values for each public variable.

Return type:

dict

static get_inputs()[source]#

Get a tuple of input variable names for this Process.

Return type:

tuple

static get_mass_budget_terms()[source]#

Get a dictionary of variable names for mass budget terms.

static get_parameters()[source]#

Get a tuple of parameter names for this Process.

Return type:

tuple

static get_restart_variables()[source]#

Get a list of restart varible names.

Return type:

tuple

classmethod get_variables()#

Get a tuple of (public) variable names for this Process.

Return type:

tuple

property init_values: dict#

A dictionary of initial values for each public variable.

initialize_netcdf(output_dir=None, separate_files=None, budget_args=None, output_vars=None, extra_coords=None, addtl_output_vars=None)#

Initialize NetCDF output.

Parameters:
  • output_dir ([<class ‘str’>, <class ‘pathlib.Path’>]) – base directory path or NetCDF file path if separate_files is True

  • separate_files (bool) – boolean indicating if storage component output variables should be written to a separate file for each variable

  • output_vars (list) – list of variable names to outuput.

Return type:

None

Returns:

None

property inputs: tuple#

A tuple of input variable names.

property mass_budget_terms: dict#

A dictionary of variable names for the mass budget terms.

output()#

Output data to previously initialized output types. :rtype: None :returns: None

output_to_csv(pth)#

Save each output variable to separate csv file in specified path

property parameters: tuple#

A tuple of parameter names.

property restart_variables: tuple#

A tuple of restart variable names.

set_input_to_adapter(input_variable_name, adapter)#

Set input variables to adapter.current and manage the adapter.

TODO: make this private?

Parameters:
  • input_variable_name (str) – key of input variable

  • adapter (Adapter) – the Adapter for the input.

static set_snow_zero()[source]#
property variables: tuple#

A tuple of public variable names.