pywatershed.PRMSRunoff#
- class pywatershed.PRMSRunoff(control, discretization, parameters, soil_lower_prev, soil_rechr_prev, net_ppt, net_rain, net_snow, potet, snowmelt, snow_evap, pkwater_equiv, pptmix_nopack, snowcov_area, through_rain, hru_intcpevap, intcp_changeover, dprst_flag=None, budget_type='defer', calc_method=None, verbose=None)[source]#
PRMS surface runoff.
A surface runoff representation from PRMS.
Implementation based on PRMS 5.2.1 with theoretical documentation given in the PRMS-IV documentation:
- Parameters:
control (
Control) – a Control objectdiscretization (
Parameters) – a discretization of class Parametersparameters (
Parameters) – a parameter object of class Parameterssoil_lower_prev (
Union[str,Path,ndarray,Adapter]) – Previous storage of lower reservoir for each HRUsoil_rechr_prev (
Union[str,Path,ndarray,Adapter]) – Previous storage of recharge reservoir for each HRUnet_ppt (
Union[str,Path,ndarray,Adapter]) – Precipitation (rain and/or snow) that falls through the canopy for each HRUnet_rain (
Union[str,Path,ndarray,Adapter]) – Rain that falls through canopy for each HRUnet_snow (
Union[str,Path,ndarray,Adapter]) – Snow that falls through canopy for each HRUpotet (
Union[str,Path,ndarray,Adapter]) – Potential ET for each HRUsnowmelt (
Union[str,Path,ndarray,Adapter]) – Snowmelt from snowpack on each HRUsnow_evap (
Union[str,Path,ndarray,Adapter]) – Evaporation and sublimation from snowpack on each HRUpkwater_equiv (
Union[str,Path,ndarray,Adapter]) – Snowpack water equivalent on each HRUpptmix_nopack (
Union[str,Path,ndarray,Adapter]) – Flag indicating that a mixed precipitation event has occurred with no snowpacksnowcov_area (
Union[str,Path,ndarray,Adapter]) – Snow-covered area on each HRU prior to melt and sublimation unless snowpackthrough_rain (
Union[str,Path,ndarray,Adapter]) – Rain that passes through snow when no snow presenthru_intcpevap (
Union[str,Path,ndarray,Adapter]) – HRU area-weighted average evaporation from the canopy for each HRUintcp_changeover (
Union[str,Path,ndarray,Adapter]) – Canopy throughfall caused by canopy density change from winter to summerdprst_flag (
bool) – use depression storage or not? None uses value in control file, which otherwise defaults to True.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 [“numba”, “numpy”]. None defaults to “numba”.verbose (
bool) – Print extra information or not?
- __init__(control, discretization, parameters, soil_lower_prev, soil_rechr_prev, net_ppt, net_rain, net_snow, potet, snowmelt, snow_evap, pkwater_equiv, pptmix_nopack, snowcov_area, through_rain, hru_intcpevap, intcp_changeover, dprst_flag=None, budget_type='defer', calc_method=None, verbose=None)[source]#
Methods
__init__(control, discretization, ...[, ...])advance()Advance the Process in time.
This is trying to replicate the prms basin.f90/basinit() function that calculates some of the variables needed here by runoff.
calculate(time_length, **kwargs)Calculate Process terms for a time step
check_capacity(soil_moist_prev, ...)Fill soil to soil_moist_max, if more than capacity restrict infiltration by snowinfil_max, with excess added to runoff
compute_infil(contrib_fraction, ...)A dictionary description of this Process.
dprst_comp(dprst_vol_clos, ...)finalize()Finalizes the Process, including output methods.
Get a tuple of dimension names for this Process.
Get a dictionary of initialization values for each public variable.
Get a tuple of input variable names for this Process.
Get a dictionary of variable names for mass budget terms.
Get a tuple of parameter names for this Process.
Get a list of restart varible names.
Get a tuple of (public) variable names for this Process.
imperv_et(imperv_stor, potet, imperv_evap, ...)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
perv_comp(soil_moist_prev, carea_max, ...)Pervious area computations.
set_input_to_adapter(input_variable_name, ...)Set input variables to adapter.current and manage the adapter.
Attributes
A tuple of parameter names.
A dictionary of initial values for each public variable.
A tuple of input variable names.
A dictionary of variable names for the mass budget terms.
A tuple of parameter names.
A tuple of restart variable names.
A tuple of public variable names.
- advance()#
Advance the Process in time.
- Returns:
None
- basin_init()[source]#
This is trying to replicate the prms basin.f90/basinit() function that calculates some of the variables needed here by runoff. This should probably go somewhere else at some point as I suspect other components may need similar information.
- calculate(time_length, **kwargs)#
Calculate Process terms for a time step
- Parameters:
simulation_time – current simulation time
- Return type:
- Returns:
None
- static check_capacity(soil_moist_prev, soil_moist_max, snowinfil_max, infil, srp)[source]#
Fill soil to soil_moist_max, if more than capacity restrict infiltration by snowinfil_max, with excess added to runoff
- static compute_infil(contrib_fraction, soil_moist_prev, soil_moist_max, carea_max, smidx_coef, smidx_exp, pptmix_nopack, net_rain, net_ppt, imperv_stor, imperv_stor_max, snowmelt, snowinfil_max, net_snow, pkwater_equiv, infil, hru_type, intcp_changeover, hruarea_imperv, sri, srp, check_capacity, perv_comp, through_rain)[source]#
- classmethod description()#
A dictionary description of this Process.
- Return type:
- Returns:
All metadata for all variables in inputs, variables,parameters, and mass_budget_terms for this Process.
- static dprst_comp(dprst_vol_clos, dprst_area_clos_max, dprst_area_clos, dprst_vol_open_max, dprst_vol_open, dprst_area_open_max, dprst_sroff_hru, sro_to_dprst_perv, sro_to_dprst_imperv, dprst_evap_hru, pptmix_nopack, snowmelt, pkwater_equiv, net_snow, hru_area, dprst_insroff_hru, dprst_frac_open, dprst_frac_clos, va_open_exp, dprst_vol_clos_max, dprst_vol_clos_frac, va_clos_exp, potet, snowcov_area, dprst_et_coef, dprst_seep_rate_open, dprst_vol_thres_open, dprst_flow_coef, dprst_seep_rate_clos, avail_et, net_rain, dprst_in, srp, sri, imperv_frac, perv_frac)[source]#
- static get_init_values()[source]#
Get a dictionary of initialization values for each public variable.
- Return type:
- classmethod get_variables()#
Get a tuple of (public) variable names for this Process.
- Return type:
- 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 variableoutput_vars (
list) – list of variable names to outuput.
- Return type:
- Returns:
None
- output_to_csv(pth)#
Save each output variable to separate csv file in specified path
- static perv_comp(soil_moist_prev, carea_max, smidx_coef, smidx_exp, pptp, ptc, infil, srp)[source]#
Pervious area computations.
- set_input_to_adapter(input_variable_name, adapter)#
Set input variables to adapter.current and manage the adapter.
TODO: make this private?