pywatershed.PRMSSolarGeometry#
- class pywatershed.PRMSSolarGeometry(control, discretization, parameters, verbose=False, from_prms_file=None, from_nc_files_dir=None)[source]#
PRMS solar geometry.
Implementation based on PRMS 5.2.1 with theoretical documentation given in the PRMS-IV documentation:
Implements Swift’s daily potential solar radiation and number of hours of duration on a sloping surface in [cal/cm2/day]. Swift, 1976, equation 6.
Primary reference: Appendix E of Dingman, S. L., 1994, Physical Hydrology. Englewood Cliffs, NJ: Prentice Hall, 575 p.
- Parameters:
control – a Control object
discretization – a discretization of class Parameters
parameters – a parameter object of class Parameters
verbose – Print extra information or not?
from_prms_file – Load from a PRMS output file?
from_nc_files_dir – [str, pl.Path] = None,
- __init__(control, discretization, parameters, verbose=False, from_prms_file=None, from_nc_files_dir=None)[source]#
Methods
__init__
(control, discretization, parameters)advance
()Advance the Process in time.
calculate
(time_length, **kwargs)Calculate Process terms for a time step
compute_soltab
(slopes, aspects, lats, ...)Calculate the solar table :param cossl: cos(atan(hru_slope)) [nhru] ? :param slope: slope [nhru] :param aspect: aspect [nhru] :param latitude: latitude [nhru]
compute_t
(lats, solar_declination)The "sunrise" equation
A dictionary description of this Process.
finalize
()Finalizes the Process, including output methods.
func3
(v, w, x, y)Potential solar radiation on the surface cal/cm2/day
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 tuple of parameter names for this Process.
Get a list of restart varible names.
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, ...)Attributes
A tuple of parameter names.
A dictionary of initial values for each public variable.
A tuple of input variable names.
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
- calculate(time_length, **kwargs)#
Calculate Process terms for a time step
- Parameters:
simulation_time – current simulation time
- Return type:
- Returns:
None
- static compute_soltab(slopes, aspects, lats, compute_t, func3)[source]#
Calculate the solar table :param cossl: cos(atan(hru_slope)) [nhru] ? :param slope: slope [nhru] :param aspect: aspect [nhru] :param latitude: latitude [nhru]
- Returns: (solt, sunh)
- solt: Swift’s potential solar radiation on a sloping surface in
[cal/cm2/day]. Swift, 1976, equation 6. Dimensions: [ndoy, nhru]
- sunh: The number of hours of direct sunlight
Dimensions: [ndoy, nhru]
- static compute_t(lats, solar_declination)[source]#
The “sunrise” equation
- Parameters:
hrus (lats - latitudes of the) –
solar_declination (
ndarray
) – the declination of the sun on all julian days
- Return type:
- Returns:
The angle hour from the local meridian (local solar noon) to the sunrise (negative) or sunset (positive). The Earth rotates at the angular speed of 15 degrees/hour (2 pi / 24 hour in radians) and, therefore, result*(24/(2pi) radians gives the time of sunrise as the number of hours before the local noon, or the time of sunset as the number of hours after the local noon. Here the term local noon indicates the local time when the sun is exactly to the south or north or exactly overhead.
See reference: nhm-usgs/prms
- classmethod description()#
A dictionary description of this Process.
- Return type:
- Returns:
All metadata for all variables in inputs, variables, and parameters.
- static func3(v, w, x, y)[source]#
Potential solar radiation on the surface cal/cm2/day
Radian angle version of FUNC3 (eqn 6) from Swift, 1976 or Lee, 1963 equation 5. (Names in parens below from Swift?)
- Parameters:
- Return type:
- Returns:
(R4) is potential solar radiation on the surface cal/cm2/day [ndoy, nhru]
- Constants
r1: solar constant for 60 minutes [ndoy] solar_declination: declination of sun [ndoy]
See also: nhm-usgs/prms
- static get_init_values()[source]#
Get a dictionary of initialization values for each public variable.
- Return type:
- initialize_netcdf(output_dir=None, separate_files=None, output_vars=None, **kwargs)[source]#
Initialize NetCDF output.
- Parameters:
output_dir – base directory path or NetCDF file path if separate_files is True
separate_files – boolean indicating if storage component output variables should be written to a separate file for each variable
output_vars – list of variable names to outuput.
- Returns:
None
- output_to_csv(pth)#
Save each output variable to separate csv file in specified path
- set_input_to_adapter(input_variable_name, adapter)#