Hydrology¶
Note
This is the complete exposed API. Not all classes and functions are meant for the End-user, the documentation is a work in progress
Shyft hydrology python api providing basic types
- class shyft.hydrology.ARegionEnvironment(self: shyft.hydrology.ARegionEnvironment)¶
Bases:
pybind11_objectContains all geo-located sources to be used by a Shyft core model
- __init__(self: shyft.hydrology.ARegionEnvironment) None¶
- static create_from_geo_ts_matrix(m: shyft.time_series.GeoTsMatrix, t: SupportsInt | SupportsIndex = 0, e: SupportsInt | SupportsIndex = 0, v: collections.abc.Sequence[SupportsInt | SupportsIndex] = [], area: SupportsFloat | SupportsIndex = 1000000.0) shyft.hydrology.ARegionEnvironment¶
Construct ARegionEnvironment from a specified slice of a GeoTsMatrix. Traditional forcing data is 5 (temperature, precipitation,sw_in(radiation),wind-speed, rel-hum). Extra set of forcing have additional 5 (snow_fall, sw_dir, sw_diffuse, lw_in, p_atm) The v-indices allows to map a specified variable in the GeoTsMatrix into the correct forcing data entry in the region environment. If not specified, the default v-indices are [0,1,2,3,4] corresponding to a traditional set of forcing variables. To specify a full set of forcing variables, v-indices must have 10 positions [0-9]
- Parameters:
m (GeoTsMatrix) – The matrix from which to extract temperature,precipitation,radiation,wind-speed,rel-hum data
t (int) – the forecast index to extract
e (int) – the ensemble index to extract
- Returns:
ARegionEnvironment. A ready to use region environment for interpolation
v (IntVector): variable indices that in order of appearance selects temperature,precipitation,sw_in(radiation),wind-speed,rel-hum,{snow_fall,sw_dir,sw_diffuse,lw_in}.If empty/default, same as [0,1,2,3,4]
area (float): individual grid-cell area in [m^2] to use
- Return type:
- static deserialize(blob: shyft.time_series.ByteVector) shyft.hydrology.ARegionEnvironment¶
convert a blob, as returned by .serialize() into a ARegionEnvironment
- property lw_in¶
[W/m2] downwelling longwave radiation
- Type:
- property p_atm¶
[Pa] air pressure
- Type:
- property precipitation¶
precipitation sources
- Type:
- property radiation¶
[W/m2] downwelling shortwave radiation(alias sw_in)
- Type:
- property rel_hum¶
rel-hum sources
- Type:
- serialize(self: shyft.hydrology.ARegionEnvironment) shyft.time_series.ByteVector¶
convert ARegionEnvironment into a binary blob that later can be restored with the .deserialize(blob) method
- property sw_diffuse¶
[W/m2] downwelling shortwave diffuse radiation
- Type:
- property sw_dir¶
[W/m2] downwelling shortwave direct radiation
- Type:
- property sw_in¶
[W/m2] downwelling shortwave radiation
- Type:
- property temperature¶
temperature sources
- Type:
- property variables¶
- property variables_complete¶
- property wind_speed¶
wind-speed sources
- Type:
- shyft.hydrology.ActualEvapotranspirationCalculate_step(water_level: SupportsFloat | SupportsIndex, potential_evapotranspiration: SupportsFloat | SupportsIndex, scale_factor: SupportsFloat | SupportsIndex, snow_fraction: SupportsFloat | SupportsIndex, dt: shyft.time_series.time) float¶
actual_evapotranspiration calculates actual evapotranspiration, returning same unit as input pot.evap based on supplied parameters
- Parameters:
() (dt) – [mm] water level eqvivalent in ground, ae goes to zero if ground is drying out
() – [mm/x], x time-unit
() – typically 1.5
() – 0..1 there is to ae over snow surface, so snow_fraction 1.0, yields 0.0
() – [s] timestep length, currently not part of the formula
- Returns:
actual evapotranspiration.
- class shyft.hydrology.ActualEvapotranspirationParameter(self: shyft.hydrology.ActualEvapotranspirationParameter, ae_scale_factor: SupportsFloat | SupportsIndex = 1.5)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.ActualEvapotranspirationParameter, ae_scale_factor: SupportsFloat | SupportsIndex = 1.5) None¶
- property ae_scale_factor¶
- class shyft.hydrology.ActualEvapotranspirationResponse¶
Bases:
pybind11_object- __init__(*args, **kwargs)¶
- property ae¶
actual evapotranspiration
- Type:
float
- class shyft.hydrology.BTKParameter(*args, **kwargs)¶
Bases:
pybind11_objectBTKParameter class with time varying gradient based on day no
Overloaded function.
__init__(self: shyft.hydrology.BTKParameter) -> None
__init__(self: shyft.hydrology.BTKParameter, temperature_gradient: typing.SupportsFloat | typing.SupportsIndex, temperature_gradient_sd: typing.SupportsFloat | typing.SupportsIndex) -> None
specifying default temp.grad(not used) and std.dev[C/100m]
__init__(self: shyft.hydrology.BTKParameter, temperature_gradient: typing.SupportsFloat | typing.SupportsIndex, temperature_gradient_sd: typing.SupportsFloat | typing.SupportsIndex, sill: typing.SupportsFloat | typing.SupportsIndex = 25.0, nugget: typing.SupportsFloat | typing.SupportsIndex = 0.5, range: typing.SupportsFloat | typing.SupportsIndex = 200000.0, zscale: typing.SupportsFloat | typing.SupportsIndex = 20.0) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.BTKParameter) -> None
__init__(self: shyft.hydrology.BTKParameter, temperature_gradient: typing.SupportsFloat | typing.SupportsIndex, temperature_gradient_sd: typing.SupportsFloat | typing.SupportsIndex) -> None
specifying default temp.grad(not used) and std.dev[C/100m]
__init__(self: shyft.hydrology.BTKParameter, temperature_gradient: typing.SupportsFloat | typing.SupportsIndex, temperature_gradient_sd: typing.SupportsFloat | typing.SupportsIndex, sill: typing.SupportsFloat | typing.SupportsIndex = 25.0, nugget: typing.SupportsFloat | typing.SupportsIndex = 0.5, range: typing.SupportsFloat | typing.SupportsIndex = 200000.0, zscale: typing.SupportsFloat | typing.SupportsIndex = 20.0) -> None
- nug(self: shyft.hydrology.BTKParameter) float¶
Nugget magnitude,default=0.5
- range(self: shyft.hydrology.BTKParameter) float¶
Point where semivariogram flattens out,default=200000.0
- sill(self: shyft.hydrology.BTKParameter) float¶
Value of semivariogram at range default=25.0
- temperature_gradient(self: shyft.hydrology.BTKParameter, p: shyft.time_series.UtcPeriod) float¶
return default temp.gradient based on day of year calculated for midst of utcperiod p
- temperature_gradient_sd(self: shyft.hydrology.BTKParameter) float¶
returns Prior standard deviation of temperature gradient in [C/m]
- zscale(self: shyft.hydrology.BTKParameter) float¶
Height scale used during distance computations,default=20.0
- class shyft.hydrology.CalibrationOption(*args, **kwargs)¶
Bases:
pybind11_objectThe CalibrationOption controls how the calibration optmizer is run regarding method and termination criterias. Notice that the different optmizers do have variations in the termination criterias. All optimization algorithms expect at least one-dimensional paramteter space.
Overloaded function.
__init__(self: shyft.hydrology.CalibrationOption) -> None
__init__(self: shyft.hydrology.CalibrationOption, method: shyft.hydrology.OptimizerMethod, max_iterations: typing.SupportsInt | typing.SupportsIndex = 1500, time_limit: shyft.time_series.time = time(0), solver_epsilon: typing.SupportsFloat | typing.SupportsIndex = 0.001, x_epsilon: typing.SupportsFloat | typing.SupportsIndex = 0.001, y_epsilon: typing.SupportsFloat | typing.SupportsIndex = 0.001, tr_start: typing.SupportsFloat | typing.SupportsIndex = 0.1, tr_stop: typing.SupportsFloat | typing.SupportsIndex = 1e-05) -> None
Initialises a ParameterOptimizer instance.
method (OptimizerMethod): select which parameter optimizer to use.
max_iterations (int): stop after this number of iterations (default 1500).
time_limit (float): GLOBAL: don’t run the global search longer than this (default 0, off).
solver_epsilon (float): GLOBAL: select which parameter optimizer to use (default 0.001).
x_epsilon (float): SCEUA: stop when normalized parameters x is within this range in variation.
y_epsilon (float): SCEUA: stop when goal function is stable within this range (not improving any further).
tr_start (float): BOBYQA: trust region start (default 0.1).
tr_stop (float): BOBYQA: trust region stop/end (default 1e-5).
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.CalibrationOption) -> None
__init__(self: shyft.hydrology.CalibrationOption, method: shyft.hydrology.OptimizerMethod, max_iterations: typing.SupportsInt | typing.SupportsIndex = 1500, time_limit: shyft.time_series.time = time(0), solver_epsilon: typing.SupportsFloat | typing.SupportsIndex = 0.001, x_epsilon: typing.SupportsFloat | typing.SupportsIndex = 0.001, y_epsilon: typing.SupportsFloat | typing.SupportsIndex = 0.001, tr_start: typing.SupportsFloat | typing.SupportsIndex = 0.1, tr_stop: typing.SupportsFloat | typing.SupportsIndex = 1e-05) -> None
Initialises a ParameterOptimizer instance.
method (OptimizerMethod): select which parameter optimizer to use.
max_iterations (int): stop after this number of iterations (default 1500).
time_limit (float): GLOBAL: don’t run the global search longer than this (default 0, off).
solver_epsilon (float): GLOBAL: select which parameter optimizer to use (default 0.001).
x_epsilon (float): SCEUA: stop when normalized parameters x is within this range in variation.
y_epsilon (float): SCEUA: stop when goal function is stable within this range (not improving any further).
tr_start (float): BOBYQA: trust region start (default 0.1).
tr_stop (float): BOBYQA: trust region stop/end (default 1e-5).
- static bobyqa(max_iterations: SupportsInt | SupportsIndex, tr_start: SupportsFloat | SupportsIndex, tr_stop: SupportsFloat | SupportsIndex) shyft.hydrology.CalibrationOption¶
Construct bobyqa options.
max_iterations (int): stop after this number of iterations (default 1500).
tr_start (float): BOBYQA: trust region start (default 0.1).
tr_stop (float): trust region stop/end (default 1e-5).
- Returns:
co. An instance of CalibrationOption for the relevant optmization algorithm.
- Return type:
- static dream(max_iterations: SupportsInt | SupportsIndex) shyft.hydrology.CalibrationOption¶
Construct dream options
max_iterations (int): stop after this number of iterations (default 1500).
- Returns:
co. An instance of CalibrationOption for the relevant optmization algorithm.
- Return type:
- static global_search(max_iterations: SupportsInt | SupportsIndex, time_limit: shyft.time_series.time, solver_epsilon: SupportsFloat | SupportsIndex) shyft.hydrology.CalibrationOption¶
Construct global search options
max_iterations (int): stop after this number of iterations (default 1500).
time_limit (float): don’t run the global search longer than this (default 0, off).
solver_epsilon (float): select which parameter optimizer to use (default 0.001).
- Returns:
co. An instance of CalibrationOption for the relevant optmization algorithm.
- Return type:
- property max_iterations¶
stop after this number of iterations (default 1500)
- Type:
int
- property method¶
OptimizerMethod, which parameter optimizer to use
- Type:
int
- static sceua(max_iterations: SupportsInt | SupportsIndex, x_epsilon: SupportsFloat | SupportsIndex, y_epsilon: SupportsFloat | SupportsIndex) shyft.hydrology.CalibrationOption¶
Construct sceua options
max_iterations (int): stop after this number of iterations (default 1500).
x_epsilon (float): stop when normalized parameters x is within this range in variation.
y_epsilon (float): stop when goal function is stable within this range (not improving any further).
- Returns:
co. An instance of CalibrationOption for the relevant optmization algorithm.
- Return type:
- property solver_epsilon¶
select which parameter optimizer to use (default 0.001)
- Type:
float
- Type:
- property time_limit¶
don’t run the global search longer than this (default 0, off)
- property x_epsilon¶
stop when normalized parameters x is within this range in variation
- Type:
float
- Type:
- class shyft.hydrology.CalibrationStatus¶
Bases:
pybind11_objectThe CalibrationStatus is returned from drms, or local call to the region model calibration object.It provides status, progress, and current trace of parameters and goal function values
- __init__(*args, **kwargs)¶
- result(self: shyft.hydrology.CalibrationStatus) object¶
returns resulting calibrated parameter if available
- property running¶
True if the calibration is still running
- Type:
bool
- trace_goal_function_value(self: shyft.hydrology.CalibrationStatus, i: SupportsInt | SupportsIndex) float¶
returns the i’th goal function value
- property trace_goal_function_values¶
goal function values obtained so far
- Type:
DoubleVector
- trace_parameter(self: shyft.hydrology.CalibrationStatus, i: SupportsInt | SupportsIndex) object¶
returns the i’th parameter tried, corresponding to the i’th trace_goal_function value
- property trace_size¶
returns the size of the parameter-trace
See also
trace_goal_function_value,trace_parameter
- Type:
int
- class shyft.hydrology.CatchmentPropertyType(self: shyft.hydrology.CatchmentPropertyType, value: SupportsInt | SupportsIndex)¶
Bases:
pybind11_objectMembers:
DISCHARGE
SNOW_COVERED_AREA
SNOW_WATER_EQUIVALENT
ROUTED_DISCHARGE
CELL_CHARGE
- CELL_CHARGE = <CatchmentPropertyType.CELL_CHARGE: 4>¶
- DISCHARGE = <CatchmentPropertyType.DISCHARGE: 0>¶
- ROUTED_DISCHARGE = <CatchmentPropertyType.ROUTED_DISCHARGE: 3>¶
- SNOW_COVERED_AREA = <CatchmentPropertyType.SNOW_COVERED_AREA: 1>¶
- SNOW_WATER_EQUIVALENT = <CatchmentPropertyType.SNOW_WATER_EQUIVALENT: 2>¶
- __init__(self: shyft.hydrology.CatchmentPropertyType, value: SupportsInt | SupportsIndex) None¶
- CatchmentPropertyType.name -> str
- property value¶
- class shyft.hydrology.CellEnvironment(self: shyft.hydrology.CellEnvironment)¶
Bases:
pybind11_objectContains all ts projected to a certain cell-model using interpolation step (if needed)
- __init__(self: shyft.hydrology.CellEnvironment) None¶
- has_nan_values(self: shyft.hydrology.CellEnvironment) bool¶
scans all time-series for nan-values
- Returns:
has_nan. true if any nan is encounted, otherwise false
- Return type:
bool
- init(self: shyft.hydrology.CellEnvironment, ta: shyft.time_series.TimeAxisFixedDeltaT, with_full_forcing: bool = False) None¶
zero all series, set time-axis ta
- property lw_in¶
longwave
- Type:
TsFixed
- property precipitation¶
precipitation
- Type:
TsFixed
- property radiation¶
radiation(alias sw_in)
- Type:
TsFixed
- property rel_hum¶
relhum
- Type:
TsFixed
- property sw_diffuse¶
shortwave diffuse component
- Type:
TsFixed
- property sw_dir¶
shortwave direct component
- Type:
TsFixed
- property sw_in¶
radiation
- Type:
TsFixed
- property temperature¶
temperature
- Type:
TsFixed
- property wind_speed¶
wind speed
- Type:
TsFixed
- class shyft.hydrology.CellStateId(*args, **kwargs)¶
Bases:
pybind11_objectUnique cell pseudo identifier of a state
A lot of Shyft models can appear in different geometries and resolutions.In a few rare cases we would like to store the state of a model.This would be typical for example for hydrological new - year 1 - sept in Norway. To ensure that each cell - state have a unique identifier so that we never risk mixing state from different cells or different geometries, we create a pseudo unique id that helps identifying unique cell - states given this usage and context.
The primary usage is to identify which cell a specific identified state belongs to.
Overloaded function.
__init__(self: shyft.hydrology.CellStateId) -> None
__init__(self: shyft.hydrology.CellStateId, cid: typing.SupportsInt | typing.SupportsIndex, x: typing.SupportsInt | typing.SupportsIndex, y: typing.SupportsInt | typing.SupportsIndex, area: typing.SupportsInt | typing.SupportsIndex) -> None
construct CellStateId with specified parameters
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.CellStateId) -> None
__init__(self: shyft.hydrology.CellStateId, cid: typing.SupportsInt | typing.SupportsIndex, x: typing.SupportsInt | typing.SupportsIndex, y: typing.SupportsInt | typing.SupportsIndex, area: typing.SupportsInt | typing.SupportsIndex) -> None
construct CellStateId with specified parameters
- property area¶
area in [m^2]
- Type:
int
- property cid¶
catchment identifier
- Type:
int
- property x¶
x position in [m]
- Type:
int
- property y¶
y position in [m]
- Type:
int
- class shyft.hydrology.DrmClient(self: shyft.hydrology.DrmClient, host_port: str, timeout_ms: SupportsInt | SupportsIndex, operation_timeout_ms: SupportsInt | SupportsIndex = 0)¶
Bases:
pybind11_objectDistributed region model client provides all needed functionality to transfer Shyft region-models, and then run simulations/optimizations
- __init__(self: shyft.hydrology.DrmClient, host_port: str, timeout_ms: SupportsInt | SupportsIndex, operation_timeout_ms: SupportsInt | SupportsIndex = 0) None¶
- adjust_q(self: shyft.hydrology.DrmClient, mid: str, indexes: collections.abc.Sequence[SupportsInt | SupportsIndex], wanted_q: SupportsFloat | SupportsIndex, start_step: SupportsInt | SupportsIndex = 0, scale_range: SupportsFloat | SupportsIndex = 3.0, scale_eps: SupportsFloat | SupportsIndex = 0.001, max_iter: SupportsInt | SupportsIndex = 300, n_steps: SupportsInt | SupportsIndex = 1) shyft.hydrology.FlowAdjustResult¶
State adjustment to achieve wanted/observed flow
- Parameters:
mid (str) – model identifier
indexes (List[int]) – cell ids that should be adjusted
wanted_q (float) – the average flow first time-step we want to achieve, in m**3/s
start_step (int) – time-axis start step index, default=0
scale_range (float) – default=3, min,max= scale0/scale_range.. scale0*scale_range
scale_eps (float) – default 1e-3, stop iteration when scale-change is less than this
max_iter (int) – default=300, stop searching for solution after this limit is reached
n_steps (int) – default=1, number of steps on time-axis to average to match wanted flow
- Returns:
. obtained flow in m**3/s. This can deviate from wanted flow due to model and state constraints. q_r is optimized q and q_0 is unadjusted.
- Return type:
q_adjust_result
- cancel_calibration(self: shyft.hydrology.DrmClient, mid: str) bool¶
Cancels any ongoing not finished calibration for the specified model
- Parameters:
mid (str) – model identifier
- Returns:
. indicating success
- Return type:
bool
- check_calibration(self: shyft.hydrology.DrmClient, mid: str) shyft.hydrology.CalibrationStatus¶
Check ongoing calibration, return intermediate status with trace, or final status with trace and resulting parameters
- Parameters:
() (mid) – model identifier
- Returns:
. Calibration Status class with information and results
- clone_model(self: shyft.hydrology.DrmClient, mid: str, new_mid: str) bool¶
clone the specified model
- Parameters:
mid (str) – original model
new_mid (str) – the model-id for the cloned model
- Returns:
. true if succeeded
- Return type:
bool
- close(self: shyft.hydrology.DrmClient) None¶
Close the connection. It will automatically reopen if needed.
- copy_model(self: shyft.hydrology.DrmClient, mid: str, new_mid: str) bool¶
full copy of the specified model
- Parameters:
mid (str) – original model
new_mid (str) – the model-id for the copied model
- Returns:
. true if succeeded
- Return type:
bool
- create_model(self: shyft.hydrology.DrmClient, mid: str, mtype: shyft.hydrology.RegionModelType, gcd: shyft.hydrology.GeoCellDataVector) bool¶
create the model
- Parameters:
mid (str) – model identifier
mtype (enum rmodel_type) – rmodel_type.pt_gs_k rmodel_type.pt_gs_k_opt or similar model type
gcd (GeoCellDataVector) – strongly typed list of GeoCellData
- Returns:
. true if succeeded
- Return type:
bool
- fx(self: shyft.hydrology.DrmClient, mid: str, fx_args: str) bool¶
Invoke the serverside fx callback, on the exlusively locked model given by mid
- Parameters:
mid (str) – model identifier
fx_args (str) – args to the callback, typically a json string
- Returns:
. the server side evaluation result, as pr. callback return value
- Return type:
bool
- get_catchment_parameter(self: shyft.hydrology.DrmClient, mid: str, cid: SupportsInt | SupportsIndex) object¶
Get the effective catchment parameter for the specified catchment
- Parameters:
mid (str) – model identifier
cid (int) – catchment identifier
- Returns:
. The catchment parameter for specified catchment
- Return type:
XXXParameter
- get_charge(self: shyft.hydrology.DrmClient, mid: str, indexes: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], index_type: shyft.hydrology.stat_scope = <stat_scope.catchment: 1>) shyft.time_series.TimeSeries¶
get the charge
- Parameters:
mid (str) – model identifier
indexes (List[int]) – indexes to be retrieved, the index_type tells if it’s cells or catchment indexes
index_type (stat_scope) – stat_scope.(cell|catchment) denotes the type of indexes passed. cell returns sum of cell indexes, catchment returns sum of catchments
- Returns:
. returns sum for catcment_ids
- Return type:
- get_description(self: shyft.hydrology.DrmClient, mid: str) str¶
returns the user specified description string, typically a json formatted string.
- Parameters:
mid (str) – model identifier
- Returns:
. The description(json string) for the specified model
- Return type:
str
- get_discharge(self: shyft.hydrology.DrmClient, mid: str, indexes: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], index_type: shyft.hydrology.stat_scope = <stat_scope.catchment: 1>) shyft.time_series.TimeSeries¶
get the discharge
- Parameters:
mid (str) – model identifier
indexes (List[int]) – indexes to be retrieved, the index_type tells if it’s cells or catchment indexes
index_type (stat_scope) – stat_scope.(cell|catchment) denotes the type of indexes passed. cell returns sum of cell indexes, catchment returns sum of catchments
- Returns:
. returns sum for catcment_ids
- Return type:
- get_geo_cell_data(self: shyft.hydrology.DrmClient, mid: str) shyft.hydrology.GeoCellDataVector¶
returns the geo cell data vector for the specified model.
- Parameters:
mid (str) – model identifier
- Returns:
. The GeoCellDataVector for the specified model
- Return type:
- get_interpolation_parameter(self: shyft.hydrology.DrmClient, mid: str) shyft.hydrology.InterpolationParameter¶
returns the current interpolation parameters used to interpolate region-env to the cells.
- Parameters:
mid (str) – model identifier
- Returns:
. The interpolation parameter for the specified model
- Return type:
- get_model_ids(self: shyft.hydrology.DrmClient) list[str]¶
returns a list of model ids (mids) that is alive and known at the remote server
- Returns:
. Strongly typed list of strings naming the available models on the drms
- Return type:
StringList
- get_precipitation(self: shyft.hydrology.DrmClient, mid: str, indexes: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], index_type: shyft.hydrology.stat_scope = <stat_scope.catchment: 1>) shyft.time_series.TimeSeries¶
get the precipitation
- Parameters:
mid (str) – model identifier
indexes (List[int]) – indexes to be retrieved, the index_type tells if it’s cells or catchment indexes
index_type (stat_scope) – stat_scope.(cell|catchment) denotes the type of indexes passed. cell returns sum of cell indexes, catchment returns sum of catchments
- Returns:
. returns sum for catcment_ids
- Return type:
- get_radiation(self: shyft.hydrology.DrmClient, mid: str, indexes: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], index_type: shyft.hydrology.stat_scope = <stat_scope.catchment: 1>) shyft.time_series.TimeSeries¶
get the radiation
- Parameters:
mid (str) – model identifier
indexes (List[int]) – indexes to be retrieved, the index_type tells if it’s cells or catchment indexes
index_type (stat_scope) – stat_scope.(cell|catchment) denotes the type of indexes passed. cell returns sum of cell indexes, catchment returns sum of catchments
- Returns:
. returns sum for catcment_ids
- Return type:
- get_region_env(self: shyft.hydrology.DrmClient, mid: str) shyft.hydrology.ARegionEnvironment¶
returns the current region-env for the specified model.
- Parameters:
mid (str) – model identifier
- Returns:
. The region envirionment for the specified model
- Return type:
- get_region_parameter(self: shyft.hydrology.DrmClient, mid: str) object¶
Get the region model parameter settings
- Parameters:
mid (str) – model identifier
- Returns:
. The region parameter for the model
- Return type:
XXXParameter
- get_rel_hum(self: shyft.hydrology.DrmClient, mid: str, indexes: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], index_type: shyft.hydrology.stat_scope = <stat_scope.catchment: 1>) shyft.time_series.TimeSeries¶
get the rel_hum
- Parameters:
mid (str) – model identifier
indexes (List[int]) – indexes to be retrieved, the index_type tells if it’s cells or catchment indexes
index_type (stat_scope) – stat_scope.(cell|catchment) denotes the type of indexes passed. cell returns sum of cell indexes, catchment returns sum of catchments
- Returns:
. returns sum for catcment_ids
- Return type:
- get_server_version(self: shyft.hydrology.DrmClient) str¶
returns the server version
- Returns:
version. Server version string
- Return type:
str
- get_snow_sca(self: shyft.hydrology.DrmClient, mid: str, indexes: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], index_type: shyft.hydrology.stat_scope = <stat_scope.catchment: 1>) shyft.time_series.TimeSeries¶
get the snow_sca
- Parameters:
mid (str) – model identifier
indexes (List[int]) – indexes to be retrieved, the index_type tells if it’s cells or catchment indexes
index_type (stat_scope) – stat_scope.(cell|catchment) denotes the type of indexes passed. cell returns sum of cell indexes, catchment returns sum of catchments
- Returns:
. returns sum for catcment_ids
- Return type:
- get_snow_swe(self: shyft.hydrology.DrmClient, mid: str, indexes: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], index_type: shyft.hydrology.stat_scope = <stat_scope.catchment: 1>) shyft.time_series.TimeSeries¶
get the snow_swe
- Parameters:
mid (str) – model identifier
indexes (List[int]) – indexes to be retrieved, the index_type tells if it’s cells or catchment indexes
index_type (stat_scope) – stat_scope.(cell|catchment) denotes the type of indexes passed. cell returns sum of cell indexes, catchment returns sum of catchments
- Returns:
. returns sum for catcment_ids
- Return type:
- get_state(self: shyft.hydrology.DrmClient, mid: str, indexes: collections.abc.Sequence[SupportsInt | SupportsIndex] = []) object¶
Extract cell state for the optionaly specified catchment ids, cids
- Parameters:
mid (str) – model identifier
indexes (IntVector) – list of catchment-id’s, if empty, extract all
- Returns:
. strongly typed list of stack state with identifier for the cells
- Return type:
xStateWithIdVector
- get_temperature(self: shyft.hydrology.DrmClient, mid: str, indexes: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], index_type: shyft.hydrology.stat_scope = <stat_scope.catchment: 1>) shyft.time_series.TimeSeries¶
get the temperature
- Parameters:
mid (str) – model identifier
indexes (List[int]) – indexes to be retrieved, the index_type tells if it’s cells or catchment indexes
index_type (stat_scope) – stat_scope.(cell|catchment) denotes the type of indexes passed. cell returns sum of cell indexes, catchment returns sum of catchments
- Returns:
. returns sum for catcment_ids
- Return type:
- get_time_axis(self: shyft.hydrology.DrmClient, mid: str) shyft.time_series.TimeAxis¶
Get the current time-axis of the model
- Parameters:
mid (str) – model identifier
- Returns:
. The region model time-axis
- Return type:
- get_wind_speed(self: shyft.hydrology.DrmClient, mid: str, indexes: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], index_type: shyft.hydrology.stat_scope = <stat_scope.catchment: 1>) shyft.time_series.TimeSeries¶
get the wind speed
- Parameters:
mid (str) – model identifier
indexes (List[int]) – indexes to be retrieved, the index_type tells if it’s cells or catchment indexes
index_type (stat_scope) – stat_scope.(cell|catchment) denotes the type of indexes passed. cell returns sum of cell indexes, catchment returns sum of catchments
- Returns:
. returns sum for catcment_ids
- Return type:
- has_catchment_parameter(self: shyft.hydrology.DrmClient, mid: str, cid: SupportsInt | SupportsIndex) bool¶
Get the current time-axis of the model
- Parameters:
mid (str) – model identifier
cid (int) – catchment identifier
- Returns:
. True if catchment has its own parameter setting
- Return type:
bool
- property host_port¶
Endpoint network address of the remote server.
- Type:
str
- is_calculated(self: shyft.hydrology.DrmClient, mid: str, catchment_id: SupportsInt | SupportsIndex) bool¶
using the catchment_calculation_filter to decide if discharge etc. are calculated.
- Parameters:
mid (str) – model identifier
cid (int) – catchment id
- Returns:
. true if catchment id is calculated during runs
- Return type:
bool
- is_cell_env_ts_ok(self: shyft.hydrology.DrmClient, mid: str) bool¶
check if all values in cell.env_ts for selected calculation-filter is non-nan, i.e. valid numbers
- Parameters:
mid (str) – model identifier
- Returns:
. true if ok, false if not ok
- Return type:
bool
- property is_open¶
If the connection to the remote server is (still) open.
- Type:
bool
- property operation_timeout_ms¶
Operation timeout for remote server operations, in number milliseconds.
- Type:
int
- property reconnect_count¶
Number of reconnects to the remote server that have been performed.
- Type:
int
- remove_catchment_parameter(self: shyft.hydrology.DrmClient, mid: str, cid: SupportsInt | SupportsIndex) None¶
Remove the specified catchments local parameter, and set it to the region parameter
- Parameters:
mid (str) – model identifier
cid (int) – catchment identifier
- remove_model(self: shyft.hydrology.DrmClient, mid: str) bool¶
remove the specified model
- Parameters:
mid (str) – model identifier
- Returns:
. true if succeeded
- Return type:
bool
- rename_model(self: shyft.hydrology.DrmClient, mid: str, new_mid: str) bool¶
rename the specified model
- Parameters:
mid (str) – model identifier
new_mid (str) – the new wanted model-id for the model
- Returns:
. true if succeeded
- Return type:
bool
- revert_to_initial_state(self: shyft.hydrology.DrmClient, mid: str) bool¶
revert model to initial state, notice that this require that the set_current_state_as_initial_state() or run_cells() is called. The latter will set initial state if not already done.
- Parameters:
mid (str) – model identifier
- Returns:
. true if succeeded
- Return type:
bool
- run_cells(self: shyft.hydrology.DrmClient, mid: str, use_ncore: SupportsInt | SupportsIndex = 0, start_step: SupportsInt | SupportsIndex = 0, n_steps: SupportsInt | SupportsIndex = 0) bool¶
Run calculation over the specified time axis. Requires that cells and environment have been initialized and interpolated.
- Parameters:
mid (str) – model identifier
use_ncore (int) – default 0, means autodetect core, otherwise you can specify 1..n
start_step (int) – default 0, from start step of time-axis
n_steps (int) – default 0, means run entire time-axis, 1..n means number of steps from start_step
- Returns:
. true if succeeded
- Return type:
bool
- run_interpolation(self: shyft.hydrology.DrmClient, mid: str, ip_parameter: shyft.hydrology.InterpolationParameter, ta: shyft.time_series.TimeAxis, r_env: shyft.hydrology.ARegionEnvironment, best_effort: bool) bool¶
initializes the cell environment and project region environment time_series to cells.
- Parameters:
mid (str) – model identifier
ip_parameter (InterpolationParameter) – interpolation parameter
ta (TimeAxis) – time axis
r_env (ARegionEnvironment) – region environment containing all geo-located sources
best_effort (bool) – best effort type interpolation
- Returns:
. true if succeeded
- Return type:
bool
- set_catchment_calculation_filter(self: shyft.hydrology.DrmClient, mid: str, catchment_id_list: collections.abc.Sequence[SupportsInt | SupportsIndex]) bool¶
set catchment calculation filter
- Parameters:
mid (str) – model identifier
catchment_id_list (List[int]) – list of catchment indexes
- Returns:
. true if succeeded
- Return type:
bool
- set_catchment_parameter(self: shyft.hydrology.DrmClient, mid: str, parameter: shyft.hydrology.pt_gs_k.PTGSKParameter | shyft.hydrology.pt_ss_k.PTSSKParameter | shyft.hydrology.pt_hs_k.PTHSKParameter | shyft.hydrology.pt_hps_k.PTHPSKParameter | shyft.hydrology.r_pm_gs_k.RPMGSKParameter | shyft.hydrology.pt_st_k.PTSTKParameter | shyft.hydrology.pt_st_hbv.PTSTHBVParameter | shyft.hydrology.r_pt_gs_k.RPTGSKParameter | shyft.hydrology.r_pm_st_k.RPMSTKParameter | shyft.hydrology.r_pmv_st_k.RPMVSTKParameter | shyft.hydrology.pt_fsm2_k.PTFSM2KParameter, cid: SupportsInt | SupportsIndex) bool¶
set catchment parameter
- Parameters:
mid (str) – model identifier
parameter (XXXXParameter) – strongly typed method stack parameter
cid (int) – catchment id that should get the supplied parameter
- Returns:
. true if succeeded
- Return type:
bool
- set_cell_environment(self: shyft.hydrology.DrmClient, mid: str, ta: shyft.time_series.TimeAxis, r_env: shyft.hydrology.ARegionEnvironment) bool¶
Set the forcing data cell enviroment (cell.env_ts.* )
The method initializes the cell environment, that keeps temperature, precipitation etc for all the cells. The region-model time-axis is set to the supplied time-axis, so that the the region model is ready to run cells, using this time-axis.
There are strict requirements to the content of the region_env parameter:
rm.cells[i].mid_point()== region_env.temperature[i].mid_point() for all i
similar for precipitation,rel_hum,radiation,wind_speed
So same number of forcing data, in the same order and geo position as the cells. Tip: If time_axis is equal to the forcing time-axis, it is twice as fast.
- Parameters:
mid (str) – model identifier
ta (TimeAxis) – specifies the time-axisfor the region-model, and thus the cells
r_env (ARegionEnvironment) – A region environment with ready to use forcing data for all the cells.
- Returns:
success. true if successfull, raises exception otherwise
- Return type:
bool
- set_current_state_as_initial_state(self: shyft.hydrology.DrmClient, mid: str) bool¶
set current state as initial state for the region model. the method .revert_to_initial_state will restore this state.
- Parameters:
mid (str) – model identifier
- Returns:
. true if succeeded
- Return type:
bool
- set_description(self: shyft.hydrology.DrmClient, mid: str, description: str) bool¶
Set the user specified description string, typically a json formatted string.
- Parameters:
mid (str) – model identifier
- Returns:
. True if successful
- Return type:
bool
- set_region_parameter(self: shyft.hydrology.DrmClient, mid: str, parameter: shyft.hydrology.pt_gs_k.PTGSKParameter | shyft.hydrology.pt_ss_k.PTSSKParameter | shyft.hydrology.pt_hs_k.PTHSKParameter | shyft.hydrology.pt_hps_k.PTHPSKParameter | shyft.hydrology.r_pm_gs_k.RPMGSKParameter | shyft.hydrology.pt_st_k.PTSTKParameter | shyft.hydrology.pt_st_hbv.PTSTHBVParameter | shyft.hydrology.r_pt_gs_k.RPTGSKParameter | shyft.hydrology.r_pm_st_k.RPMSTKParameter | shyft.hydrology.r_pmv_st_k.RPMVSTKParameter | shyft.hydrology.pt_fsm2_k.PTFSM2KParameter) bool¶
set region parameter
- Parameters:
mid (str) – model identifier
parameter (XXXXParameter) – strongly typed method stack parameter
- Returns:
. true if succeeded
- Return type:
bool
- set_snow_sca_swe_collection(self: shyft.hydrology.DrmClient, mid: str, catchment_id: SupportsInt | SupportsIndex, on_or_off: bool) bool¶
enable/disable collection of snow sca|sca for calibration purposes
- Parameters:
mid (str) – model identifier
catchment_id (int) – to enable snow calibration for, -1 means turn on/off for all
on_or_off (bool) – on_or_off true|or false
- Returns:
. true if succeeded
- Return type:
bool
- set_state(self: shyft.hydrology.DrmClient, mid: str, state: shyft.hydrology.pt_gs_k.PTGSKStateWithIdVector | shyft.hydrology.pt_ss_k.PTSSKStateWithIdVector | shyft.hydrology.pt_hs_k.PTHSKStateWithIdVector | shyft.hydrology.pt_hps_k.PTHPSKStateWithIdVector | shyft.hydrology.r_pm_gs_k.RPMGSKStateWithIdVector | shyft.hydrology.pt_st_k.PTSTKStateWithIdVector | shyft.hydrology.pt_st_hbv.PTSTHBVStateWithIdVector | shyft.hydrology.r_pt_gs_k.RPTGSKStateWithIdVector | shyft.hydrology.r_pm_st_k.RPMSTKStateWithIdVector | shyft.hydrology.r_pmv_st_k.RPMVSTKStateWithIdVector | shyft.hydrology.pt_fsm2_k.PTFSM2KStateWithIdVector) bool¶
set the cell state
- Parameters:
mid (str) – model identifier
state (StateWithIdVector) – strongly typed list of stack state with id vector
- Returns:
. true if succeeded
- Return type:
bool
- set_state_collection(self: shyft.hydrology.DrmClient, mid: str, catchment_id: SupportsInt | SupportsIndex, on_or_off: bool) bool¶
enable state collection for specified or all cells
- Parameters:
mid (str) – model identifier
catchment_id (int) – to enable state collection for, -1 means turn on/off for all
on_or_off (bool) – on_or_off true|or false
- Returns:
. true if succeeded
- Return type:
bool
- start_calibration(self: shyft.hydrology.DrmClient, mid: str, p_start: shyft.hydrology.pt_gs_k.PTGSKParameter | shyft.hydrology.pt_ss_k.PTSSKParameter | shyft.hydrology.pt_hs_k.PTHSKParameter | shyft.hydrology.pt_hps_k.PTHPSKParameter | shyft.hydrology.r_pm_gs_k.RPMGSKParameter | shyft.hydrology.pt_st_k.PTSTKParameter | shyft.hydrology.pt_st_hbv.PTSTHBVParameter | shyft.hydrology.r_pt_gs_k.RPTGSKParameter | shyft.hydrology.r_pm_st_k.RPMSTKParameter | shyft.hydrology.r_pmv_st_k.RPMVSTKParameter | shyft.hydrology.pt_fsm2_k.PTFSM2KParameter, p_min: shyft.hydrology.pt_gs_k.PTGSKParameter | shyft.hydrology.pt_ss_k.PTSSKParameter | shyft.hydrology.pt_hs_k.PTHSKParameter | shyft.hydrology.pt_hps_k.PTHPSKParameter | shyft.hydrology.r_pm_gs_k.RPMGSKParameter | shyft.hydrology.pt_st_k.PTSTKParameter | shyft.hydrology.pt_st_hbv.PTSTHBVParameter | shyft.hydrology.r_pt_gs_k.RPTGSKParameter | shyft.hydrology.r_pm_st_k.RPMSTKParameter | shyft.hydrology.r_pmv_st_k.RPMVSTKParameter | shyft.hydrology.pt_fsm2_k.PTFSM2KParameter, p_max: shyft.hydrology.pt_gs_k.PTGSKParameter | shyft.hydrology.pt_ss_k.PTSSKParameter | shyft.hydrology.pt_hs_k.PTHSKParameter | shyft.hydrology.pt_hps_k.PTHPSKParameter | shyft.hydrology.r_pm_gs_k.RPMGSKParameter | shyft.hydrology.pt_st_k.PTSTKParameter | shyft.hydrology.pt_st_hbv.PTSTHBVParameter | shyft.hydrology.r_pt_gs_k.RPTGSKParameter | shyft.hydrology.r_pm_st_k.RPMSTKParameter | shyft.hydrology.r_pmv_st_k.RPMVSTKParameter | shyft.hydrology.pt_fsm2_k.PTFSM2KParameter, spec: shyft.hydrology.TargetSpecificationVector, opt: shyft.hydrology.CalibrationOption) bool¶
Start calibration with specified parameters for the model given by ‘mid’
- Parameters:
() (opt) – model identifier
() – starting parameters
() – min-range for parameters
() – max-range for parameters
() – goal function specification, including reference series and weights
() – optimizer options, like BOBYQA, GLOBAL,SCEUA or DREAM etc.
- Returns:
. indicating success
- Return type:
bool
- property timeout_ms¶
Timout for remote server operations, in number milliseconds.
- Type:
int
- total_clients = 0¶
- class shyft.hydrology.DrmServer(self: shyft.hydrology.DrmServer, config: shyft.time_series.ServerConfig = shyft.time_series.ServerConfig(stale_duration='1970-01-01T01:00:00Z', stale_sweep_interval='1970-01-01T00:00:00.100000Z', log=shyft.time_series.LogConfig(file='', level=200)))¶
Bases:
pybind11_objectThe DRMS, distributed region model server provides the server part that implements the needed functionality to create, run and get results from hydrology region-models .Together with the DrmClient, it allow the Shyft hydrology region-model operations to be scaled out on several servers, giving providing support for system and analysis of any size
Creates a server object with stale connection detect parameters
- __init__(self: shyft.hydrology.DrmServer, config: shyft.time_series.ServerConfig = shyft.time_series.ServerConfig(stale_duration='1970-01-01T01:00:00Z', stale_sweep_interval='1970-01-01T00:00:00.100000Z', log=shyft.time_series.LogConfig(file='', level=200))) None¶
Creates a server object with stale connection detect parameters
- property alive_connections¶
returns currently alive connections to the server
- Type:
int
- property fx¶
server-side callable function(lambda) that takes two parameters: mid : the model id fx_arg: arbitrary string to pass to the server-side function The server-side fx is called when the client (or web-api) invoke the c.fx(mid,fx_arg). The signature of the callback function should be callback(mid:str, fx_arg:str)->bool This feature is simply enabling the users to tailor server-side functionality in python! NOTE: Currently we do take exclusive lock on the model id, so that we avoid race conditions Examples:
>>> from shyft.hydrology import DrmServer >>> s=DrmServer() >>> def my_fx(mid:str, fx_arg:str)->bool: >>> print(f'invoked with mid={mid} fx_arg={fx_arg}') >>> # note we can use captured Server s here!>>> return True >>> # and then bind the function to the callback >>> s.fx=my_fx >>> s.start_server() >>> : # later using client from anywhere to invoke the call >>> fx_result=c.fx('my_model_id', 'my_args')
- Type:
Callable[[str,str],bool]
- get_listening_port(self: shyft.hydrology.DrmServer) int¶
returns the port number it’s listening at for serving incoming request
- get_max_connections(self: shyft.hydrology.DrmServer) int¶
returns the maximum number of connections to be served concurrently
- get_model(self: shyft.hydrology.DrmServer, arg0: str) object¶
returns the named model, so it can be inspected/modified WIP: needs to be sure that there is no activity on the model from the remote side
- Returns:
. Of the type as set by the client
- Return type:
- get_model_ids(self: shyft.hydrology.DrmServer) list[str]¶
returns a list of model ids (mids) that is alive and known in the server
- Returns:
. Strongly typed list of strings naming the available models on the drms
- Return type:
StringList
- is_running(self: shyft.hydrology.DrmServer) bool¶
true if server is listening and running
See also
start_server()
- set_listening_ip(self: shyft.hydrology.DrmServer, ip: str) None¶
set the listening port for the service
- Parameters:
ip (str) – ip or host-name to start listening on
- Returns:
nothing.
- Return type:
None
- set_listening_port(self: shyft.hydrology.DrmServer, port_no: SupportsInt | SupportsIndex) None¶
set the listening port for the service
- Parameters:
port_no (int) – a valid and available tcp-ip port number to listen on.
20000 (typically it could be)
- Returns:
nothing.
- Return type:
None
- set_max_connections(self: shyft.hydrology.DrmServer, max_connect: SupportsInt | SupportsIndex) None¶
limits simultaneous connections to the server (it’s multithreaded, and uses on thread pr. connect)
- Parameters:
max_connect (int) – maximum number of connections before denying more connections
See also
get_max_connections()
- start_server(self: shyft.hydrology.DrmServer) int¶
start server listening in background, and processing messages
See also
set_listening_port(port_no),is_running
- Returns:
port_no. the port used for listening operations, either the value as by set_listening_port, or if it was unspecified, a new available port
- Return type:
in
- stop_server(self: shyft.hydrology.DrmServer, ms: SupportsInt | SupportsIndex = 2000) None¶
stop serving connections, gracefully.
See also
start_server()
- class shyft.hydrology.FSM2Calculator(self: shyft.hydrology.FSM2Calculator, vegetation_description: shyft.hydrology.GeoCellData.VegetationDescription, soil_description: shyft.hydrology.GeoCellData.SoilDescription, parameter: shyft.hydrology.FSM2Parameter)¶
Bases:
pybind11_objectFSM2 snow model from R.Essery
This algorithm uses …
- __init__(self: shyft.hydrology.FSM2Calculator, vegetation_description: shyft.hydrology.GeoCellData.VegetationDescription, soil_description: shyft.hydrology.GeoCellData.SoilDescription, parameter: shyft.hydrology.FSM2Parameter) None¶
- step(self: shyft.hydrology.FSM2Calculator, state: shyft.hydrology.FSM2State, response: shyft.hydrology.FSM2Response, t0: shyft.time_series.time, t1: shyft.time_series.time, rain: SupportsFloat | SupportsIndex, snow: SupportsFloat | SupportsIndex, temperature: SupportsFloat | SupportsIndex, wind: SupportsFloat | SupportsIndex, sw_in_direct: SupportsFloat | SupportsIndex, sw_in_diffuse: SupportsFloat | SupportsIndex, lw_in: SupportsFloat | SupportsIndex, p_atm: SupportsFloat | SupportsIndex, rel_hum: SupportsFloat | SupportsIndex) None¶
steps the model forward from t0 to t1, updating state and response
- Parameters:
state (FSM2State) – state input/output
response (FSM2Response) – response output
t0 (time) – start time of the step
t1 (time) – end time of the step
rain (double) – rainfall rate [mm/s]
snow (double) – snowfall rate [mm/s]
temperature (double) – air temperature [degC]
wind (double) – wind speed [m/s]
sw_in_direct (double) – direct shortwave radiation [W/m^2]
sw_in_diffuse (double) – diffuse shortwave radiation [W/m^2]
lw_in (double) – incoming longwave radiation [W/m^2]
p_atm (double) – atmospheric pressure [Pa]
rel_hum (double) – relative humidity [0..1]
- class shyft.hydrology.FSM2Configuration(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.FSM2Configuration) -> None
__init__(self: shyft.hydrology.FSM2Configuration, snow: shyft.hydrology.FSM2Configuration.Snow, surface: shyft.hydrology.FSM2Configuration.Surface) -> None
- class Albedo(self: shyft.hydrology.FSM2Configuration.Albedo, value: SupportsInt | SupportsIndex)¶
Bases:
pybind11_objectAlbedo model configuration
Members:
DIAGNOSTIC
PROGNOSTIC
- DIAGNOSTIC = <Albedo.DIAGNOSTIC: 0>¶
- PROGNOSTIC = <Albedo.PROGNOSTIC: 1>¶
- __init__(self: shyft.hydrology.FSM2Configuration.Albedo, value: SupportsInt | SupportsIndex) None¶
- FSM2Configuration.Albedo.name -> str
- property value¶
- class CanopyModel(self: shyft.hydrology.FSM2Configuration.CanopyModel, value: SupportsInt | SupportsIndex)¶
Bases:
pybind11_objectControl what canopy model is used
Members:
NONE
SINGLE_LAYER
TWO_LAYER
- NONE = <CanopyModel.NONE: 0>¶
- SINGLE_LAYER = <CanopyModel.SINGLE_LAYER: 1>¶
- TWO_LAYER = <CanopyModel.TWO_LAYER: 2>¶
- __init__(self: shyft.hydrology.FSM2Configuration.CanopyModel, value: SupportsInt | SupportsIndex) None¶
- FSM2Configuration.CanopyModel.name -> str
- property value¶
- class HeightReference(self: shyft.hydrology.FSM2Configuration.HeightReference, value: SupportsInt | SupportsIndex)¶
Bases:
pybind11_objectHow to threat height information relative canopy or ground
Members:
ABSOLUTE
CANOPY
- ABSOLUTE = <HeightReference.ABSOLUTE: 0>¶
- CANOPY = <HeightReference.CANOPY: 1>¶
- __init__(self: shyft.hydrology.FSM2Configuration.HeightReference, value: SupportsInt | SupportsIndex) None¶
- FSM2Configuration.HeightReference.name -> str
- property value¶
- class Snow(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.FSM2Configuration.Snow) -> None
__init__(self: shyft.hydrology.FSM2Configuration.Snow, albedo: shyft.hydrology.FSM2Configuration.Albedo, fraction: shyft.hydrology.FSM2Configuration.SnowFraction, conductivity: shyft.hydrology.FSM2Configuration.SnowConductivity, density: shyft.hydrology.FSM2Configuration.SnowDensity, grain: shyft.hydrology.FSM2Configuration.SnowGrain, hydrology: shyft.hydrology.FSM2Configuration.SnowHydrology, n_hydro_steps: typing.SupportsInt | typing.SupportsIndex = 10, n_layer_max: typing.SupportsInt | typing.SupportsIndex = 3, dz_min: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] = [0.1, 0.2, 0.4, 0.5, 0.6, 0.7]) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.FSM2Configuration.Snow) -> None
__init__(self: shyft.hydrology.FSM2Configuration.Snow, albedo: shyft.hydrology.FSM2Configuration.Albedo, fraction: shyft.hydrology.FSM2Configuration.SnowFraction, conductivity: shyft.hydrology.FSM2Configuration.SnowConductivity, density: shyft.hydrology.FSM2Configuration.SnowDensity, grain: shyft.hydrology.FSM2Configuration.SnowGrain, hydrology: shyft.hydrology.FSM2Configuration.SnowHydrology, n_hydro_steps: typing.SupportsInt | typing.SupportsIndex = 10, n_layer_max: typing.SupportsInt | typing.SupportsIndex = 3, dz_min: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex] = [0.1, 0.2, 0.4, 0.5, 0.6, 0.7]) -> None
- property albedo¶
albedo model configuration
- Type:
SnowAlbedo
- property conductivity¶
thermal conductivity option
- Type:
- property density¶
snow density, compaction calculation configuration
- Type:
- property dz_min¶
snow layer thickness distribution
- Type:
DoubleVector
- property fraction¶
snow fraction option for albedo srf calculation
- Type:
- property hydrology¶
snow hydrology model
- Type:
- property n_hydro_steps¶
number of snow hydrology sub steps
- Type:
int
- property n_layer_max¶
maximum number of snow layers
- Type:
int
- class SnowConductivity(self: shyft.hydrology.FSM2Configuration.SnowConductivity, value: SupportsInt | SupportsIndex)¶
Bases:
pybind11_objectThermal conductivity model for the snowpack
Members:
FIXED
VARIABLE
- FIXED = <SnowConductivity.FIXED: 0>¶
- VARIABLE = <SnowConductivity.VARIABLE: 1>¶
- __init__(self: shyft.hydrology.FSM2Configuration.SnowConductivity, value: SupportsInt | SupportsIndex) None¶
- FSM2Configuration.SnowConductivity.name -> str
- property value¶
- class SnowDensity(self: shyft.hydrology.FSM2Configuration.SnowDensity, value: SupportsInt | SupportsIndex)¶
Bases:
pybind11_objectControl how snow density is evolved
Members:
FIXED
MELT_RATE
OVERBURDEN
- FIXED = <SnowDensity.FIXED: 0>¶
- MELT_RATE = <SnowDensity.MELT_RATE: 1>¶
- OVERBURDEN = <SnowDensity.OVERBURDEN: 2>¶
- __init__(self: shyft.hydrology.FSM2Configuration.SnowDensity, value: SupportsInt | SupportsIndex) None¶
- FSM2Configuration.SnowDensity.name -> str
- property value¶
- class SnowExchange(self: shyft.hydrology.FSM2Configuration.SnowExchange, value: SupportsInt | SupportsIndex)¶
Bases:
pybind11_objectControl temperature and energy balance model in the snowpack
Members:
NEUTRAL
STABILITY_CORRECTED
- NEUTRAL = <SnowExchange.NEUTRAL: 0>¶
- STABILITY_CORRECTED = <SnowExchange.STABILITY_CORRECTED: 1>¶
- __init__(self: shyft.hydrology.FSM2Configuration.SnowExchange, value: SupportsInt | SupportsIndex) None¶
- FSM2Configuration.SnowExchange.name -> str
- property value¶
- class SnowFraction(self: shyft.hydrology.FSM2Configuration.SnowFraction, value: SupportsInt | SupportsIndex)¶
Bases:
pybind11_objectHow to compute the snow covered area from snow depth
Members:
BINARY
LINEAR
EXPONENTIAL
- BINARY = <SnowFraction.BINARY: 0>¶
- EXPONENTIAL = <SnowFraction.EXPONENTIAL: 2>¶
- LINEAR = <SnowFraction.LINEAR: 1>¶
- __init__(self: shyft.hydrology.FSM2Configuration.SnowFraction, value: SupportsInt | SupportsIndex) None¶
- FSM2Configuration.SnowFraction.name -> str
- property value¶
- class SnowGrain(self: shyft.hydrology.FSM2Configuration.SnowGrain, value: SupportsInt | SupportsIndex)¶
Bases:
pybind11_objectSnowGrain size evolution model configuration
Members:
FIXED
TEMPERATURE
TEMPERATURE_GRADIENT
- FIXED = <SnowGrain.FIXED: 0>¶
- TEMPERATURE = <SnowGrain.TEMPERATURE: 1>¶
- TEMPERATURE_GRADIENT = <SnowGrain.TEMPERATURE_GRADIENT: 2>¶
- __init__(self: shyft.hydrology.FSM2Configuration.SnowGrain, value: SupportsInt | SupportsIndex) None¶
- FSM2Configuration.SnowGrain.name -> str
- property value¶
- class SnowHydrology(self: shyft.hydrology.FSM2Configuration.SnowHydrology, value: SupportsInt | SupportsIndex)¶
Bases:
pybind11_objectControl how water flows through the snowpack
Members:
FREE_DRAINING
BUCKET
GRAVITATIONAL
- BUCKET = <SnowHydrology.BUCKET: 1>¶
- FREE_DRAINING = <SnowHydrology.FREE_DRAINING: 0>¶
- GRAVITATIONAL = <SnowHydrology.GRAVITATIONAL: 2>¶
- __init__(self: shyft.hydrology.FSM2Configuration.SnowHydrology, value: SupportsInt | SupportsIndex) None¶
- FSM2Configuration.SnowHydrology.name -> str
- property value¶
- class Surface(self: shyft.hydrology.FSM2Configuration.Surface)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.FSM2Configuration.Surface) None¶
- property canopy_model¶
canopy model configuration
- Type:
- property exchange_model¶
energy exchange stability adjustment configuration
- Type:
- property f_canopy_upper¶
fraction of vegetation in upper canopy layer [-]
- Type:
float
- property height_reference¶
height reference configuration
- Type:
- property z_temperature_humidity¶
measurement height of temperature and humidity [m]
- Type:
float
- property z_wind_subcanopy¶
sub canopy wind speed diagnostic height [m]
- Type:
float
- property z_windspeed¶
measurement height of forcing wind-speed [m]
- Type:
float
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.FSM2Configuration) -> None
__init__(self: shyft.hydrology.FSM2Configuration, snow: shyft.hydrology.FSM2Configuration.Snow, surface: shyft.hydrology.FSM2Configuration.Surface) -> None
- class shyft.hydrology.FSM2Parameter(self: shyft.hydrology.FSM2Parameter)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.FSM2Parameter) None¶
- property cfg¶
configuration
- Type:
- property snow¶
snow physics parameters
- Type:
- property tx¶
precipitation split temperature threshold, should be allowed for calibration, [degC]
- Type:
float
- property vegetation¶
vegetation/canopy parameters
- Type:
- class shyft.hydrology.FSM2Response(self: shyft.hydrology.FSM2Response)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.FSM2Response) None¶
- property g_soil¶
heat flux into the soil, [W/m^2]
- Type:
float
- property melt_rate¶
surface melt rate, [kg/m^2/s]
- Type:
float
- property r_runoff¶
average r_runoff, rain and snowmelt, for the cell, unit [mm/hour]
- property sca¶
average sca as a fraction of total cell area, unit (-)
- Type:
float
- property snow_depth¶
approximate snow-depth for the time-step, [m]
- Type:
float
- property snow_mass¶
total snow mass on ground [kg/m^2]
- Type:
float
- property sw_outgoing¶
outgoing SW radiation, [W/m^2]
- Type:
float
- property swe¶
average mass of snow for the cell, unit [kg/m^2] similar to [mm]
- Type:
float
- class shyft.hydrology.FSM2SnowParameters(self: shyft.hydrology.FSM2SnowParameters, a_melt_min: SupportsFloat | SupportsIndex = 0.5, a_fresh_max: SupportsFloat | SupportsIndex = 0.8, eta_ref: SupportsFloat | SupportsIndex = 37000000.0, h_fsc: SupportsFloat | SupportsIndex = 0.1, k_fixed: SupportsFloat | SupportsIndex = 0.24, rho_cold_max: SupportsFloat | SupportsIndex = 300.0, rho_fixed: SupportsFloat | SupportsIndex = 300.0, r_grain_fresh: SupportsFloat | SupportsIndex = 5e-05, rho_fresh: SupportsFloat | SupportsIndex = 100.0, rho_wind_packed: SupportsFloat | SupportsIndex = 300.0, rho_melt_max: SupportsFloat | SupportsIndex = 500.0, m_albedo_refresh: SupportsFloat | SupportsIndex = 10.0, k_metamorph: SupportsFloat | SupportsIndex = 2.8e-06, t_albedo_decay: SupportsFloat | SupportsIndex = 2.0, tau_albedo_cold: SupportsFloat | SupportsIndex = 3600000.0, tau_albedo_melt: SupportsFloat | SupportsIndex = 360000.0, tau_compaction: SupportsFloat | SupportsIndex = 720000.0, f_liq_irr: SupportsFloat | SupportsIndex = 0.03, z0: SupportsFloat | SupportsIndex = 0.001)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.FSM2SnowParameters, a_melt_min: SupportsFloat | SupportsIndex = 0.5, a_fresh_max: SupportsFloat | SupportsIndex = 0.8, eta_ref: SupportsFloat | SupportsIndex = 37000000.0, h_fsc: SupportsFloat | SupportsIndex = 0.1, k_fixed: SupportsFloat | SupportsIndex = 0.24, rho_cold_max: SupportsFloat | SupportsIndex = 300.0, rho_fixed: SupportsFloat | SupportsIndex = 300.0, r_grain_fresh: SupportsFloat | SupportsIndex = 5e-05, rho_fresh: SupportsFloat | SupportsIndex = 100.0, rho_wind_packed: SupportsFloat | SupportsIndex = 300.0, rho_melt_max: SupportsFloat | SupportsIndex = 500.0, m_albedo_refresh: SupportsFloat | SupportsIndex = 10.0, k_metamorph: SupportsFloat | SupportsIndex = 2.8e-06, t_albedo_decay: SupportsFloat | SupportsIndex = 2.0, tau_albedo_cold: SupportsFloat | SupportsIndex = 3600000.0, tau_albedo_melt: SupportsFloat | SupportsIndex = 360000.0, tau_compaction: SupportsFloat | SupportsIndex = 720000.0, f_liq_irr: SupportsFloat | SupportsIndex = 0.03, z0: SupportsFloat | SupportsIndex = 0.001) None¶
- property a_fresh_max¶
Maximum albedo for fresh snow
- Type:
float
- property a_melt_min¶
Minimum albedo for melting snow
- Type:
float
- property eta_ref¶
Reference snow viscosity (Pa s)
- Type:
float
- property f_liq_irr¶
Irreducible liquid water content of snow
- Type:
float
- property h_fsc¶
Snowcover fraction depth scale [m]
- Type:
float
- property k_fixed¶
Fixed thermal conductivity of snow (W/m/K)
- Type:
float
- property k_metamorph¶
Thermal metamorphism parameter (1/s)
- Type:
float
- property m_albedo_refresh¶
Snowfall to refresh albedo (kg/m^2)
- Type:
float
- property r_grain_fresh¶
Fresh snow grain radius [m]
- Type:
float
- property rho_cold_max¶
Maximum density for cold snow [kg/m^3]
- Type:
float
- property rho_fixed¶
Fixed snow density [kg/m^3]
- Type:
float
- property rho_fresh¶
Fresh snow density [kg/m^3]
- Type:
float
- property rho_melt_max¶
Maximum density for melting snow [kg/m^3]
- Type:
float
- property rho_wind_packed¶
Wind-packed snow density [kg/m^3]
- Type:
float
- property t_albedo_decay¶
Snow albedo decay temperature threshold [K]
- Type:
float
- property tau_albedo_cold¶
Cold snow albedo decay time scale (s)
- Type:
float
- property tau_albedo_melt¶
Melting snow albedo decay time scale (s)
- Type:
float
- property tau_compaction¶
Snow compaction timescale (s)
- Type:
float
- property z0¶
Snow roughness length [m]
- Type:
float
- class shyft.hydrology.FSM2State(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.FSM2State) -> None
__init__(self: shyft.hydrology.FSM2State, surface_layer: shyft.hydrology.FSM2State.SurfaceLayer, snowpack: shyft.hydrology.FSM2State.Snowpack, soil_profile: shyft.hydrology.FSM2State.SoilProfile) -> None
- class Layer(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.FSM2State.Layer) -> None
__init__(self: shyft.hydrology.FSM2State.Layer, dz: typing.SupportsFloat | typing.SupportsIndex, r_grain: typing.SupportsFloat | typing.SupportsIndex, m_ice: typing.SupportsFloat | typing.SupportsIndex, m_liquid: typing.SupportsFloat | typing.SupportsIndex, t: typing.SupportsFloat | typing.SupportsIndex) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.FSM2State.Layer) -> None
__init__(self: shyft.hydrology.FSM2State.Layer, dz: typing.SupportsFloat | typing.SupportsIndex, r_grain: typing.SupportsFloat | typing.SupportsIndex, m_ice: typing.SupportsFloat | typing.SupportsIndex, m_liquid: typing.SupportsFloat | typing.SupportsIndex, t: typing.SupportsFloat | typing.SupportsIndex) -> None
- property c_areal¶
areal heat capacity [J/K/m^2]
- Type:
float
- property conductivity¶
thermal conductivity [W/m/K]
- Type:
float
- property density¶
density [kg/m^3]
- Type:
float
- property dz¶
thickness [m]
- Type:
float
- property m_ice¶
ice content radius [kg/m^2]
- Type:
float
- property m_liquid¶
liquid content [kg/m^2]
- Type:
float
- property r_grain¶
grain radius [m]
- Type:
float
- property t¶
temperature [K]
- Type:
float
- class Snowpack(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.FSM2State.Snowpack) -> None
__init__(self: shyft.hydrology.FSM2State.Snowpack, albedo: typing.SupportsFloat | typing.SupportsIndex, rho: typing.SupportsFloat | typing.SupportsIndex, layers: collections.abc.Sequence[shyft.hydrology.FSM2State.Layer]) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.FSM2State.Snowpack) -> None
__init__(self: shyft.hydrology.FSM2State.Snowpack, albedo: typing.SupportsFloat | typing.SupportsIndex, rho: typing.SupportsFloat | typing.SupportsIndex, layers: collections.abc.Sequence[shyft.hydrology.FSM2State.Layer]) -> None
- property albedo¶
albedo [ ]
- Type:
float
- property layers¶
layers
- Type:
FSM2State.Snowpack.Layer
- property rho¶
density [kg/m3]
- Type:
float
- class SoilProfile(self: shyft.hydrology.FSM2State.SoilProfile)¶
Bases:
pybind11_object- class Layer(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.FSM2State.SoilProfile.Layer) -> None
__init__(self: shyft.hydrology.FSM2State.SoilProfile.Layer, dz: typing.SupportsFloat | typing.SupportsIndex, t: typing.SupportsFloat | typing.SupportsIndex, k: typing.SupportsFloat | typing.SupportsIndex, c_areal: typing.SupportsFloat | typing.SupportsIndex, theta: typing.SupportsFloat | typing.SupportsIndex) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.FSM2State.SoilProfile.Layer) -> None
__init__(self: shyft.hydrology.FSM2State.SoilProfile.Layer, dz: typing.SupportsFloat | typing.SupportsIndex, t: typing.SupportsFloat | typing.SupportsIndex, k: typing.SupportsFloat | typing.SupportsIndex, c_areal: typing.SupportsFloat | typing.SupportsIndex, theta: typing.SupportsFloat | typing.SupportsIndex) -> None
- property c_areal¶
areal heat capacity [J/m^2/K]
- Type:
float
- property dz¶
thickness [m]
- Type:
float
- property k¶
thermal conductivity [W/m/K]
- Type:
float
- property t¶
temperature [K]
- Type:
float
- property theta¶
volumetric soil moisture content [ ]
- Type:
float
- __init__(self: shyft.hydrology.FSM2State.SoilProfile) None¶
- property layers¶
soil layers
- class SurfaceLayer(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.FSM2State.SurfaceLayer) -> None
__init__(self: shyft.hydrology.FSM2State.SurfaceLayer, dz: typing.SupportsFloat | typing.SupportsIndex, k: typing.SupportsFloat | typing.SupportsIndex, g: typing.SupportsFloat | typing.SupportsIndex, t: typing.SupportsFloat | typing.SupportsIndex, a: typing.SupportsFloat | typing.SupportsIndex) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.FSM2State.SurfaceLayer) -> None
__init__(self: shyft.hydrology.FSM2State.SurfaceLayer, dz: typing.SupportsFloat | typing.SupportsIndex, k: typing.SupportsFloat | typing.SupportsIndex, g: typing.SupportsFloat | typing.SupportsIndex, t: typing.SupportsFloat | typing.SupportsIndex, a: typing.SupportsFloat | typing.SupportsIndex) -> None
- property a¶
albedo
- Type:
float
- property dz¶
thickness [m]
- Type:
float
- property g¶
moisture conductance [m/s]
- Type:
float
- property k¶
thermal conductivity [W/m/K]
- Type:
float
- property t¶
temperature [K]
- Type:
float
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.FSM2State) -> None
__init__(self: shyft.hydrology.FSM2State, surface_layer: shyft.hydrology.FSM2State.SurfaceLayer, snowpack: shyft.hydrology.FSM2State.Snowpack, soil_profile: shyft.hydrology.FSM2State.SoilProfile) -> None
- property snow¶
snow layer state
- Type:
SnowLayer
- property soil¶
soil layer state
- Type:
SoilLayer
- property surface¶
surface layer state
- Type:
FSM2SurfaceLayerState
- class shyft.hydrology.FSM2VegetationParameters(self: shyft.hydrology.FSM2VegetationParameters, c_vai: SupportsFloat | SupportsIndex = 36000.0, tau_unload_exp: SupportsFloat | SupportsIndex = 864000.0, g_moist_free: SupportsFloat | SupportsIndex = 0.01, r_leaf_bound: SupportsFloat | SupportsIndex = 20.0, f_unload_melt: SupportsFloat | SupportsIndex = 0.4, p_unload_temp: SupportsFloat | SupportsIndex = 187000.0, p_unload_wind: SupportsFloat | SupportsIndex = 156000.0)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.FSM2VegetationParameters, c_vai: SupportsFloat | SupportsIndex = 36000.0, tau_unload_exp: SupportsFloat | SupportsIndex = 864000.0, g_moist_free: SupportsFloat | SupportsIndex = 0.01, r_leaf_bound: SupportsFloat | SupportsIndex = 20.0, f_unload_melt: SupportsFloat | SupportsIndex = 0.4, p_unload_temp: SupportsFloat | SupportsIndex = 187000.0, p_unload_wind: SupportsFloat | SupportsIndex = 156000.0) None¶
- property c_vai¶
Vegetation heat capacity per unit VAI (J/K/m^2)
- Type:
float
- property f_unload_melt¶
Melt unloading fraction
- Type:
float
- property g_moist_free¶
Snow-free vegetation moisture conductance (m/s)
- Type:
float
- property p_unload_temp¶
Temperature unloading parameter (K s)
- Type:
float
- property p_unload_wind¶
Wind unloading parameter [m]
- Type:
float
- property r_leaf_bound¶
Leaf boundary resistance (s/m)^(1/2)
- Type:
float
- property tau_unload_exp¶
Exponential unloading time scale (s)
- Type:
float
- class shyft.hydrology.FlowAdjustResult(self: shyft.hydrology.FlowAdjustResult)¶
Bases:
pybind11_objectThe result type of region-model .adjust_state_to_target_flow(..) method
- __init__(self: shyft.hydrology.FlowAdjustResult) None¶
- property diagnostics¶
If tuning failed, the diagnostics of failure, zero length/empty if success
- Type:
str
- property q_0¶
The flow m3/s from selected catchments before tuning
- Type:
float
- property q_r¶
The obtaioned flow m3/s after tuning
- Type:
float
- class shyft.hydrology.FreeWaterEvaporationCalculator¶
Bases:
pybind11_objectEvapotranspiration model, Penman or combination method equation for open water, ponds and reservoirs, PM reference
L. Dingman Penmann evapotranspiration
[mm/s] units.
- __init__(*args, **kwargs)¶
- evaporation(self: shyft.hydrology.FreeWaterEvaporationCalculator, response: shyft.hydrology.FreeWaterEvaporationResponse, dt: shyft.time_series.time, swin_radiation: SupportsFloat | SupportsIndex, lw_radiation: SupportsFloat | SupportsIndex, tempmax: SupportsFloat | SupportsIndex, tempmin: SupportsFloat | SupportsIndex, rhumidity: SupportsFloat | SupportsIndex, water_area: SupportsFloat | SupportsIndex, albedo: SupportsFloat | SupportsIndex, elevation: SupportsFloat | SupportsIndex, windspeed: SupportsFloat | SupportsIndex) None¶
calculates evapotranspiration, updating response
- class shyft.hydrology.FreeWaterEvaporationResponse(self: shyft.hydrology.FreeWaterEvaporationResponse)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.FreeWaterEvaporationResponse) None¶
- property et¶
mm/h
- Type:
float
- class shyft.hydrology.GammaSnowCalculator(self: shyft.hydrology.GammaSnowCalculator)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.GammaSnowCalculator) None¶
- step(self: shyft.hydrology.GammaSnowCalculator, state: shyft.hydrology.GammaSnowState, response: shyft.hydrology.GammaSnowResponse, t: shyft.time_series.time, dt: shyft.time_series.time, parameter: shyft.hydrology.GammaSnowParameter, temperature: SupportsFloat | SupportsIndex, radiation: SupportsFloat | SupportsIndex, precipitation: SupportsFloat | SupportsIndex, wind_speed: SupportsFloat | SupportsIndex, rel_hum: SupportsFloat | SupportsIndex, forest_fraction: SupportsFloat | SupportsIndex, altitude: SupportsFloat | SupportsIndex) None¶
Step the snow model forward from time t to t+dt, given state, parameters and input.
Updates the state and response upon return.
- Parameters:
state (GammaSnowState) – param state state of type S,in/out, ref template parameters
response (GammaSnowResponse) – the response , out parameter.
t (float) – ttemperature degC, considered constant over timestep dt
dt (time) – length of time-step, seconds
param (GammaSnowParameter) – response result of type R, output only, ref. template parameters
radiation (float) – in W/m2, considered constant over timestep
precipitation (float) – in mm/h
wind_speed (float) – in m/s
rel_hum (float) – range 0..1
forest_fraction (float) – range 0..1, influences calculation of effective snow_cv
altitude (float) – 0..x [m], influences calculation of effective_snow_cv
- class shyft.hydrology.GammaSnowParameter(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.GammaSnowParameter) -> None
__init__(self: shyft.hydrology.GammaSnowParameter, winter_end_day_of_year: typing.SupportsInt | typing.SupportsIndex, initial_bare_ground_fraction: typing.SupportsFloat | typing.SupportsIndex = 0.04, snow_cv: typing.SupportsFloat | typing.SupportsIndex = 0.4, tx: typing.SupportsFloat | typing.SupportsIndex = -0.5, wind_scale: typing.SupportsFloat | typing.SupportsIndex = 2.0, wind_const: typing.SupportsFloat | typing.SupportsIndex = 1.0, max_water: typing.SupportsFloat | typing.SupportsIndex = 0.1, surface_magnitude: typing.SupportsFloat | typing.SupportsIndex = 30.0, max_albedo: typing.SupportsFloat | typing.SupportsIndex = 0.9, min_albedo: typing.SupportsFloat | typing.SupportsIndex = 0.6, fast_albedo_decay_rate: typing.SupportsFloat | typing.SupportsIndex = 5.0, slow_albedo_decay_rate: typing.SupportsFloat | typing.SupportsIndex = 5.0, snowfall_reset_depth: typing.SupportsFloat | typing.SupportsIndex = 0.4, glacier_albedo: typing.SupportsFloat | typing.SupportsIndex = False) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.GammaSnowParameter) -> None
__init__(self: shyft.hydrology.GammaSnowParameter, winter_end_day_of_year: typing.SupportsInt | typing.SupportsIndex, initial_bare_ground_fraction: typing.SupportsFloat | typing.SupportsIndex = 0.04, snow_cv: typing.SupportsFloat | typing.SupportsIndex = 0.4, tx: typing.SupportsFloat | typing.SupportsIndex = -0.5, wind_scale: typing.SupportsFloat | typing.SupportsIndex = 2.0, wind_const: typing.SupportsFloat | typing.SupportsIndex = 1.0, max_water: typing.SupportsFloat | typing.SupportsIndex = 0.1, surface_magnitude: typing.SupportsFloat | typing.SupportsIndex = 30.0, max_albedo: typing.SupportsFloat | typing.SupportsIndex = 0.9, min_albedo: typing.SupportsFloat | typing.SupportsIndex = 0.6, fast_albedo_decay_rate: typing.SupportsFloat | typing.SupportsIndex = 5.0, slow_albedo_decay_rate: typing.SupportsFloat | typing.SupportsIndex = 5.0, snowfall_reset_depth: typing.SupportsFloat | typing.SupportsIndex = 0.4, glacier_albedo: typing.SupportsFloat | typing.SupportsIndex = False) -> None
- property calculate_iso_pot_energy¶
Whether or not to calculate the potential energy flux,default=false
- Type:
float
- effective_snow_cv(self: shyft.hydrology.GammaSnowParameter, forest_fraction: SupportsFloat | SupportsIndex, altitude: SupportsFloat | SupportsIndex) float¶
returns the effective snow cv, taking the forest_fraction and altitude into the equations using corresponding factors
- property fast_albedo_decay_rate¶
Albedo decay rate during melt [days],default=5.0
- Type:
float
- property glacier_albedo¶
Glacier ice fixed albedo, default=0.4
- Type:
float
- property initial_bare_ground_fraction¶
Bare ground fraction at melt onset,default= 0.04
- Type:
float
- is_snow_season(self: shyft.hydrology.GammaSnowParameter, t: shyft.time_series.time) bool¶
returns true if specified t is within the snow season, e.g. sept.. winder_end_day_of_year
- is_start_melt_season(self: shyft.hydrology.GammaSnowParameter, t: shyft.time_series.time, dt: shyft.time_series.time = 0) bool¶
true if specified interval t day of year is wind_end_day_of_year
- property max_albedo¶
Maximum albedo value,default=0.9
- Type:
float
- property max_water¶
Maximum liquid water content,default=0.1
- Type:
float
- property min_albedo¶
Minimum albedo value,default=0.6
- Type:
float
- property n_winter_days¶
number of winter-days, default 221
- Type:
int
- property slow_albedo_decay_rate¶
Albedo decay rate in cold conditions [days],default=5.0
- Type:
float
- property snow_cv¶
Spatial coefficient variation of fresh snowfall, default= 0.4
- Type:
float
- property snow_cv_altitude_factor¶
default=0.0, [1/m] the effective snow_cv gets an additional value of altitude[m]* snow_cv_altitude_factor
- Type:
float
- property snow_cv_forest_factor¶
default=0.0, [ratio] the effective snow_cv gets an additional value of geo.forest_fraction()*snow_cv_forest_factor
- Type:
float
- property snowfall_reset_depth¶
Snowfall required to reset albedo [mm],default=5.0
- Type:
float
- property surface_magnitude¶
Surface layer magnitude,default=30.0
- Type:
float
- property tx¶
default= -0.5 [degC]
- Type:
float
- property wind_const¶
Intercept in turbulent wind function,default=1.0
- Type:
float
- property wind_scale¶
Slope in turbulent wind function default=2.0 [m/s]
- Type:
float
- property winter_end_day_of_year¶
Last day of accumulation season,default= 100
- Type:
int
- class shyft.hydrology.GammaSnowResponse(self: shyft.hydrology.GammaSnowResponse)¶
Bases:
pybind11_objectThe response(output) from gamma-snow for one time-step
- __init__(self: shyft.hydrology.GammaSnowResponse) None¶
- property outflow¶
Water out from the snow pack [mm/h]
- Type:
float
- property sca¶
Snow covered area [0..1]
- Type:
float
- property storage¶
Snow storage in [mm] over the area
- Type:
float
- class shyft.hydrology.GammaSnowState(*args, **kwargs)¶
Bases:
pybind11_objectThe state description of the GammaSnow routine
Overloaded function.
__init__(self: shyft.hydrology.GammaSnowState) -> None
__init__(self: shyft.hydrology.GammaSnowState, albedo: typing.SupportsFloat | typing.SupportsIndex = 0.4, lwc: typing.SupportsFloat | typing.SupportsIndex = 0.1, surface_heat: typing.SupportsFloat | typing.SupportsIndex = 30000.0, alpha: typing.SupportsFloat | typing.SupportsIndex = 1.26, sdc_melt_mean: typing.SupportsFloat | typing.SupportsIndex = 0.0, acc_melt: typing.SupportsFloat | typing.SupportsIndex = 0.0, iso_pot_energy: typing.SupportsFloat | typing.SupportsIndex = 0.0, temp_swe: typing.SupportsFloat | typing.SupportsIndex = 0.0) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.GammaSnowState) -> None
__init__(self: shyft.hydrology.GammaSnowState, albedo: typing.SupportsFloat | typing.SupportsIndex = 0.4, lwc: typing.SupportsFloat | typing.SupportsIndex = 0.1, surface_heat: typing.SupportsFloat | typing.SupportsIndex = 30000.0, alpha: typing.SupportsFloat | typing.SupportsIndex = 1.26, sdc_melt_mean: typing.SupportsFloat | typing.SupportsIndex = 0.0, acc_melt: typing.SupportsFloat | typing.SupportsIndex = 0.0, iso_pot_energy: typing.SupportsFloat | typing.SupportsIndex = 0.0, temp_swe: typing.SupportsFloat | typing.SupportsIndex = 0.0) -> None
- property acc_melt¶
acc_melt (Accumulated melt depth) [mm],default = 0.0
- Type:
float
- property albedo¶
albedo (Broadband snow reflectivity fraction),default = 0.4
- Type:
float
- property alpha¶
alpha (Dynamic shape state in the SDC),default = 1.26
- Type:
float
- property iso_pot_energy¶
iso_pot_energy (Accumulated energy assuming isothermal snow surface) [J/m2],default = 0.0
- Type:
float
- property lwc¶
lwc (liquid water content) [mm],default = 0.1
- Type:
float
- property sdc_melt_mean¶
sdc_melt_mean (Mean snow storage at melt onset) [mm],default = 0.0
- Type:
float
- property surface_heat¶
surface_heat (Snow surface cold content) [J/m2],default = 30000.0
- Type:
float
- property temp_swe¶
temp_swe (Depth of temporary new snow layer during spring) [mm],default = 0.0
- Type:
float
- class shyft.hydrology.GeoCellData(*args, **kwargs)¶
Bases:
pybind11_objectRepresents common constant geo_cell properties across several possible models and cell assemblies. The idea is that most of our algorithms uses one or more of these properties, so we provide a common aspect that keeps this together. Currently it keep these items: - mid-point geo_point, (x,y,z) (default 0) - TIN data - the area in m^2, (default 1000 x 1000 m^2) - land_type_fractions (unspecified=1) - catchment_id def (-1) - radiation_slope_factor def 0.9 - routing_info def(0,0.0), i.e. not routed and hydrological distance=0.0m
Overloaded function.
__init__(self: shyft.hydrology.GeoCellData) -> None
__init__(self: shyft.hydrology.GeoCellData, mid_point: shyft.time_series.GeoPoint, area: typing.SupportsFloat | typing.SupportsIndex, catchment_id: typing.SupportsInt | typing.SupportsIndex, radiation_slope_factor: typing.SupportsFloat | typing.SupportsIndex = 0.9, land_type_fractions: shyft.hydrology.LandTypeFractions = LandTypeFractions(glacier=0, lake=0, forest=0, unspecified=1), routing_info: shyft.hydrology.RoutingInfo = RoutingInfo(id=0, distance=0)) -> None
Constructs a GeoCellData with all parameters specified
- Parameters:
mid_point (GeoPoint) – specifies the x,y,z mid-point of the cell-area
area (float) – area in unit [m^2]
catchment_id (int) – catchment-id that this cell is a part of
radiation_slope_factor (float) – aspect dependent factor used to calculate the effective radiation for this cell,range 0.0..1.0
land_type_fractions (LandTypeFractions) – specifies the fractions of glacier, forrest, lake and reservoirs for this cell
routing_info (RoutingInfo) – Specifies the destination routing network-node and velocity for this cell
__init__(self: shyft.hydrology.GeoCellData, p1: shyft.time_series.GeoPoint, p2: shyft.time_series.GeoPoint, p3: shyft.time_series.GeoPoint, epsg_id: typing.SupportsInt | typing.SupportsIndex, catchment_id: typing.SupportsInt | typing.SupportsIndex, land_type_fractions: shyft.hydrology.LandTypeFractions = LandTypeFractions(glacier=0, lake=0, forest=0, unspecified=1), routing_info: shyft.hydrology.RoutingInfo = RoutingInfo(id=0, distance=0)) -> None
Constructs a TIN-based GeoCellData with all parameters specified, slope/aspect etc. is based on TIN
- Parameters:
p1 (GeoPoint) – specifies the first vertex in TIN
p2 (GeoPoint) – specifies the second vertex in TIN
p3 (GeoPoint) – specifies the third vertex in TIN
epsg_id (int) – specifies the geo projection as epsg-id, used for projection from cartesian coord to long-lat algorithms that needs this(e.g. radiation, TIN-models)
catchment_id (int) – catchment-id that this cell is a part of
land_type_fractions (LandTypeFractions) – specifies the fractions of glacier, forrest, lake and reservoirs for this cell
routing_info (RoutingInfo) – Specifies the destination routing network-node and velocity for this cell
- class SoilDescription(self: shyft.hydrology.GeoCellData.SoilDescription, dz_soil: collections.abc.Sequence[SupportsFloat | SupportsIndex] = [0.1, 0.2, 0.4, 0.8], f_clay: SupportsFloat | SupportsIndex = 0.3, f_sand: SupportsFloat | SupportsIndex = 0.6, g_sat: SupportsFloat | SupportsIndex = 0.01, z0_snow_free: SupportsFloat | SupportsIndex = 0.1, f_sat: SupportsFloat | SupportsIndex = 0.27, t_prf: SupportsFloat | SupportsIndex = 263.0)¶
Bases:
pybind11_objectDescribes the soil properties of a cell
- __init__(self: shyft.hydrology.GeoCellData.SoilDescription, dz_soil: collections.abc.Sequence[SupportsFloat | SupportsIndex] = [0.1, 0.2, 0.4, 0.8], f_clay: SupportsFloat | SupportsIndex = 0.3, f_sand: SupportsFloat | SupportsIndex = 0.6, g_sat: SupportsFloat | SupportsIndex = 0.01, z0_snow_free: SupportsFloat | SupportsIndex = 0.1, f_sat: SupportsFloat | SupportsIndex = 0.27, t_prf: SupportsFloat | SupportsIndex = 263.0) None¶
- property dz_soil¶
Thickness of soil layers [m]
- Type:
DoubleVector
- property f_clay¶
Soil clay fraction
- Type:
float
- property f_sand¶
Soil sand fraction
- Type:
float
- property f_sat¶
Initial soil layer moisture/saturation
- Type:
float
- property g_sat¶
Surface conductance for saturated soil (m/s)
- Type:
float
- property t_prf¶
Initial soil layer temperature [K]
- Type:
float
- property z0_snow_free¶
Snow-free surface roughness length [m]
- Type:
float
- class VegetationDescription(self: shyft.hydrology.GeoCellData.VegetationDescription, h_base: SupportsFloat | SupportsIndex = 2.0, h_canopy: SupportsFloat | SupportsIndex = 0.2, vai: SupportsFloat | SupportsIndex = 0.0, a_dense_free: SupportsFloat | SupportsIndex = 0.1, a_dense_snow: SupportsFloat | SupportsIndex = 0.3, refl_elem_free: SupportsFloat | SupportsIndex = 0.27, refl_elem_snow: SupportsFloat | SupportsIndex = 0.65, a_ground_free: SupportsFloat | SupportsIndex = 0.2, k_extinction: SupportsFloat | SupportsIndex = 0.5, k_wind_decay: SupportsFloat | SupportsIndex = 2.5, m_snow_cap_vai: SupportsFloat | SupportsIndex = 4.4)¶
Bases:
pybind11_objectDescribes the vegetation properties of a cell
- __init__(self: shyft.hydrology.GeoCellData.VegetationDescription, h_base: SupportsFloat | SupportsIndex = 2.0, h_canopy: SupportsFloat | SupportsIndex = 0.2, vai: SupportsFloat | SupportsIndex = 0.0, a_dense_free: SupportsFloat | SupportsIndex = 0.1, a_dense_snow: SupportsFloat | SupportsIndex = 0.3, refl_elem_free: SupportsFloat | SupportsIndex = 0.27, refl_elem_snow: SupportsFloat | SupportsIndex = 0.65, a_ground_free: SupportsFloat | SupportsIndex = 0.2, k_extinction: SupportsFloat | SupportsIndex = 0.5, k_wind_decay: SupportsFloat | SupportsIndex = 2.5, m_snow_cap_vai: SupportsFloat | SupportsIndex = 4.4) None¶
- property a_dense_free¶
Snow-free dense canopy albedo
- Type:
float
- property a_dense_snow¶
Snow-covered dense canopy albedo
- Type:
float
- property a_ground_free¶
Snow-free ground albedo
- Type:
float
- property h_base¶
Canopy base height [m]
- Type:
float
- property h_canopy¶
Canopy height [m]
- Type:
float
- property k_extinction¶
Vegetation light extinction coefficient
- Type:
float
- property k_wind_decay¶
Canopy wind decay coefficient
- Type:
float
- property m_snow_cap_vai¶
Intercepted snow capacity per unit VAI (kg/m^2)
- Type:
float
- property refl_elem_free¶
Canopy element reflectivity
- Type:
float
- property refl_elem_snow¶
Canopy snow reflectivity
- Type:
float
- property vai¶
Vegetation area index
- Type:
float
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.GeoCellData) -> None
__init__(self: shyft.hydrology.GeoCellData, mid_point: shyft.time_series.GeoPoint, area: typing.SupportsFloat | typing.SupportsIndex, catchment_id: typing.SupportsInt | typing.SupportsIndex, radiation_slope_factor: typing.SupportsFloat | typing.SupportsIndex = 0.9, land_type_fractions: shyft.hydrology.LandTypeFractions = LandTypeFractions(glacier=0, lake=0, forest=0, unspecified=1), routing_info: shyft.hydrology.RoutingInfo = RoutingInfo(id=0, distance=0)) -> None
Constructs a GeoCellData with all parameters specified
- Parameters:
mid_point (GeoPoint) – specifies the x,y,z mid-point of the cell-area
area (float) – area in unit [m^2]
catchment_id (int) – catchment-id that this cell is a part of
radiation_slope_factor (float) – aspect dependent factor used to calculate the effective radiation for this cell,range 0.0..1.0
land_type_fractions (LandTypeFractions) – specifies the fractions of glacier, forrest, lake and reservoirs for this cell
routing_info (RoutingInfo) – Specifies the destination routing network-node and velocity for this cell
__init__(self: shyft.hydrology.GeoCellData, p1: shyft.time_series.GeoPoint, p2: shyft.time_series.GeoPoint, p3: shyft.time_series.GeoPoint, epsg_id: typing.SupportsInt | typing.SupportsIndex, catchment_id: typing.SupportsInt | typing.SupportsIndex, land_type_fractions: shyft.hydrology.LandTypeFractions = LandTypeFractions(glacier=0, lake=0, forest=0, unspecified=1), routing_info: shyft.hydrology.RoutingInfo = RoutingInfo(id=0, distance=0)) -> None
Constructs a TIN-based GeoCellData with all parameters specified, slope/aspect etc. is based on TIN
- Parameters:
p1 (GeoPoint) – specifies the first vertex in TIN
p2 (GeoPoint) – specifies the second vertex in TIN
p3 (GeoPoint) – specifies the third vertex in TIN
epsg_id (int) – specifies the geo projection as epsg-id, used for projection from cartesian coord to long-lat algorithms that needs this(e.g. radiation, TIN-models)
catchment_id (int) – catchment-id that this cell is a part of
land_type_fractions (LandTypeFractions) – specifies the fractions of glacier, forrest, lake and reservoirs for this cell
routing_info (RoutingInfo) – Specifies the destination routing network-node and velocity for this cell
- area(self: shyft.hydrology.GeoCellData) float¶
returns the effective area, as projected to the horisontal plane, in m^2
- aspect(self: shyft.hydrology.GeoCellData) float¶
returns aspect, deg
- catchment_id(self: shyft.hydrology.GeoCellData) int¶
returns the current catchment_id
- property epsg_id¶
the epsg-id that should consistently identify the geo projection for all cells in a region model
- Type:
int
- is_tin(self: shyft.hydrology.GeoCellData) bool¶
returns true if the geo-cell is fully specified as a TIN model
- land_type_fractions_info(self: shyft.hydrology.GeoCellData) shyft.hydrology.LandTypeFractions¶
land_type_fractions
- mid_point(self: shyft.hydrology.GeoCellData) shyft.time_series.GeoPoint¶
returns the mid_point
- radiation_slope_factor(self: shyft.hydrology.GeoCellData) float¶
- property routing_info¶
routing information for the cell keep destination id and hydrological distance to destination
- Type:
- set_catchment_id(self: shyft.hydrology.GeoCellData, catchment_id: SupportsInt | SupportsIndex) None¶
Set the catchment_id to specified value Note: Only use this method before a region-model is created
- Parameters:
catchment_id (int) – Catchment-id for this cell
- set_land_type_fractions(self: shyft.hydrology.GeoCellData, ltf: shyft.hydrology.LandTypeFractions) None¶
set new LandTypeFractions
- set_tin_data(self: shyft.hydrology.GeoCellData, vertexes: shyft.time_series.GeoPointVector) None¶
set TIN data from vector of vertexes
- slope(self: shyft.hydrology.GeoCellData) float¶
returns slope, deg
- property soil¶
describes the soil properties of this cell
- Type:
- surface_area(self: shyft.hydrology.GeoCellData) float¶
returns the real surface area in m^2
- property vegetation¶
describes the vegetation properties of this cell
- Type:
- vertexes(self: shyft.hydrology.GeoCellData) shyft.time_series.GeoPointVector¶
returns vector of tin vertexes
- class shyft.hydrology.GeoCellDataClient(self: shyft.hydrology.GeoCellDataClient, host_port: str, timeout_ms: SupportsInt | SupportsIndex, operation_timeout_ms: SupportsInt | SupportsIndex = 0)¶
Bases:
pybind11_objectThe client api for the shyft.hydrology geo_cell_data model service.
Creates a python client that can communicate with the corresponding server
- __init__(self: shyft.hydrology.GeoCellDataClient, host_port: str, timeout_ms: SupportsInt | SupportsIndex, operation_timeout_ms: SupportsInt | SupportsIndex = 0) None¶
Creates a python client that can communicate with the corresponding server
- close(self: shyft.hydrology.GeoCellDataClient) None¶
Close the connection. It will automatically reopen if needed.
- get_model_infos(self: shyft.hydrology.GeoCellDataClient, mids: collections.abc.Sequence[SupportsInt | SupportsIndex], created_in: shyft.time_series.UtcPeriod = UtcPeriod()) list[shyft.time_series.ModelInfo]¶
returns all or selected model-info objects based on model-identifiers(mids)
- Parameters:
mids (IntVector) – empty = all, or a list of known exisiting model-identifiers
created_in (UtcPeriod) – For which period you are interested in model-infos.
- Returns:
model_infos. Strongly typed list of ModelInfo
- Return type:
ModelInfoVector
- property host_port¶
Endpoint network address of the remote server.
- Type:
str
- property is_open¶
If the connection to the remote server is (still) open.
- Type:
bool
- property operation_timeout_ms¶
Operation timeout for remote server operations, in number milliseconds.
- Type:
int
- read_model(self: shyft.hydrology.GeoCellDataClient, mid: SupportsInt | SupportsIndex) shyft.hydrology.GeoCellDataModel¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting model from the server
- Return type:
- read_models(self: shyft.hydrology.GeoCellDataClient, mids: collections.abc.Sequence[SupportsInt | SupportsIndex]) list[shyft.hydrology.GeoCellDataModel]¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mids (list[int]) – A strongly typed list of ints, the model-identifers for the wanted models
- Returns:
The resulting model from the server
- Return type:
- property reconnect_count¶
Number of reconnects to the remote server that have been performed.
- Type:
int
- remove_model(self: shyft.hydrology.GeoCellDataClient, mid: SupportsInt | SupportsIndex) int¶
Remove the specified model bymodel-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
ec. 0 or error-code?
- Return type:
int
- store_model(self: shyft.hydrology.GeoCellDataClient, m: shyft.hydrology.GeoCellDataModel, mi: shyft.time_series.ModelInfo) int¶
Store the model to backend, if m.id==0 then a new unique model-info is created and used
- property timeout_ms¶
Timout for remote server operations, in number milliseconds.
- Type:
int
- update_model_info(self: shyft.hydrology.GeoCellDataClient, mid: SupportsInt | SupportsIndex, mi: shyft.time_series.ModelInfo) bool¶
Update the model-info for specified model-identifier(mid)
- Parameters:
mid (int) – model-identifer
mi (ModelInfo) – The new updated model-info
- Returns:
ok. true if success
- Return type:
bool
- class shyft.hydrology.GeoCellDataModel(self: shyft.hydrology.GeoCellDataModel)¶
Bases:
pybind11_objectA model, with mandatory identifier and geo-cell-data vector. The optional filled in epsg, polygon and json members can provide useful information on how it was created, or can be presented.
- __init__(self: shyft.hydrology.GeoCellDataModel) None¶
- property epsg_id¶
EPSG code for the polygon coordinate reference system
- Type:
int
- property geo_cell_data¶
a strongly typed list of geo-cell-data, the geo-personality of Shyft cells
- Type:
- property id¶
unique model identifier
- Type:
int
- property json¶
extra useful json formatted information
- Type:
str
- property polygon¶
convex hull for the geo_cell_data
- Type:
- class shyft.hydrology.GeoCellDataModelVector(*args, **kwargs)¶
Bases:
pybind11_objectA strongly typed list of GeoCellDataModel’s
Overloaded function.
__init__(self: shyft.hydrology.GeoCellDataModelVector) -> None
__init__(self: shyft.hydrology.GeoCellDataModelVector, arg0: collections.abc.Sequence[shyft.hydrology.GeoCellDataModel]) -> None
Copy constructor
__init__(self: shyft.hydrology.GeoCellDataModelVector, arg0: collections.abc.Iterable) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.GeoCellDataModelVector) -> None
__init__(self: shyft.hydrology.GeoCellDataModelVector, arg0: collections.abc.Sequence[shyft.hydrology.GeoCellDataModel]) -> None
Copy constructor
__init__(self: shyft.hydrology.GeoCellDataModelVector, arg0: collections.abc.Iterable) -> None
- append(self: collections.abc.Sequence[shyft.hydrology.GeoCellDataModel], x: shyft.hydrology.GeoCellDataModel) None¶
Add an item to the end of the list
- clear(self: collections.abc.Sequence[shyft.hydrology.GeoCellDataModel]) None¶
Clear the contents
- extend(*args, **kwargs)¶
Overloaded function.
extend(self: collections.abc.Sequence[shyft.hydrology.GeoCellDataModel], L: collections.abc.Sequence[shyft.hydrology.GeoCellDataModel]) -> None
Extend the list by appending all the items in the given list
extend(self: collections.abc.Sequence[shyft.hydrology.GeoCellDataModel], L: collections.abc.Iterable) -> None
Extend the list by appending all the items in the given list
- insert(self: collections.abc.Sequence[shyft.hydrology.GeoCellDataModel], i: SupportsInt | SupportsIndex, x: shyft.hydrology.GeoCellDataModel) None¶
Insert an item at a given position.
- pop(*args, **kwargs)¶
Overloaded function.
pop(self: collections.abc.Sequence[shyft.hydrology.GeoCellDataModel]) -> shyft.hydrology.GeoCellDataModel
Remove and return the last item
pop(self: collections.abc.Sequence[shyft.hydrology.GeoCellDataModel], i: typing.SupportsInt | typing.SupportsIndex) -> shyft.hydrology.GeoCellDataModel
Remove and return the item at index
i
- size(self: collections.abc.Sequence[shyft.hydrology.GeoCellDataModel]) int¶
- class shyft.hydrology.GeoCellDataServer(self: shyft.hydrology.GeoCellDataServer, root_dir: str, config: shyft.time_series.ServerConfig = shyft.time_series.ServerConfig(stale_duration='1970-01-01T01:00:00Z', stale_sweep_interval='1970-01-01T00:00:00.100000Z', log=shyft.time_series.LogConfig(file='', level=200)))¶
Bases:
pybind11_objectThe server-side component for the shyft.hydrology geo_cell_data model repository.
Creates a server object that serves models from root_dir. The root_dir will be create if it does not exists.
- Parameters:
root_dir (str) – Path to the root-directory that keeps/will keep the model-files
config (ServerConfig) – Configuration of the server
- __init__(self: shyft.hydrology.GeoCellDataServer, root_dir: str, config: shyft.time_series.ServerConfig = shyft.time_series.ServerConfig(stale_duration='1970-01-01T01:00:00Z', stale_sweep_interval='1970-01-01T00:00:00.100000Z', log=shyft.time_series.LogConfig(file='', level=200))) None¶
Creates a server object that serves models from root_dir. The root_dir will be create if it does not exists.
- Parameters:
root_dir (str) – Path to the root-directory that keeps/will keep the model-files
config (ServerConfig) – Configuration of the server
- get_listening_port(self: shyft.hydrology.GeoCellDataServer) int¶
returns the port number it’s listening at for serving incoming request
- get_max_connections(self: shyft.hydrology.GeoCellDataServer) int¶
returns the maximum number of connections to be served concurrently
- get_model_infos(self: shyft.hydrology.GeoCellDataServer, mids: collections.abc.Sequence[SupportsInt | SupportsIndex], created_in: shyft.time_series.UtcPeriod = UtcPeriod()) list[shyft.time_series.ModelInfo]¶
returns all or selected model-info objects based on model-identifiers(mids)
- Parameters:
mids (IntVector) – empty = all, or a list of known exisiting model-identifiers
created_in (UtcPeriod) – For which period you are interested in model-infos.
- Returns:
model_infos. Strongly typed list of ModelInfo
- Return type:
ModelInfoVector
- is_running(self: shyft.hydrology.GeoCellDataServer) bool¶
true if server is listening and running
See also
start_server()
- read_model(self: shyft.hydrology.GeoCellDataServer, mid: SupportsInt | SupportsIndex) shyft.hydrology.GeoCellDataModel¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting model from the server
- Return type:
- read_model_blob(self: shyft.hydrology.GeoCellDataServer, mid: SupportsInt | SupportsIndex) shyft.time_series.ByteVector¶
Read and return the model blob for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting blob model from the server
- Return type:
ByteVector
- read_models(self: shyft.hydrology.GeoCellDataServer, mids: collections.abc.Sequence[SupportsInt | SupportsIndex]) list[shyft.hydrology.GeoCellDataModel]¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mids (list[int]) – A strongly typed list of ints, the model-identifers for the wanted models
- Returns:
The resulting model from the server
- Return type:
- remove_model(self: shyft.hydrology.GeoCellDataServer, mid: SupportsInt | SupportsIndex) int¶
Remove the specified model bymodel-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
ec. 0 or error-code?
- Return type:
int
- set_listening_ip(self: shyft.hydrology.GeoCellDataServer, ip: str) None¶
set the listening port for the service
- Parameters:
ip (str) – ip or host-name to start listening on
- Returns:
nothing.
- Return type:
None
- set_listening_port(self: shyft.hydrology.GeoCellDataServer, port_no: SupportsInt | SupportsIndex) None¶
set the listening port for the service
- Parameters:
port_no (int) – a valid and available tcp-ip port number to listen on.
20000 (typically it could be)
- Returns:
nothing.
- Return type:
None
- set_max_connections(self: shyft.hydrology.GeoCellDataServer, max_connect: SupportsInt | SupportsIndex) None¶
limits simultaneous connections to the server (it’s multithreaded, and uses on thread pr. connect)
- Parameters:
max_connect (int) – maximum number of connections before denying more connections
See also
get_max_connections()
- property stale_connection_close_count¶
returns count of connection closed due to stale/no communication activity
- Type:
int
- start_server(self: shyft.hydrology.GeoCellDataServer) int¶
start server listening in background, and processing messages
See also
set_listening_port(port_no),is_running
- Returns:
port_no. the port used for listening operations, either the value as by set_listening_port, or if it was unspecified, a new available port
- Return type:
in
- stop_server(self: shyft.hydrology.GeoCellDataServer, timeout: SupportsInt | SupportsIndex = 1000) None¶
stop serving connections, gracefully.
See also
start_server()
- store_model(self: shyft.hydrology.GeoCellDataServer, m: shyft.hydrology.GeoCellDataModel, mi: shyft.time_series.ModelInfo) int¶
Store the model to backend, if m.id==0 then a new unique model-info is created and used
- update_model_info(self: shyft.hydrology.GeoCellDataServer, mid: SupportsInt | SupportsIndex, mi: shyft.time_series.ModelInfo) bool¶
Update the model-info for specified model-identifier(mid)
- Parameters:
mid (int) – model-identifer
mi (ModelInfo) – The new updated model-info
- Returns:
ok. true if success
- Return type:
bool
- class shyft.hydrology.GeoCellDataVector(*args, **kwargs)¶
Bases:
pybind11_objectA vector, list, of GeoCellData
Overloaded function.
__init__(self: shyft.hydrology.GeoCellDataVector) -> None
__init__(self: shyft.hydrology.GeoCellDataVector, arg0: shyft.hydrology.GeoCellDataVector) -> None
Copy constructor
__init__(self: shyft.hydrology.GeoCellDataVector, arg0: collections.abc.Iterable) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.GeoCellDataVector) -> None
__init__(self: shyft.hydrology.GeoCellDataVector, arg0: shyft.hydrology.GeoCellDataVector) -> None
Copy constructor
__init__(self: shyft.hydrology.GeoCellDataVector, arg0: collections.abc.Iterable) -> None
- append(self: shyft.hydrology.GeoCellDataVector, x: shyft.hydrology.GeoCellData) None¶
Add an item to the end of the list
- clear(self: shyft.hydrology.GeoCellDataVector) None¶
Clear the contents
- static deserialize(arg0: shyft.time_series.ByteVector) object¶
deserialize from a binary to GeoCellDataVector
- extend(*args, **kwargs)¶
Overloaded function.
extend(self: shyft.hydrology.GeoCellDataVector, L: shyft.hydrology.GeoCellDataVector) -> None
Extend the list by appending all the items in the given list
extend(self: shyft.hydrology.GeoCellDataVector, L: collections.abc.Iterable) -> None
Extend the list by appending all the items in the given list
- insert(self: shyft.hydrology.GeoCellDataVector, i: SupportsInt | SupportsIndex, x: shyft.hydrology.GeoCellData) None¶
Insert an item at a given position.
- polygon_buffer(self: shyft.hydrology.GeoCellDataVector, distance: SupportsFloat | SupportsIndex) shyft.time_series.GeoPointVector¶
Computes the polygon_buffer of tin points, or mid-points, using boost::geometry::buffer algorithm If number of points is large, currently > 50, a reduction algorithm using convex_hull is first applied
- Parameters:
distance (float) – metric[m] buffer distance
- Returns:
polygon. A closed polygon envelope around the cells in the model
- Return type:
- pop(*args, **kwargs)¶
Overloaded function.
pop(self: shyft.hydrology.GeoCellDataVector) -> shyft.hydrology.GeoCellData
Remove and return the last item
pop(self: shyft.hydrology.GeoCellDataVector, i: typing.SupportsInt | typing.SupportsIndex) -> shyft.hydrology.GeoCellData
Remove and return the item at index
i
- serialize(self: shyft.hydrology.GeoCellDataVector) object¶
serialize to a binary byte vector
- size(self: shyft.hydrology.GeoCellDataVector) int¶
- class shyft.hydrology.GeoPointSource(*args, **kwargs)¶
Bases:
pybind11_objectGeoPointSource contains common properties, functions for the point sources in Shyft. Typically it contains a GeoPoint (3d position), plus a time-series
Overloaded function.
__init__(self: shyft.hydrology.GeoPointSource) -> None
__init__(self: shyft.hydrology.GeoPointSource, midpoint: shyft.time_series.GeoPoint, ts: shyft.time_series.TimeSeries) -> None
__init__(self: shyft.hydrology.GeoPointSource, midpoint: shyft.time_series.GeoPoint, ts: shyft.time_series.TimeSeries, uid: str) -> None
__init__(self: shyft.hydrology.GeoPointSource, midpoint: shyft.time_series.GeoPoint, ts: shyft.time_series.TimeSeries, uid: str, area: typing.SupportsFloat | typing.SupportsIndex) -> None
__init__(self: shyft.hydrology.GeoPointSource, geo_ts: shyft.time_series.GeoTimeSeries) -> None
Construct from a GeoTimeSeries
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.GeoPointSource) -> None
__init__(self: shyft.hydrology.GeoPointSource, midpoint: shyft.time_series.GeoPoint, ts: shyft.time_series.TimeSeries) -> None
__init__(self: shyft.hydrology.GeoPointSource, midpoint: shyft.time_series.GeoPoint, ts: shyft.time_series.TimeSeries, uid: str) -> None
__init__(self: shyft.hydrology.GeoPointSource, midpoint: shyft.time_series.GeoPoint, ts: shyft.time_series.TimeSeries, uid: str, area: typing.SupportsFloat | typing.SupportsIndex) -> None
__init__(self: shyft.hydrology.GeoPointSource, geo_ts: shyft.time_series.GeoTimeSeries) -> None
Construct from a GeoTimeSeries
- property area¶
area of cell [m^2]
- Type:
float
- property geo_ts¶
returns a GeoTimeSeries where the geo-point are copied, but time-series are by-reference
- Type:
- mid_point(self: shyft.hydrology.GeoPointSource) shyft.time_series.GeoPoint¶
returns a copy of mid_point
- property mid_point_¶
reference to internal mid_point
- property ts¶
time-series
- Type:
- property uid¶
user specified identifier, string
- Type:
str
- vector_t¶
alias of
GeoPointSourceVector
- class shyft.hydrology.GeoPointSourceVector(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.GeoPointSourceVector) -> None
__init__(self: shyft.hydrology.GeoPointSourceVector, arg0: shyft.hydrology.GeoPointSourceVector) -> None
Copy constructor
__init__(self: shyft.hydrology.GeoPointSourceVector, arg0: collections.abc.Iterable) -> None
__init__(self: shyft.hydrology.GeoPointSourceVector, geo_ts_vector: shyft.time_series.GeoTimeSeriesVector) -> None
Construct from a GeoTimeSeriesVector, Reference to the shyft.time_series.GeoTsMatrix.extract_geo_ts_vector() to see how to create one from the dtss/geo extensions
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.GeoPointSourceVector) -> None
__init__(self: shyft.hydrology.GeoPointSourceVector, arg0: shyft.hydrology.GeoPointSourceVector) -> None
Copy constructor
__init__(self: shyft.hydrology.GeoPointSourceVector, arg0: collections.abc.Iterable) -> None
__init__(self: shyft.hydrology.GeoPointSourceVector, geo_ts_vector: shyft.time_series.GeoTimeSeriesVector) -> None
Construct from a GeoTimeSeriesVector, Reference to the shyft.time_series.GeoTsMatrix.extract_geo_ts_vector() to see how to create one from the dtss/geo extensions
- append(self: shyft.hydrology.GeoPointSourceVector, x: shyft.hydrology.GeoPointSource) None¶
Add an item to the end of the list
- clear(self: shyft.hydrology.GeoPointSourceVector) None¶
Clear the contents
- extend(*args, **kwargs)¶
Overloaded function.
extend(self: shyft.hydrology.GeoPointSourceVector, L: shyft.hydrology.GeoPointSourceVector) -> None
Extend the list by appending all the items in the given list
extend(self: shyft.hydrology.GeoPointSourceVector, L: collections.abc.Iterable) -> None
Extend the list by appending all the items in the given list
- static from_geo_and_ts_vector(geo_points: shyft.time_series.GeoPointVector, tsv: shyft.time_series.TsVector) shyft.hydrology.GeoPointSourceVector¶
Create from a geo_points and corresponding ts-vectors
- Parameters:
geo_points (GeoPointVector) – the geo-points
- Returns:
src_vector. a newly created geo-located vector of specified type
tsv (TsVector): the corresponding time-series located at corresponding geo-point
- Return type:
SourceVector
- property geo_tsvector¶
returns a GeoTimeSeriesVector containing GeoTimeSeries where the geo-points are copied, but time-series are by-reference
- Type:
- insert(self: shyft.hydrology.GeoPointSourceVector, i: SupportsInt | SupportsIndex, x: shyft.hydrology.GeoPointSource) None¶
Insert an item at a given position.
- pop(*args, **kwargs)¶
Overloaded function.
pop(self: shyft.hydrology.GeoPointSourceVector) -> shyft.hydrology.GeoPointSource
Remove and return the last item
pop(self: shyft.hydrology.GeoPointSourceVector, i: typing.SupportsInt | typing.SupportsIndex) -> shyft.hydrology.GeoPointSource
Remove and return the item at index
i
- size(self: shyft.hydrology.GeoPointSourceVector) int¶
- values_at_time(*args, **kwargs)¶
Overloaded function.
values_at_time(self: shyft.hydrology.GeoPointSourceVector, arg0: shyft.time_series.time) -> list[float]
values_at_time(self: shyft.hydrology.GeoPointSourceVector, arg0: shyft.time_series.time) -> list[float]
- class shyft.hydrology.GlacierMeltParameter(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.GlacierMeltParameter) -> None
__init__(self: shyft.hydrology.GlacierMeltParameter, dtf: typing.SupportsFloat | typing.SupportsIndex, direct_response: typing.SupportsFloat | typing.SupportsIndex = 0.0) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.GlacierMeltParameter) -> None
__init__(self: shyft.hydrology.GlacierMeltParameter, dtf: typing.SupportsFloat | typing.SupportsIndex, direct_response: typing.SupportsFloat | typing.SupportsIndex = 0.0) -> None
- property direct_response¶
fraction that goes as direct response, (1-fraction) is routed through soil/kirchner routine,default=0.0
- Type:
float
- property dtf¶
degree timestep factor, default=6.0 [mm/day/degC]
- Type:
float
- class shyft.hydrology.GoalFunctionClient(self: shyft.hydrology.GoalFunctionClient, host_port: str, timeout_ms: SupportsInt | SupportsIndex, operation_timeout_ms: SupportsInt | SupportsIndex = 0)¶
Bases:
pybind11_objectThe client api for the shyft.hydrology goal-function model service.
Creates a python client that can communicate with the corresponding server
- __init__(self: shyft.hydrology.GoalFunctionClient, host_port: str, timeout_ms: SupportsInt | SupportsIndex, operation_timeout_ms: SupportsInt | SupportsIndex = 0) None¶
Creates a python client that can communicate with the corresponding server
- close(self: shyft.hydrology.GoalFunctionClient) None¶
Close the connection. It will automatically reopen if needed.
- get_model_infos(self: shyft.hydrology.GoalFunctionClient, mids: collections.abc.Sequence[SupportsInt | SupportsIndex], created_in: shyft.time_series.UtcPeriod = UtcPeriod()) list[shyft.time_series.ModelInfo]¶
returns all or selected model-info objects based on model-identifiers(mids)
- Parameters:
mids (IntVector) – empty = all, or a list of known exisiting model-identifiers
created_in (UtcPeriod) – For which period you are interested in model-infos.
- Returns:
model_infos. Strongly typed list of ModelInfo
- Return type:
ModelInfoVector
- property host_port¶
Endpoint network address of the remote server.
- Type:
str
- property is_open¶
If the connection to the remote server is (still) open.
- Type:
bool
- property operation_timeout_ms¶
Operation timeout for remote server operations, in number milliseconds.
- Type:
int
- read_model(self: shyft.hydrology.GoalFunctionClient, mid: SupportsInt | SupportsIndex) shyft.hydrology.GoalFunctionModel¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting model from the server
- Return type:
- read_models(self: shyft.hydrology.GoalFunctionClient, mids: collections.abc.Sequence[SupportsInt | SupportsIndex]) list[shyft.hydrology.GoalFunctionModel]¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mids (list[int]) – A strongly typed list of ints, the model-identifers for the wanted models
- Returns:
The resulting model from the server
- Return type:
- property reconnect_count¶
Number of reconnects to the remote server that have been performed.
- Type:
int
- remove_model(self: shyft.hydrology.GoalFunctionClient, mid: SupportsInt | SupportsIndex) int¶
Remove the specified model bymodel-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
ec. 0 or error-code?
- Return type:
int
- store_model(self: shyft.hydrology.GoalFunctionClient, m: shyft.hydrology.GoalFunctionModel, mi: shyft.time_series.ModelInfo) int¶
Store the model to backend, if m.id==0 then a new unique model-info is created and used
- property timeout_ms¶
Timout for remote server operations, in number milliseconds.
- Type:
int
- update_model_info(self: shyft.hydrology.GoalFunctionClient, mid: SupportsInt | SupportsIndex, mi: shyft.time_series.ModelInfo) bool¶
Update the model-info for specified model-identifier(mid)
- Parameters:
mid (int) – model-identifer
mi (ModelInfo) – The new updated model-info
- Returns:
ok. true if success
- Return type:
bool
- class shyft.hydrology.GoalFunctionModel(self: shyft.hydrology.GoalFunctionModel)¶
Bases:
pybind11_objectA model identifier and goal-funcions, aka TargetSpecificationVector used in Shyft region model calibrations. This plays the role of the goal-function specification for shyft region-models, so that they can be calibrated, and measured against observed quantities.
- __init__(self: shyft.hydrology.GoalFunctionModel) None¶
- property goal_functions¶
The goal functions
- property id¶
unique model id
- Type:
int
- class shyft.hydrology.GoalFunctionModelVector(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.GoalFunctionModelVector) -> None
__init__(self: shyft.hydrology.GoalFunctionModelVector, arg0: collections.abc.Sequence[shyft.hydrology.GoalFunctionModel]) -> None
Copy constructor
__init__(self: shyft.hydrology.GoalFunctionModelVector, arg0: collections.abc.Iterable) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.GoalFunctionModelVector) -> None
__init__(self: shyft.hydrology.GoalFunctionModelVector, arg0: collections.abc.Sequence[shyft.hydrology.GoalFunctionModel]) -> None
Copy constructor
__init__(self: shyft.hydrology.GoalFunctionModelVector, arg0: collections.abc.Iterable) -> None
- append(self: collections.abc.Sequence[shyft.hydrology.GoalFunctionModel], x: shyft.hydrology.GoalFunctionModel) None¶
Add an item to the end of the list
- clear(self: collections.abc.Sequence[shyft.hydrology.GoalFunctionModel]) None¶
Clear the contents
- extend(*args, **kwargs)¶
Overloaded function.
extend(self: collections.abc.Sequence[shyft.hydrology.GoalFunctionModel], L: collections.abc.Sequence[shyft.hydrology.GoalFunctionModel]) -> None
Extend the list by appending all the items in the given list
extend(self: collections.abc.Sequence[shyft.hydrology.GoalFunctionModel], L: collections.abc.Iterable) -> None
Extend the list by appending all the items in the given list
- insert(self: collections.abc.Sequence[shyft.hydrology.GoalFunctionModel], i: SupportsInt | SupportsIndex, x: shyft.hydrology.GoalFunctionModel) None¶
Insert an item at a given position.
- pop(*args, **kwargs)¶
Overloaded function.
pop(self: collections.abc.Sequence[shyft.hydrology.GoalFunctionModel]) -> shyft.hydrology.GoalFunctionModel
Remove and return the last item
pop(self: collections.abc.Sequence[shyft.hydrology.GoalFunctionModel], i: typing.SupportsInt | typing.SupportsIndex) -> shyft.hydrology.GoalFunctionModel
Remove and return the item at index
i
- size(self: collections.abc.Sequence[shyft.hydrology.GoalFunctionModel]) int¶
- class shyft.hydrology.GoalFunctionServer(self: shyft.hydrology.GoalFunctionServer, root_dir: str, config: shyft.time_series.ServerConfig = shyft.time_series.ServerConfig(stale_duration='1970-01-01T01:00:00Z', stale_sweep_interval='1970-01-01T00:00:00.100000Z', log=shyft.time_series.LogConfig(file='', level=200)))¶
Bases:
pybind11_objectThe server-side component for the goal-function model repository.
Creates a server object that serves models from root_dir. The root_dir will be create if it does not exists.
- Parameters:
root_dir (str) – Path to the root-directory that keeps/will keep the model-files
config (ServerConfig) – Configuration of the server
- __init__(self: shyft.hydrology.GoalFunctionServer, root_dir: str, config: shyft.time_series.ServerConfig = shyft.time_series.ServerConfig(stale_duration='1970-01-01T01:00:00Z', stale_sweep_interval='1970-01-01T00:00:00.100000Z', log=shyft.time_series.LogConfig(file='', level=200))) None¶
Creates a server object that serves models from root_dir. The root_dir will be create if it does not exists.
- Parameters:
root_dir (str) – Path to the root-directory that keeps/will keep the model-files
config (ServerConfig) – Configuration of the server
- get_listening_port(self: shyft.hydrology.GoalFunctionServer) int¶
returns the port number it’s listening at for serving incoming request
- get_max_connections(self: shyft.hydrology.GoalFunctionServer) int¶
returns the maximum number of connections to be served concurrently
- get_model_infos(self: shyft.hydrology.GoalFunctionServer, mids: collections.abc.Sequence[SupportsInt | SupportsIndex], created_in: shyft.time_series.UtcPeriod = UtcPeriod()) list[shyft.time_series.ModelInfo]¶
returns all or selected model-info objects based on model-identifiers(mids)
- Parameters:
mids (IntVector) – empty = all, or a list of known exisiting model-identifiers
created_in (UtcPeriod) – For which period you are interested in model-infos.
- Returns:
model_infos. Strongly typed list of ModelInfo
- Return type:
ModelInfoVector
- is_running(self: shyft.hydrology.GoalFunctionServer) bool¶
true if server is listening and running
See also
start_server()
- read_model(self: shyft.hydrology.GoalFunctionServer, mid: SupportsInt | SupportsIndex) shyft.hydrology.GoalFunctionModel¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting model from the server
- Return type:
- read_model_blob(self: shyft.hydrology.GoalFunctionServer, mid: SupportsInt | SupportsIndex) shyft.time_series.ByteVector¶
Read and return the model blob for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting blob model from the server
- Return type:
ByteVector
- read_models(self: shyft.hydrology.GoalFunctionServer, mids: collections.abc.Sequence[SupportsInt | SupportsIndex]) list[shyft.hydrology.GoalFunctionModel]¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mids (list[int]) – A strongly typed list of ints, the model-identifers for the wanted models
- Returns:
The resulting model from the server
- Return type:
- remove_model(self: shyft.hydrology.GoalFunctionServer, mid: SupportsInt | SupportsIndex) int¶
Remove the specified model bymodel-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
ec. 0 or error-code?
- Return type:
int
- set_listening_ip(self: shyft.hydrology.GoalFunctionServer, ip: str) None¶
set the listening port for the service
- Parameters:
ip (str) – ip or host-name to start listening on
- Returns:
nothing.
- Return type:
None
- set_listening_port(self: shyft.hydrology.GoalFunctionServer, port_no: SupportsInt | SupportsIndex) None¶
set the listening port for the service
- Parameters:
port_no (int) – a valid and available tcp-ip port number to listen on.
20000 (typically it could be)
- Returns:
nothing.
- Return type:
None
- set_max_connections(self: shyft.hydrology.GoalFunctionServer, max_connect: SupportsInt | SupportsIndex) None¶
limits simultaneous connections to the server (it’s multithreaded, and uses on thread pr. connect)
- Parameters:
max_connect (int) – maximum number of connections before denying more connections
See also
get_max_connections()
- property stale_connection_close_count¶
returns count of connection closed due to stale/no communication activity
- Type:
int
- start_server(self: shyft.hydrology.GoalFunctionServer) int¶
start server listening in background, and processing messages
See also
set_listening_port(port_no),is_running
- Returns:
port_no. the port used for listening operations, either the value as by set_listening_port, or if it was unspecified, a new available port
- Return type:
in
- stop_server(self: shyft.hydrology.GoalFunctionServer, timeout: SupportsInt | SupportsIndex = 1000) None¶
stop serving connections, gracefully.
See also
start_server()
- store_model(self: shyft.hydrology.GoalFunctionServer, m: shyft.hydrology.GoalFunctionModel, mi: shyft.time_series.ModelInfo) int¶
Store the model to backend, if m.id==0 then a new unique model-info is created and used
- update_model_info(self: shyft.hydrology.GoalFunctionServer, mid: SupportsInt | SupportsIndex, mi: shyft.time_series.ModelInfo) bool¶
Update the model-info for specified model-identifier(mid)
- Parameters:
mid (int) – model-identifer
mi (ModelInfo) – The new updated model-info
- Returns:
ok. true if success
- Return type:
bool
- shyft.hydrology.HbvActualEvapotranspirationCalculate_step(soil_moisture: SupportsFloat | SupportsIndex, potential_evapotranspiration: SupportsFloat | SupportsIndex, lp: SupportsFloat | SupportsIndex, snow_fraction: SupportsFloat | SupportsIndex, dt: shyft.time_series.time) float¶
actual_evapotranspiration calculates actual evapotranspiration, returning same unit as input pot.evap based on supplied parameters, formula like (1.0 - snow_fraction)*(soil_moisture < lp ? pot_evapo*(soil_moisture / lp):pot_evapo)
- Parameters:
() (dt) – [mm] water level eqvivalent in ground, ae goes to zero if ground is drying out
() – [mm/x], x time-unit
() – [mm] soil_moisture threshold, lp typically 150
() – 0..1 there is to ae over snow surface, so snow_fraction 1.0, yields 0.0
() – [s] timestep length, currently not part of the formula
- Returns:
actual evapotranspiration.
- class shyft.hydrology.HbvActualEvapotranspirationParameter(self: shyft.hydrology.HbvActualEvapotranspirationParameter, lp: SupportsFloat | SupportsIndex = 150.0)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.HbvActualEvapotranspirationParameter, lp: SupportsFloat | SupportsIndex = 150.0) None¶
- property lp¶
typical value 150
- Type:
float
- class shyft.hydrology.HbvActualEvapotranspirationResponse(self: shyft.hydrology.HbvActualEvapotranspirationResponse)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.HbvActualEvapotranspirationResponse) None¶
- property ae¶
ae value
- Type:
float
- class shyft.hydrology.HbvPhysicalSnowCalculator(self: shyft.hydrology.HbvPhysicalSnowCalculator, parameter: shyft.hydrology.HbvPhysicalSnowParameter)¶
Bases:
pybind11_objectGeneralized quantile based HBV Physical Snow model method
This algorithm uses arbitrary quartiles to model snow. No checks are performed to assert valid input. The starting points of the quantiles have to partition the unity, include the end points 0 and 1 and must be given in ascending order.
creates a calculator with given parameter and initial state, notice that state is updated in this call(hmm)
- __init__(self: shyft.hydrology.HbvPhysicalSnowCalculator, parameter: shyft.hydrology.HbvPhysicalSnowParameter) None¶
creates a calculator with given parameter and initial state, notice that state is updated in this call(hmm)
- step(self: shyft.hydrology.HbvPhysicalSnowCalculator, state: shyft.hydrology.HbvPhysicalSnowState, response: shyft.hydrology.HbvPhysicalSnowResponse, t: shyft.time_series.time, dt: shyft.time_series.time, temperature: SupportsFloat | SupportsIndex, rad: SupportsFloat | SupportsIndex, prec_mm_h: SupportsFloat | SupportsIndex, wind_speed: SupportsFloat | SupportsIndex, rel_hum: SupportsFloat | SupportsIndex) None¶
steps the model forward from t to t+dt, updating state and response
- class shyft.hydrology.HbvPhysicalSnowParameter(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.HbvPhysicalSnowParameter, tx: typing.SupportsFloat | typing.SupportsIndex = 0.0, lw: typing.SupportsFloat | typing.SupportsIndex = 0.1, cfr: typing.SupportsFloat | typing.SupportsIndex = 0.5, wind_scale: typing.SupportsFloat | typing.SupportsIndex = 2.0, wind_const: typing.SupportsFloat | typing.SupportsIndex = 1.0, surface_magnitude: typing.SupportsFloat | typing.SupportsIndex = 30.0, max_albedo: typing.SupportsFloat | typing.SupportsIndex = 0.9, min_albedo: typing.SupportsFloat | typing.SupportsIndex = 0.6, fast_albedo_decay_rate: typing.SupportsFloat | typing.SupportsIndex = 5.0, slow_albedo_decay_rate: typing.SupportsFloat | typing.SupportsIndex = 5.0, snowfall_reset_depth: typing.SupportsFloat | typing.SupportsIndex = 5.0, calculate_iso_pot_energy: bool = False) -> None
__init__(self: shyft.hydrology.HbvPhysicalSnowParameter, snow_redist_factors: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], quantiles: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], tx: typing.SupportsFloat | typing.SupportsIndex = 0.0, lw: typing.SupportsFloat | typing.SupportsIndex = 0.1, cfr: typing.SupportsFloat | typing.SupportsIndex = 0.5, wind_scale: typing.SupportsFloat | typing.SupportsIndex = 2.0, wind_const: typing.SupportsFloat | typing.SupportsIndex = 1.0, surface_magnitude: typing.SupportsFloat | typing.SupportsIndex = 30.0, max_albedo: typing.SupportsFloat | typing.SupportsIndex = 0.9, min_albedo: typing.SupportsFloat | typing.SupportsIndex = 0.6, fast_albedo_decay_rate: typing.SupportsFloat | typing.SupportsIndex = 5.0, slow_albedo_decay_rate: typing.SupportsFloat | typing.SupportsIndex = 5.0, snowfall_reset_depth: typing.SupportsFloat | typing.SupportsIndex = 5.0, calculate_iso_pot_energy: bool = False) -> None
create a parameter with snow re-distribution factors, quartiles and optionally the other parameters
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.HbvPhysicalSnowParameter, tx: typing.SupportsFloat | typing.SupportsIndex = 0.0, lw: typing.SupportsFloat | typing.SupportsIndex = 0.1, cfr: typing.SupportsFloat | typing.SupportsIndex = 0.5, wind_scale: typing.SupportsFloat | typing.SupportsIndex = 2.0, wind_const: typing.SupportsFloat | typing.SupportsIndex = 1.0, surface_magnitude: typing.SupportsFloat | typing.SupportsIndex = 30.0, max_albedo: typing.SupportsFloat | typing.SupportsIndex = 0.9, min_albedo: typing.SupportsFloat | typing.SupportsIndex = 0.6, fast_albedo_decay_rate: typing.SupportsFloat | typing.SupportsIndex = 5.0, slow_albedo_decay_rate: typing.SupportsFloat | typing.SupportsIndex = 5.0, snowfall_reset_depth: typing.SupportsFloat | typing.SupportsIndex = 5.0, calculate_iso_pot_energy: bool = False) -> None
__init__(self: shyft.hydrology.HbvPhysicalSnowParameter, snow_redist_factors: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], quantiles: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], tx: typing.SupportsFloat | typing.SupportsIndex = 0.0, lw: typing.SupportsFloat | typing.SupportsIndex = 0.1, cfr: typing.SupportsFloat | typing.SupportsIndex = 0.5, wind_scale: typing.SupportsFloat | typing.SupportsIndex = 2.0, wind_const: typing.SupportsFloat | typing.SupportsIndex = 1.0, surface_magnitude: typing.SupportsFloat | typing.SupportsIndex = 30.0, max_albedo: typing.SupportsFloat | typing.SupportsIndex = 0.9, min_albedo: typing.SupportsFloat | typing.SupportsIndex = 0.6, fast_albedo_decay_rate: typing.SupportsFloat | typing.SupportsIndex = 5.0, slow_albedo_decay_rate: typing.SupportsFloat | typing.SupportsIndex = 5.0, snowfall_reset_depth: typing.SupportsFloat | typing.SupportsIndex = 5.0, calculate_iso_pot_energy: bool = False) -> None
create a parameter with snow re-distribution factors, quartiles and optionally the other parameters
- property calculate_iso_pot_energy¶
whether or not to calculate the potential energy flux
- Type:
float
- property cfr¶
cfr
- Type:
float
- property fast_albedo_decay_rate¶
albedo decay rate during melt [days]
- Type:
float
- property intervals¶
snow quantiles list default 0, 0.25 0.5 1.0
- Type:
DoubleVector
- property lw¶
max liquid water content of the snow
- Type:
float
- property max_albedo¶
maximum albedo value
- Type:
float
- property min_albedo¶
minimum albedo value
- Type:
float
- property s¶
snow redistribution factors,default =1.0..
- Type:
DoubleVector
- set_snow_quantiles(self: shyft.hydrology.HbvPhysicalSnowParameter, quantiles: collections.abc.Sequence[SupportsFloat | SupportsIndex]) None¶
- set_snow_redistribution_factors(self: shyft.hydrology.HbvPhysicalSnowParameter, snow_redist_factors: collections.abc.Sequence[SupportsFloat | SupportsIndex]) None¶
- property slow_albedo_decay_rate¶
albedo decay rate in cold conditions [days]
- Type:
float
- property snowfall_reset_depth¶
snowfall required to reset albedo [mm]
- Type:
float
- property surface_magnitude¶
surface layer magnitude
- Type:
float
- property tx¶
threshold temperature determining if precipitation is rain or snow
- Type:
float
- property wind_const¶
intercept in turbulent wind function
- Type:
float
- property wind_scale¶
slope in turbulent wind function [m/s]
- Type:
float
- class shyft.hydrology.HbvPhysicalSnowResponse(self: shyft.hydrology.HbvPhysicalSnowResponse)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.HbvPhysicalSnowResponse) None¶
- property hps_state¶
current state instance
- Type:
- property outflow¶
from snow-routine in [mm]
- Type:
float
- property sca¶
snow-covered area
- Type:
float
- property storage¶
snow storage [mm]
- Type:
float
- class shyft.hydrology.HbvPhysicalSnowState(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.HbvPhysicalSnowState) -> None
__init__(self: shyft.hydrology.HbvPhysicalSnowState, albedo: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], iso_pot_energy: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], surface_heat: typing.SupportsFloat | typing.SupportsIndex = 30000.0, swe: typing.SupportsFloat | typing.SupportsIndex = 0.0, sca: typing.SupportsFloat | typing.SupportsIndex = 0.0) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.HbvPhysicalSnowState) -> None
__init__(self: shyft.hydrology.HbvPhysicalSnowState, albedo: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], iso_pot_energy: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], surface_heat: typing.SupportsFloat | typing.SupportsIndex = 30000.0, swe: typing.SupportsFloat | typing.SupportsIndex = 0.0, sca: typing.SupportsFloat | typing.SupportsIndex = 0.0) -> None
- property albedo¶
albedo (Broadband snow reflectivity fraction)
- Type:
float
- distribute(self: shyft.hydrology.HbvPhysicalSnowState, p: shyft.hydrology.HbvPhysicalSnowParameter, force: bool = True) None¶
Distribute state according to parameter settings.
- Parameters:
p (HbvPhysicalSnowParameter) – descr
force (bool) – default true, if false then only distribute if state vectors are of different size than parameters passed
- Returns:
.
- Return type:
None
- property iso_pot_energy¶
iso_pot_energy (Accumulated energy assuming isothermal snow surface) [J/m2]
- Type:
float
- property sca¶
snow covered area [0..1]
- Type:
float
- property sp¶
snow dry[mm]
- Type:
DoubleVector
- property surface_heat¶
surface_heat (Snow surface cold content) [J/m2]
- Type:
float
- property sw¶
snow water[mm]
- Type:
DoubleVector
- property swe¶
snow water equivalent[mm]
- Type:
float
- class shyft.hydrology.HbvSnowCalculator(self: shyft.hydrology.HbvSnowCalculator, parameter: shyft.hydrology.HbvSnowParameter)¶
Bases:
pybind11_objectGeneralized quantile based HBV Snow model method
This algorithm uses arbitrary quartiles to model snow. No checks are performed to assert valid input. The starting points of the quantiles have to partition the unity, include the end points 0 and 1 and must be given in ascending order.
- __init__(self: shyft.hydrology.HbvSnowCalculator, parameter: shyft.hydrology.HbvSnowParameter) None¶
- step(self: shyft.hydrology.HbvSnowCalculator, state: shyft.hydrology.HbvSnowState, response: shyft.hydrology.HbvSnowResponse, t0: shyft.time_series.time, t1: shyft.time_series.time, precipitation: SupportsFloat | SupportsIndex, temperature: SupportsFloat | SupportsIndex) None¶
steps the model forward from t0 to t1, updating state and response
- class shyft.hydrology.HbvSnowParameter(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.HbvSnowParameter, tx: typing.SupportsFloat | typing.SupportsIndex = 0.0, cx: typing.SupportsFloat | typing.SupportsIndex = 1.0, ts: typing.SupportsFloat | typing.SupportsIndex = 0.0, lw: typing.SupportsFloat | typing.SupportsIndex = 0.1, cfr: typing.SupportsFloat | typing.SupportsIndex = 0.5) -> None
__init__(self: shyft.hydrology.HbvSnowParameter, snow_redist_factors: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], quantiles: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], tx: typing.SupportsFloat | typing.SupportsIndex = 0.0, cx: typing.SupportsFloat | typing.SupportsIndex = 1.0, ts: typing.SupportsFloat | typing.SupportsIndex = 0.0, lw: typing.SupportsFloat | typing.SupportsIndex = 0.1, cfr: typing.SupportsFloat | typing.SupportsIndex = 0.5) -> None
create a parameter with snow re-distribution factors, quartiles and optionally the other parameters
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.HbvSnowParameter, tx: typing.SupportsFloat | typing.SupportsIndex = 0.0, cx: typing.SupportsFloat | typing.SupportsIndex = 1.0, ts: typing.SupportsFloat | typing.SupportsIndex = 0.0, lw: typing.SupportsFloat | typing.SupportsIndex = 0.1, cfr: typing.SupportsFloat | typing.SupportsIndex = 0.5) -> None
__init__(self: shyft.hydrology.HbvSnowParameter, snow_redist_factors: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], quantiles: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], tx: typing.SupportsFloat | typing.SupportsIndex = 0.0, cx: typing.SupportsFloat | typing.SupportsIndex = 1.0, ts: typing.SupportsFloat | typing.SupportsIndex = 0.0, lw: typing.SupportsFloat | typing.SupportsIndex = 0.1, cfr: typing.SupportsFloat | typing.SupportsIndex = 0.5) -> None
create a parameter with snow re-distribution factors, quartiles and optionally the other parameters
- property cfr¶
cfr
- Type:
float
- property cx¶
temperature index, i.e., melt = cx(t - ts) in mm per degree C
- Type:
float
- property intervals¶
snow quantiles list default 0, 0.25 0.5 1.0
- Type:
DoubleVector
- property lw¶
max liquid water content of the snow
- Type:
float
- property s¶
snow redistribution factors,default =1.0..
- Type:
DoubleVector
- set_snow_quantiles(self: shyft.hydrology.HbvSnowParameter, quantiles: collections.abc.Sequence[SupportsFloat | SupportsIndex]) None¶
- set_snow_redistribution_factors(self: shyft.hydrology.HbvSnowParameter, snow_redist_factors: collections.abc.Sequence[SupportsFloat | SupportsIndex]) None¶
- property ts¶
threshold temperature for melt onset
- Type:
float
- property tx¶
threshold temperature determining if precipitation is rain or snow
- Type:
float
- class shyft.hydrology.HbvSnowResponse(self: shyft.hydrology.HbvSnowResponse)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.HbvSnowResponse) None¶
- property outflow¶
from snow-routine in [mm]
- Type:
float
- property snow_state¶
swe and snow covered area
- Type:
- class shyft.hydrology.HbvSnowState(self: shyft.hydrology.HbvSnowState, swe: SupportsFloat | SupportsIndex = 0.0, sca: SupportsFloat | SupportsIndex = 0.0)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.HbvSnowState, swe: SupportsFloat | SupportsIndex = 0.0, sca: SupportsFloat | SupportsIndex = 0.0) None¶
- distribute(self: shyft.hydrology.HbvSnowState, p: shyft.hydrology.HbvSnowParameter, force: bool = True) None¶
Distribute state according to parameter settings.
- Parameters:
p (HbvSnowParameter) – descr
force (bool) – default true, if false then only distribute if state vectors are of different size than parameters passed
- Returns:
.
- Return type:
None
- property sca¶
snow covered area [0..1]
- Type:
float
- property sp¶
snow dry[mm]
- Type:
DoubleVector
- property sw¶
snow water[mm]
- Type:
DoubleVector
- property swe¶
snow water equivalent[mm]
- Type:
float
- class shyft.hydrology.HbvSoilCalculator(self: shyft.hydrology.HbvSoilCalculator, parameter: shyft.hydrology.HbvSoilParameter, land_fraction: SupportsFloat | SupportsIndex)¶
Bases:
pybind11_objectComputing water through the soil moisture zone of the HBV model.
Reference:
Nils Roar Sæhlthun: The Nordic HBV model 1996 https://publikasjoner.nve.no/publication/1996/publication1996_07.pdf
Notes
Lake and glacier are treated in the stack
- __init__(self: shyft.hydrology.HbvSoilCalculator, parameter: shyft.hydrology.HbvSoilParameter, land_fraction: SupportsFloat | SupportsIndex) None¶
- step(self: shyft.hydrology.HbvSoilCalculator, state: shyft.hydrology.HbvSoilState, response: shyft.hydrology.HbvSoilResponse, insoil: SupportsFloat | SupportsIndex, pe: SupportsFloat | SupportsIndex, sca: SupportsFloat | SupportsIndex) None¶
One step of the model, given state, parameters and input.
Updates the state and response.
- Parameters:
state (HbvSoilState) – param of type S, in/out, ref template parameters
response (HbvSoilResponse) – param of type R, in/out, ref template parameters
insoil (float) – inflow to soil
pe (float) – potential evaporation
sca (float) – the response , out parameter.
land_fraction (float) – Land-fraction of the cell. Not directly used/desribed in ref. ‘Nils Roar’, but introduced here to adopt to the stack.
- class shyft.hydrology.HbvSoilParameter(self: shyft.hydrology.HbvSoilParameter, fc: SupportsFloat | SupportsIndex = 32.2755689, beta: SupportsFloat | SupportsIndex = 1.50738409)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.HbvSoilParameter, fc: SupportsFloat | SupportsIndex = 32.2755689, beta: SupportsFloat | SupportsIndex = 1.50738409) None¶
- property beta¶
(unitless) exponent in the nonlinear relationship between soil moisture and field capacity. default=1.50738409
- Type:
float
- property fc¶
maximum water content of the soil (Field Capacity), default=32.2755689
- Type:
float
- property infmax¶
(mm/h) maximum input rate to the soil moisture zone. Excess water will go directly to upper ground water zone. default=2.0
- Type:
float
- property lpdel¶
(unitless) dimensionless parameter (<1), from which level evapotranspiration is potential. Some publications use fcdel instead. default= 0.848557794
- Type:
float
- class shyft.hydrology.HbvSoilResponse(self: shyft.hydrology.HbvSoilResponse, inuz: SupportsFloat | SupportsIndex = 0.0, ae: SupportsFloat | SupportsIndex = 0.0)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.HbvSoilResponse, inuz: SupportsFloat | SupportsIndex = 0.0, ae: SupportsFloat | SupportsIndex = 0.0) None¶
- property ae¶
(mm/h) Actual evapotranspiration. default=0
- Type:
float
- property inuz¶
(mm/h) Perculation to upper ground water zone. Called cuz by Nils Roar. default=0
- Type:
float
- class shyft.hydrology.HbvSoilState(self: shyft.hydrology.HbvSoilState, sm: SupportsFloat | SupportsIndex = 10.0)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.HbvSoilState, sm: SupportsFloat | SupportsIndex = 10.0) None¶
- property sm¶
Soil moisture [mm]. default=10
- Type:
float
- class shyft.hydrology.HbvTankCalculator(self: shyft.hydrology.HbvTankCalculator, parameter: shyft.hydrology.HbvTankParameter, lake_fraction: SupportsFloat | SupportsIndex)¶
Bases:
pybind11_objectComputing water through the HBV ground water zone of the HBV model.
Reference:
Nils Roar Sæhlthun: The Nordic HBV model 1996 https://publikasjoner.nve.no/publication/1996/publication1996_07.pdf
Notes
Lake and glacier are treated in the stack
creates a calculator with given parameters
- __init__(self: shyft.hydrology.HbvTankCalculator, parameter: shyft.hydrology.HbvTankParameter, lake_fraction: SupportsFloat | SupportsIndex) None¶
creates a calculator with given parameters
- step(self: shyft.hydrology.HbvTankCalculator, state: shyft.hydrology.HbvTankState, response: shyft.hydrology.HbvTankResponse, from_soil: SupportsFloat | SupportsIndex, precip: SupportsFloat | SupportsIndex, t2m: SupportsFloat | SupportsIndex) None¶
One step of the model, given state, parameters and input.
Updates the state and response.
- Parameters:
state (HbvSoilState) – param of type S, in/out, ref template parameters
response (HbvSoilResponse) – param of type R, in/out, ref template parameters
from_soil (float) – [mm/step] Inflow to upper zone (from soil moisture)
precip (float) – [mm/step] Routed precipitation. Assumed that it is corrected for lake fraction already.
t2m (float) – [deg C] Air-temperature at 2m (proxy for water temperature)
lake_fraction (float) – [unitless] Lake-fraction of the cell. Not directly used/desribed in ref.’Nils Roar’, but introduced here to adopt to the stack.
- class shyft.hydrology.HbvTankParameter(self: shyft.hydrology.HbvTankParameter, uz1: SupportsFloat | SupportsIndex = 10.0, uz2: SupportsFloat | SupportsIndex = 50.0, kuz0: SupportsFloat | SupportsIndex = 0.05, kuz1: SupportsFloat | SupportsIndex = 0.1, kuz2: SupportsFloat | SupportsIndex = 0.0, perc: SupportsFloat | SupportsIndex = 0.6, klz: SupportsFloat | SupportsIndex = 0.05, ce: SupportsFloat | SupportsIndex = 0.007083333333333334, cevpl: SupportsFloat | SupportsIndex = 1.1)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.HbvTankParameter, uz1: SupportsFloat | SupportsIndex = 10.0, uz2: SupportsFloat | SupportsIndex = 50.0, kuz0: SupportsFloat | SupportsIndex = 0.05, kuz1: SupportsFloat | SupportsIndex = 0.1, kuz2: SupportsFloat | SupportsIndex = 0.0, perc: SupportsFloat | SupportsIndex = 0.6, klz: SupportsFloat | SupportsIndex = 0.05, ce: SupportsFloat | SupportsIndex = 0.007083333333333334, cevpl: SupportsFloat | SupportsIndex = 1.1) None¶
- property ce¶
[ mm/deg/day ] Evapotranspiration constant (degree-day-factor). default=0.17/24
- Type:
float
- property cevpl¶
[ unitless ], adjustment factor for potential evapotranspiration on lakes. default=1.1
- Type:
float
- property klz¶
[ 1/step ] Slow response coefficient lower ground water zone. default=0.05
- Type:
float
- property kuz0¶
[ 1/step ] Slow response coefficient upper ground water zone. default=0.05
- Type:
float
- property kuz1¶
[ 1/step ] Mid response coefficient upper ground water zone. default=0.1
- Type:
float
- property kuz2¶
[ 1/step ] Fast response coefficient upper ground water zone. default=0 (not active)
- Type:
float
- property perc¶
[ mm/step ] Perculation to lower ground water zone. default=0.6
- Type:
float
- property uz1¶
[ mm ] Mid-threshold for upper ground water zone. default=10
- Type:
float
- property uz2¶
[ mm ] High-threshold for upper ground water zone. default=50
- Type:
float
- class shyft.hydrology.HbvTankResponse(self: shyft.hydrology.HbvTankResponse, quz0: SupportsFloat | SupportsIndex = 0.0, quz1: SupportsFloat | SupportsIndex = 0.0, quz2: SupportsFloat | SupportsIndex = 0.0, qlz: SupportsFloat | SupportsIndex = 0.0, elake: SupportsFloat | SupportsIndex = 0.0, perculation: SupportsFloat | SupportsIndex = 0.0)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.HbvTankResponse, quz0: SupportsFloat | SupportsIndex = 0.0, quz1: SupportsFloat | SupportsIndex = 0.0, quz2: SupportsFloat | SupportsIndex = 0.0, qlz: SupportsFloat | SupportsIndex = 0.0, elake: SupportsFloat | SupportsIndex = 0.0, perculation: SupportsFloat | SupportsIndex = 0.0) None¶
- property elake¶
[ mm/step ] Evaporation from lake
- Type:
float
- property perculation¶
[ mm/step ] Effective perculation from upper to lower
- Type:
float
- property q¶
[mm/step] Total discharge from tank
- Type:
float
- property qlz¶
[mm/step] Total for lower zone
- Type:
float
- property quz¶
[mm/step] Total for upper zone
- Type:
float
- property quz0¶
[mm/step] Upper zone slow response
- Type:
float
- property quz1¶
[mm/step] Upper zone mid response
- Type:
float
- property quz2¶
[mm/step] Upper zone fast response
- Type:
float
- class shyft.hydrology.HbvTankState(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.HbvTankState) -> None
__init__(self: shyft.hydrology.HbvTankState, uz: typing.SupportsFloat | typing.SupportsIndex = 10, lz: typing.SupportsFloat | typing.SupportsIndex = 10) -> None
create a state with specified values
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.HbvTankState) -> None
__init__(self: shyft.hydrology.HbvTankState, uz: typing.SupportsFloat | typing.SupportsIndex = 10, lz: typing.SupportsFloat | typing.SupportsIndex = 10) -> None
create a state with specified values
- property lz¶
Lower ground water zone content [mm]
- Type:
float
- property uz¶
Upper ground water zone content [mm]
- Type:
float
- class shyft.hydrology.IDWParameter(self: shyft.hydrology.IDWParameter, max_members: SupportsInt | SupportsIndex = 10, max_distance: SupportsFloat | SupportsIndex = 200000.0, distance_measure_factor: SupportsFloat | SupportsIndex = 2.0)¶
Bases:
pybind11_objectIDWParameter is a simple place-holder for IDW parameters used during interpolation process. The two most common is max_distance and max_members. Additionally it keep distance measure-factor, so that the IDW distance is computed as 1 over pow(euclid distance,distance_measure_factor). zscale is used to discriminate neighbors that are at different elevation than target point.
- __init__(self: shyft.hydrology.IDWParameter, max_members: SupportsInt | SupportsIndex = 10, max_distance: SupportsFloat | SupportsIndex = 200000.0, distance_measure_factor: SupportsFloat | SupportsIndex = 2.0) None¶
- property distance_measure_factor¶
IDW distance is computed as 1 over pow(euclid distance,distance_measure_factor), default=2.0
- Type:
float
- property max_distance¶
[meter] only neighbours within max distance is used for each destination-cell,default= 200000.0
- Type:
float
- property max_members¶
maximum members,neighbors used to interpolate into a point,default=10
- Type:
int
- property zscale¶
Use to weight neighbors having same elevation, default=1.0
- Type:
float
- class shyft.hydrology.IDWPrecipitationParameter(self: shyft.hydrology.IDWPrecipitationParameter, scale_factor: SupportsFloat | SupportsIndex = 1.02, max_members: SupportsInt | SupportsIndex = 20, max_distance: SupportsFloat | SupportsIndex = 200000.0)¶
Bases:
IDWParameterFor precipitation,the scaling model needs the scale_factor. adjusted_precipitation = precipitation* (scale_factor)^(z-distance-in-meters/100.0) Ref to IDWParameter for the other parameters
- __init__(self: shyft.hydrology.IDWPrecipitationParameter, scale_factor: SupportsFloat | SupportsIndex = 1.02, max_members: SupportsInt | SupportsIndex = 20, max_distance: SupportsFloat | SupportsIndex = 200000.0) None¶
- property scale_factor¶
ref. formula for adjusted_precipitation, default=1.02
- Type:
float
- class shyft.hydrology.IDWTemperatureParameter(self: shyft.hydrology.IDWTemperatureParameter, default_gradient: SupportsFloat | SupportsIndex = -0.006, max_members: SupportsInt | SupportsIndex = 20, max_distance: SupportsFloat | SupportsIndex = 200000.0, gradient_by_equation: bool = False, minimum_z_distance: SupportsFloat | SupportsIndex = 50, gradient_min: SupportsFloat | SupportsIndex = -0.01, gradient_max: SupportsFloat | SupportsIndex = 0.01)¶
Bases:
IDWParameterFor temperature inverse distance, also provide default temperature gradient to be used when the gradient can not be computed, or is outside specified limits. if gradient_by_equation is set true, and number of points >3, the temperature gradient computer will try to use the 4 closest points and determine the 3d gradient including the vertical gradient. In scenarios with constant gradients(vertical/horizontal), this is accurate) If the number of valide nearby points is to few to do the full gradient equation, or the gradient_by_equation is set to False, then the two points with maximum vertical distance (required to be more than the minimum_z_distance) is used to compute the gradient. If all of the above fails, the default-gradient is used. Please note: Carefully selecting the maximum horizontal distances, and number of neighbors is required to get optimal results. In case of non-grid, or sparse-grid scenarios, you might consider setting the parameters to enforce default-gradient or you can also consider using the bayesian temperature krieging algorithm if there are few temperature sources
construct IDW for temperature as specified by arguments
- __init__(self: shyft.hydrology.IDWTemperatureParameter, default_gradient: SupportsFloat | SupportsIndex = -0.006, max_members: SupportsInt | SupportsIndex = 20, max_distance: SupportsFloat | SupportsIndex = 200000.0, gradient_by_equation: bool = False, minimum_z_distance: SupportsFloat | SupportsIndex = 50, gradient_min: SupportsFloat | SupportsIndex = -0.01, gradient_max: SupportsFloat | SupportsIndex = 0.01) None¶
construct IDW for temperature as specified by arguments
- property default_temp_gradient¶
[degC/m], default=-0.006
- Type:
float
- property gradient_by_equation¶
if true, gradient is computed using 4 closest neighbors, solving equations to find 3D temperature gradients.
- Type:
bool
- property gradient_max¶
[degC/m] default +0.01, if computed gradient larger than this, the default-gradient is used instead
- Type:
float
- property gradient_min¶
[degC/m] default -0.01, if computed gradient less than this, the default-gradient is used instead
- Type:
float
- property minimum_z_distance¶
[m] default 50m, the minimum vertical distance requirement for two points to be used for gradient computation
- Type:
float
- class shyft.hydrology.InterpolationParameter(*args, **kwargs)¶
Bases:
pybind11_objectThe InterpolationParameter keep parameters needed to perform the interpolation steps, IDW,BTK etc It is used as parameter in the model.run_interpolation() method
Overloaded function.
__init__(self: shyft.hydrology.InterpolationParameter) -> None
__init__(self: shyft.hydrology.InterpolationParameter, temperature: shyft.hydrology.BTKParameter, precipitation: shyft.hydrology.IDWPrecipitationParameter, wind_speed: shyft.hydrology.IDWParameter, radiation: shyft.hydrology.IDWParameter, rel_hum: shyft.hydrology.IDWParameter) -> None
__init__(self: shyft.hydrology.InterpolationParameter, temperature: shyft.hydrology.IDWTemperatureParameter, precipitation: shyft.hydrology.IDWPrecipitationParameter, wind_speed: shyft.hydrology.IDWParameter, radiation: shyft.hydrology.IDWParameter, rel_hum: shyft.hydrology.IDWParameter) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.InterpolationParameter) -> None
__init__(self: shyft.hydrology.InterpolationParameter, temperature: shyft.hydrology.BTKParameter, precipitation: shyft.hydrology.IDWPrecipitationParameter, wind_speed: shyft.hydrology.IDWParameter, radiation: shyft.hydrology.IDWParameter, rel_hum: shyft.hydrology.IDWParameter) -> None
__init__(self: shyft.hydrology.InterpolationParameter, temperature: shyft.hydrology.IDWTemperatureParameter, precipitation: shyft.hydrology.IDWPrecipitationParameter, wind_speed: shyft.hydrology.IDWParameter, radiation: shyft.hydrology.IDWParameter, rel_hum: shyft.hydrology.IDWParameter) -> None
- static deserialize_from_str(s: str) shyft.hydrology.InterpolationParameter¶
InterpolationParameter: deserialized from a hex string representation.
- property precipitation¶
IDW parameters for precipitation
- property radiation¶
IDW parameters for radiation
- Type:
- property rel_hum¶
IDW parameters for relative humidity
- Type:
- serialize_to_str(self: shyft.hydrology.InterpolationParameter) str¶
Serialize InterpolationParameter to a hex string.
- property temperature¶
BTK for temperature (in case .use_idw_for_temperature is false)
- Type:
- property temperature_idw¶
IDW for temperature(in case .use_idw_for_temperature is true)
- Type:
- property use_idw_for_temperature¶
if true, the IDW temperature is used instead of BTK, useful for grid-input scenarios
- Type:
bool
- property wind_speed¶
IDW parameters for wind_speed
- Type:
- class shyft.hydrology.KalmanBiasPredictor(*args, **kwargs)¶
Bases:
pybind11_objectA bias predictor using a daily pattern KalmanFilter for temperature (etc.) (tbd)
Overloaded function.
__init__(self: shyft.hydrology.KalmanBiasPredictor) -> None
__init__(self: shyft.hydrology.KalmanBiasPredictor, filter: shyft.hydrology.KalmanFilter) -> None
__init__(self: shyft.hydrology.KalmanBiasPredictor, filter: shyft.hydrology.KalmanFilter, state: shyft.hydrology.KalmanState) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.KalmanBiasPredictor) -> None
__init__(self: shyft.hydrology.KalmanBiasPredictor, filter: shyft.hydrology.KalmanFilter) -> None
__init__(self: shyft.hydrology.KalmanBiasPredictor, filter: shyft.hydrology.KalmanFilter, state: shyft.hydrology.KalmanState) -> None
- compute_running_bias(self: shyft.hydrology.KalmanBiasPredictor, arg0: shyft.time_series.TimeSeries, arg1: shyft.time_series.TimeSeries, arg2: shyft.time_series.TimeAxis) shyft.time_series.TimeSeries¶
- static compute_running_bias_ts(bias_predictor: shyft.hydrology.KalmanBiasPredictor, forecast_ts: shyft.time_series.TimeSeries, observation_ts: shyft.time_series.TimeSeries, time_axis: shyft.time_series.TimeAxis) shyft.time_series.TimeSeries¶
compute the running bias timeseries, using one ‘merged’ - forecasts and one observation time - series.
Before each day - period, the bias - values are copied out to form a continuous bias prediction time-series.
- Parameters:
bias_predictor (KalmanBiasPredictor) – The bias predictor object it self
forecast_ts (TimeSeries) – a merged forecast ts, with period covering the observation_ts and time_axis supplied
observation_ts (TimeSeries) – the observation time-series
time_axis (TimeAxis) – covering the period/timesteps to be updated, e.g. yesterday, 3h resolution steps, according to the points in the filter
- Returns:
bias_ts. With ts( time_axis,bias_vector,POINT_AVERAGE), computed running bias-ts
- Return type:
- property filter¶
- property state¶
- update_with_forecast(*args, **kwargs)¶
Overloaded function.
update_with_forecast(self: shyft.hydrology.KalmanBiasPredictor, arg0: shyft.hydrology.GeoPointSourceVector, arg1: shyft.time_series.TimeSeries, arg2: shyft.time_series.TimeAxis) -> None
update_with_forecast(self: shyft.hydrology.KalmanBiasPredictor, arg0: collections.abc.Sequence[shyft.time_series.TimeSeries], arg1: shyft.time_series.TimeSeries, arg2: shyft.time_series.TimeAxis) -> None
- update_with_forecast_vector(self: shyft.hydrology.KalmanBiasPredictor, temperature_sources: collections.abc.Sequence[shyft.time_series.TimeSeries], observation_ts: shyft.time_series.TimeSeries, time_axis: shyft.time_series.TimeAxis) None¶
update the bias-predictor with forecasts and observation After the update, the state is updated with new kalman estimates for the bias, .state.x
- Parameters:
temperature_sources (TsVector) – a set of forecasts, in the order oldest to the newest.With the periods covering parts of the observation_ts and time_axis supplied
observation_ts (TimeSeries) – the observation time-series
time_axis (TimeAxis) – covering the period/timesteps to be updated, e.g. yesterday, 3h resolution steps, according to the points in the filter
- update_with_geo_forecast(self: shyft.hydrology.KalmanBiasPredictor, temperature_sources: shyft.hydrology.GeoPointSourceVector, observation_ts: shyft.time_series.TimeSeries, time_axis: shyft.time_series.TimeAxis) None¶
update the bias-predictor with forecasts and observation After the update, the state is updated with new kalman estimates for the bias, .state.x
- Parameters:
temperature_sources (TemperatureSourceVector) – ta set of forecasts, in the order oldest to the newest.Note that the geo part of source is not used in this context, only the tswith periods covering parts of the observation_ts and time_axis supplied
observation_ts (Timeseries) – the observation time-series
time_axis (TimeAxis) – covering the period/timesteps to be updated,e.g. yesterday, 3h resolution steps, according to the points in the filter
- class shyft.hydrology.KalmanFilter(self: shyft.hydrology.KalmanFilter, p: shyft.hydrology.KalmanParameter = KalmanParameter(n_daily_observations=8, hourly_correlation=0.93, covariance_init=0.5, std_error_bias_measurements=2, ratio_std_w_over_v=0.15))¶
Bases:
pybind11_objectSpecialized kalman filter for temperature (e.g.:solar-driven bias patterns) The observation point(t, v) is folded on to corresponding period of the day(number of periods in a day is parameterized, typically 8). A simplified kalman filter algorithm using the forecast bias as the state - variable. Observed bias(fc - obs) is feed into the filter and establishes the kalman best predicted estimates(x) for the bias. This bias can then be used as a correction to forecast in the future to compensate for systematic forecast errors. Credits: Thanks to met.no for providing the original source for this algorithm.
- __init__(self: shyft.hydrology.KalmanFilter, p: shyft.hydrology.KalmanParameter = KalmanParameter(n_daily_observations=8, hourly_correlation=0.93, covariance_init=0.5, std_error_bias_measurements=2, ratio_std_w_over_v=0.15)) None¶
- create_initial_state(self: shyft.hydrology.KalmanFilter) shyft.hydrology.KalmanState¶
- property parameter¶
- update(self: shyft.hydrology.KalmanFilter, observed_bias: SupportsFloat | SupportsIndex, t: shyft.time_series.time, state: shyft.hydrology.KalmanState) None¶
update the with the observed_bias for a specific period starting at utctime t
- Parameters:
observed_bias (float) – nan if no observation is available otherwise obs - fc
t (time) – utctime of the start of the observation period, this filter utilizes daily solar patterns, so time in day - cycle is the only important aspect.
state (KalmanState) – contains the kalman state,that is updated by the function upon return
- class shyft.hydrology.KalmanParameter(*args, **kwargs)¶
Bases:
pybind11_objectDefines the parameters that is used to tune the kalman-filter algorithm for temperature type of signals
Overloaded function.
__init__(self: shyft.hydrology.KalmanParameter, n_daily_observations: typing.SupportsInt | typing.SupportsIndex = 8, hourly_correlation: typing.SupportsFloat | typing.SupportsIndex = 0.93, covariance_init: typing.SupportsFloat | typing.SupportsIndex = 0.5, std_error_bias_measurements: typing.SupportsFloat | typing.SupportsIndex = 2.0, ratio_std_w_over_v: typing.SupportsFloat | typing.SupportsIndex = 0.15) -> None
Constructs KalmanParameter with default or supplied values
__init__(self: shyft.hydrology.KalmanParameter, const_ref: shyft.hydrology.KalmanParameter) -> None
clone the supplied KalmanParameter
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.KalmanParameter, n_daily_observations: typing.SupportsInt | typing.SupportsIndex = 8, hourly_correlation: typing.SupportsFloat | typing.SupportsIndex = 0.93, covariance_init: typing.SupportsFloat | typing.SupportsIndex = 0.5, std_error_bias_measurements: typing.SupportsFloat | typing.SupportsIndex = 2.0, ratio_std_w_over_v: typing.SupportsFloat | typing.SupportsIndex = 0.15) -> None
Constructs KalmanParameter with default or supplied values
__init__(self: shyft.hydrology.KalmanParameter, const_ref: shyft.hydrology.KalmanParameter) -> None
clone the supplied KalmanParameter
- property covariance_init¶
default=0.5, for the error covariance P matrix start-values
- Type:
float
- property hourly_correlation¶
default=0.93, correlation from one-hour to the next
- Type:
float
- property n_daily_observations¶
default = 8 each 24hour, every 3 hour
- Type:
int
- property ratio_std_w_over_v¶
default=0.06, st.dev W /st.dev V ratio
- Type:
float
- property std_error_bias_measurements¶
default=2.0, st.dev for the bias measurements
- Type:
float
- class shyft.hydrology.KalmanState(*args, **kwargs)¶
Bases:
pybind11_objectkeeps the state of the specialized kalman-filter: * x : vector[n=n_daily_observations] best estimate * k : vector[n], gain factors * P : matrix[nxn], covariance * W : noise[nxn]
Overloaded function.
__init__(self: shyft.hydrology.KalmanState) -> None
__init__(self: shyft.hydrology.KalmanState, n_daily_observations: typing.SupportsInt | typing.SupportsIndex, covariance_init: typing.SupportsFloat | typing.SupportsIndex, hourly_correlation: typing.SupportsFloat | typing.SupportsIndex, process_noise_init: typing.SupportsFloat | typing.SupportsIndex) -> None
__init__(self: shyft.hydrology.KalmanState, clone: shyft.hydrology.KalmanState) -> None
clone the supplied state
- property P¶
- property W¶
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.KalmanState) -> None
__init__(self: shyft.hydrology.KalmanState, n_daily_observations: typing.SupportsInt | typing.SupportsIndex, covariance_init: typing.SupportsFloat | typing.SupportsIndex, hourly_correlation: typing.SupportsFloat | typing.SupportsIndex, process_noise_init: typing.SupportsFloat | typing.SupportsIndex) -> None
__init__(self: shyft.hydrology.KalmanState, clone: shyft.hydrology.KalmanState) -> None
clone the supplied state
- static get_P(arg0: shyft.hydrology.KalmanState) list[float]¶
- static get_W(arg0: shyft.hydrology.KalmanState) list[float]¶
- static get_k(arg0: shyft.hydrology.KalmanState) list[float]¶
- static get_x(arg0: shyft.hydrology.KalmanState) list[float]¶
- property k¶
- size(self: shyft.hydrology.KalmanState) int¶
returns the size of the state, corresponding to n_daily_observations
- property x¶
- class shyft.hydrology.KirchnerCalculator(*args, **kwargs)¶
Bases:
pybind11_objectKirchner model for computing the discharge based on precipitation and evapotranspiration data.
This algorithm is based on the log transform of the ode formulation of the time change in discharge as a function of measured precipitation, evapo-transpiration and discharge, i.e. equation 19 in the publication Catchments as simple dynamic systems: Catchment characterization, rainfall-runoff modeling, and doing ‘hydrology backward’ by James W. Kirchner, published in Water Resources Research, vol. 45, W02429, doi: 10.1029/2008WR006912, 2009.
Overloaded function.
__init__(self: shyft.hydrology.KirchnerCalculator, param: shyft.hydrology.KirchnerParameter) -> None
__init__(self: shyft.hydrology.KirchnerCalculator, abs_err: typing.SupportsFloat | typing.SupportsIndex, rel_err: typing.SupportsFloat | typing.SupportsIndex, param: shyft.hydrology.KirchnerParameter) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.KirchnerCalculator, param: shyft.hydrology.KirchnerParameter) -> None
__init__(self: shyft.hydrology.KirchnerCalculator, abs_err: typing.SupportsFloat | typing.SupportsIndex, rel_err: typing.SupportsFloat | typing.SupportsIndex, param: shyft.hydrology.KirchnerParameter) -> None
- step(self: shyft.hydrology.KirchnerCalculator, state: shyft.hydrology.KirchnerState, response: shyft.hydrology.KirchnerResponse, t0: shyft.time_series.time, t1: shyft.time_series.time, precipitation: SupportsFloat | SupportsIndex, evapotranspiration: SupportsFloat | SupportsIndex) None¶
step Kirchner model forward from time t0 to time t1
note: If the supplied q (state) is less than min_q(0.00001, it represents mm water..), it is forced to min_q to ensure numerical stability
- Parameters:
state (KirchnerState) – current state, updated on return
response (KirchnerResponse) – the response , out parameter.
t0 (time) – start time
t1 (time) – end time
precipitation (float) – in mm/h
evapotranspiration (float) – in mm/h
- class shyft.hydrology.KirchnerParameter(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.KirchnerParameter) -> None
__init__(self: shyft.hydrology.KirchnerParameter, c1: typing.SupportsFloat | typing.SupportsIndex = 2.439, c2: typing.SupportsFloat | typing.SupportsIndex = 0.966, c3: typing.SupportsFloat | typing.SupportsIndex = -0.1) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.KirchnerParameter) -> None
__init__(self: shyft.hydrology.KirchnerParameter, c1: typing.SupportsFloat | typing.SupportsIndex = 2.439, c2: typing.SupportsFloat | typing.SupportsIndex = 0.966, c3: typing.SupportsFloat | typing.SupportsIndex = -0.1) -> None
- property c1¶
default =2.439
- Type:
float
- property c2¶
default= 0.966
- Type:
float
- property c3¶
default = -0.10
- Type:
float
- class shyft.hydrology.KirchnerResponse(self: shyft.hydrology.KirchnerResponse)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.KirchnerResponse) None¶
- property q_avg¶
average discharge over time-step in [mm/h]
- Type:
float
- class shyft.hydrology.KirchnerState(self: shyft.hydrology.KirchnerState, q: SupportsFloat | SupportsIndex = 0.0001)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.KirchnerState, q: SupportsFloat | SupportsIndex = 0.0001) None¶
- property q¶
state water ‘content’ in [mm/h], it defaults to 0.0001 mm, zero is not a reasonable valid value
- Type:
float
- class shyft.hydrology.LandTypeFractions(*args, **kwargs)¶
Bases:
pybind11_objectLandTypeFractions are used to describe type of land, like glacier, lake, reservoir and forest. It is designed as a part of GeoCellData
Overloaded function.
__init__(self: shyft.hydrology.LandTypeFractions) -> None
__init__(self: shyft.hydrology.LandTypeFractions, glacier: typing.SupportsFloat | typing.SupportsIndex, lake: typing.SupportsFloat | typing.SupportsIndex, reservoir: typing.SupportsFloat | typing.SupportsIndex, forest: typing.SupportsFloat | typing.SupportsIndex, unspecified: typing.SupportsFloat | typing.SupportsIndex) -> None
construct LandTypeFraction specifying the area of each type
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.LandTypeFractions) -> None
__init__(self: shyft.hydrology.LandTypeFractions, glacier: typing.SupportsFloat | typing.SupportsIndex, lake: typing.SupportsFloat | typing.SupportsIndex, reservoir: typing.SupportsFloat | typing.SupportsIndex, forest: typing.SupportsFloat | typing.SupportsIndex, unspecified: typing.SupportsFloat | typing.SupportsIndex) -> None
construct LandTypeFraction specifying the area of each type
- forest(self: shyft.hydrology.LandTypeFractions) float¶
returns the forest part
- glacier(self: shyft.hydrology.LandTypeFractions) float¶
returns the glacier part
- lake(self: shyft.hydrology.LandTypeFractions) float¶
returns the lake part
- reservoir(self: shyft.hydrology.LandTypeFractions) float¶
returns the reservoir part
- set_fractions(self: shyft.hydrology.LandTypeFractions, glacier: SupportsFloat | SupportsIndex, lake: SupportsFloat | SupportsIndex, reservoir: SupportsFloat | SupportsIndex, forest: SupportsFloat | SupportsIndex) None¶
set the fractions explicit, each a value in range 0..1, sum should be 1.0
- snow_storage(self: shyft.hydrology.LandTypeFractions) float¶
returns the area where snow can build up, 1.0-lake-reservoir
- unspecified(self: shyft.hydrology.LandTypeFractions) float¶
returns the unspecified part
- class shyft.hydrology.MethodStackParameter(*args, **kwargs)¶
Bases:
pybind11_objectContains the parameters for the method-stack, related to inter-method and routing behaviour
Overloaded function.
__init__(self: shyft.hydrology.MethodStackParameter) -> None
__init__(self: shyft.hydrology.MethodStackParameter, clone: shyft.hydrology.MethodStackParameter) -> None
make a clone
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.MethodStackParameter) -> None
__init__(self: shyft.hydrology.MethodStackParameter, clone: shyft.hydrology.MethodStackParameter) -> None
make a clone
- property reservoir_direct_response_fraction¶
range 0..1, default 1.0, e.g. all precipitation on a reservoir goes to direct response - set to 0.0, then all precipitation is routed as pr. standard for the stack
- Type:
float
- class shyft.hydrology.OKCovarianceType(self: shyft.hydrology.OKCovarianceType, value: SupportsInt | SupportsIndex)¶
Bases:
pybind11_objectMembers:
GAUSSIAN
EXPONENTIAL
- EXPONENTIAL = <OKCovarianceType.EXPONENTIAL: 1>¶
- GAUSSIAN = <OKCovarianceType.GAUSSIAN: 0>¶
- __init__(self: shyft.hydrology.OKCovarianceType, value: SupportsInt | SupportsIndex) None¶
- OKCovarianceType.name -> str
- property value¶
- class shyft.hydrology.OKParameter(*args, **kwargs)¶
Bases:
pybind11_objectOrdinary Kriging Parameter, keeps parameters that controls the ordinary kriging calculation
Overloaded function.
__init__(self: shyft.hydrology.OKParameter) -> None
__init__(self: shyft.hydrology.OKParameter, c: typing.SupportsFloat | typing.SupportsIndex = 1.0, a: typing.SupportsFloat | typing.SupportsIndex = 10000.0, cov_type: shyft.hydrology.OKCovarianceType = <OKCovarianceType.EXPONENTIAL: 1>, z_scale: typing.SupportsFloat | typing.SupportsIndex = 1.0) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.OKParameter) -> None
__init__(self: shyft.hydrology.OKParameter, c: typing.SupportsFloat | typing.SupportsIndex = 1.0, a: typing.SupportsFloat | typing.SupportsIndex = 10000.0, cov_type: shyft.hydrology.OKCovarianceType = <OKCovarianceType.EXPONENTIAL: 1>, z_scale: typing.SupportsFloat | typing.SupportsIndex = 1.0) -> None
- property a¶
the a-constant, range or distance, value in the covariance formula
- Type:
float
- property c¶
the c-constant, sill value in the covariance formula
- Type:
float
- property cov_type¶
covariance type EXPONENTIAL|GAUSSIAN to be used
- Type:
- property z_scale¶
z_scale to be used for range|distance calculations
- Type:
float
- class shyft.hydrology.OptimizerMethod(self: shyft.hydrology.OptimizerMethod, value: SupportsInt | SupportsIndex)¶
Bases:
pybind11_objectShyft calibration allow the user to select between one of these parameter optimizer methods.
Members:
BOBYQA
GLOBAL
DREAM
SCEUA
- BOBYQA = <OptimizerMethod.BOBYQA: 0>¶
- DREAM = <OptimizerMethod.DREAM: 2>¶
- GLOBAL = <OptimizerMethod.GLOBAL: 1>¶
- SCEUA = <OptimizerMethod.SCEUA: 3>¶
- __init__(self: shyft.hydrology.OptimizerMethod, value: SupportsInt | SupportsIndex) None¶
- OptimizerMethod.name -> str
- property value¶
- class shyft.hydrology.ParameterClient(self: shyft.hydrology.ParameterClient, host_port: str, timeout_ms: SupportsInt | SupportsIndex, operation_timeout_ms: SupportsInt | SupportsIndex = 0)¶
Bases:
pybind11_objectThe client api for the shyft.hydrology parameter model service.
Creates a python client that can communicate with the corresponding server
- __init__(self: shyft.hydrology.ParameterClient, host_port: str, timeout_ms: SupportsInt | SupportsIndex, operation_timeout_ms: SupportsInt | SupportsIndex = 0) None¶
Creates a python client that can communicate with the corresponding server
- close(self: shyft.hydrology.ParameterClient) None¶
Close the connection. It will automatically reopen if needed.
- get_model_infos(self: shyft.hydrology.ParameterClient, mids: collections.abc.Sequence[SupportsInt | SupportsIndex], created_in: shyft.time_series.UtcPeriod = UtcPeriod()) list[shyft.time_series.ModelInfo]¶
returns all or selected model-info objects based on model-identifiers(mids)
- Parameters:
mids (IntVector) – empty = all, or a list of known exisiting model-identifiers
created_in (UtcPeriod) – For which period you are interested in model-infos.
- Returns:
model_infos. Strongly typed list of ModelInfo
- Return type:
ModelInfoVector
- property host_port¶
Endpoint network address of the remote server.
- Type:
str
- property is_open¶
If the connection to the remote server is (still) open.
- Type:
bool
- property operation_timeout_ms¶
Operation timeout for remote server operations, in number milliseconds.
- Type:
int
- read_model(self: shyft.hydrology.ParameterClient, mid: SupportsInt | SupportsIndex) shyft.hydrology.ParameterModel¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting model from the server
- Return type:
- read_models(self: shyft.hydrology.ParameterClient, mids: collections.abc.Sequence[SupportsInt | SupportsIndex]) shyft.hydrology.ParameterModelVector¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mids (list[int]) – A strongly typed list of ints, the model-identifers for the wanted models
- Returns:
The resulting model from the server
- Return type:
- property reconnect_count¶
Number of reconnects to the remote server that have been performed.
- Type:
int
- remove_model(self: shyft.hydrology.ParameterClient, mid: SupportsInt | SupportsIndex) int¶
Remove the specified model bymodel-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
ec. 0 or error-code?
- Return type:
int
- store_model(self: shyft.hydrology.ParameterClient, m: shyft.hydrology.ParameterModel, mi: shyft.time_series.ModelInfo) int¶
Store the model to backend, if m.id==0 then a new unique model-info is created and used
- property timeout_ms¶
Timout for remote server operations, in number milliseconds.
- Type:
int
- update_model_info(self: shyft.hydrology.ParameterClient, mid: SupportsInt | SupportsIndex, mi: shyft.time_series.ModelInfo) bool¶
Update the model-info for specified model-identifier(mid)
- Parameters:
mid (int) – model-identifer
mi (ModelInfo) – The new updated model-info
- Returns:
ok. true if success
- Return type:
bool
- class shyft.hydrology.ParameterModel(self: shyft.hydrology.ParameterModel)¶
Bases:
pybind11_objectA model identifier and a strongly typed dict, cpp-map, of stack parameters, suitable for use with a region-model matching the type.
- __init__(self: shyft.hydrology.ParameterModel) None¶
- property id¶
- property parameters¶
- class shyft.hydrology.ParameterModelVector(*args, **kwargs)¶
Bases:
pybind11_objectA strongly typed list of ParameterModels
Overloaded function.
__init__(self: shyft.hydrology.ParameterModelVector) -> None
__init__(self: shyft.hydrology.ParameterModelVector, arg0: shyft.hydrology.ParameterModelVector) -> None
Copy constructor
__init__(self: shyft.hydrology.ParameterModelVector, arg0: collections.abc.Iterable) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.ParameterModelVector) -> None
__init__(self: shyft.hydrology.ParameterModelVector, arg0: shyft.hydrology.ParameterModelVector) -> None
Copy constructor
__init__(self: shyft.hydrology.ParameterModelVector, arg0: collections.abc.Iterable) -> None
- append(self: shyft.hydrology.ParameterModelVector, x: shyft.hydrology.ParameterModel) None¶
Add an item to the end of the list
- clear(self: shyft.hydrology.ParameterModelVector) None¶
Clear the contents
- extend(*args, **kwargs)¶
Overloaded function.
extend(self: shyft.hydrology.ParameterModelVector, L: shyft.hydrology.ParameterModelVector) -> None
Extend the list by appending all the items in the given list
extend(self: shyft.hydrology.ParameterModelVector, L: collections.abc.Iterable) -> None
Extend the list by appending all the items in the given list
- insert(self: shyft.hydrology.ParameterModelVector, i: SupportsInt | SupportsIndex, x: shyft.hydrology.ParameterModel) None¶
Insert an item at a given position.
- pop(*args, **kwargs)¶
Overloaded function.
pop(self: shyft.hydrology.ParameterModelVector) -> shyft.hydrology.ParameterModel
Remove and return the last item
pop(self: shyft.hydrology.ParameterModelVector, i: typing.SupportsInt | typing.SupportsIndex) -> shyft.hydrology.ParameterModel
Remove and return the item at index
i
- size(self: shyft.hydrology.ParameterModelVector) int¶
- class shyft.hydrology.ParameterOptimizer(self: shyft.hydrology.ParameterOptimizer, p_min: collections.abc.Sequence[SupportsFloat | SupportsIndex], p_max: collections.abc.Sequence[SupportsFloat | SupportsIndex], fx: collections.abc.Callable[[collections.abc.Sequence[SupportsFloat | SupportsIndex]], float])¶
Bases:
pybind11_objectThe ParameterOptimizer allows for testing and comparing optimizer methods for the same inital parameters and goal function.
Initialises a ParameterOptimizer instance.
p_min (Union[DoubleVector[float], DoubleVector[int]]): the lower parameter bound in at least one-dimensional space.
p_max (Union[DoubleVector[float], DoubleVector[int]]): the upper parameter bound in at least one-dimensional space.
fx (Callable): the goal function to be used in the parameter optimization problem.
- __init__(self: shyft.hydrology.ParameterOptimizer, p_min: collections.abc.Sequence[SupportsFloat | SupportsIndex], p_max: collections.abc.Sequence[SupportsFloat | SupportsIndex], fx: collections.abc.Callable[[collections.abc.Sequence[SupportsFloat | SupportsIndex]], float]) None¶
Initialises a ParameterOptimizer instance.
p_min (Union[DoubleVector[float], DoubleVector[int]]): the lower parameter bound in at least one-dimensional space.
p_max (Union[DoubleVector[float], DoubleVector[int]]): the upper parameter bound in at least one-dimensional space.
fx (Callable): the goal function to be used in the parameter optimization problem.
- property fx¶
goal function for which parameters are optimized
- Type:
Callable[[],float]
- goal_function(self: shyft.hydrology.ParameterOptimizer, x: collections.abc.Sequence[SupportsFloat | SupportsIndex]) float¶
The goal function to be used in the optimization problem.
x (Union[DoubleVector[float], DoubleVector[int]]): the point in at least one-dimensional space at which the goal function is evaluated.
- Returns:
The function value f(x) at point x.
- Return type:
DoubleVector[float]
- optimize(self: shyft.hydrology.ParameterOptimizer, x: collections.abc.Sequence[SupportsFloat | SupportsIndex], calibration_option: shyft.hydrology.CalibrationOption) list[float]¶
Run the optimizer for given parameters and configuration.
x (Union[DoubleVector[float], DoubleVector[int]]): the initial point in at least one-dimensional space for the optimization problem.
calibration_option (CalibrationOption): the calibration for the various optimization methods.
- Returns:
x_opt. The optimal parameters for which the optimum of f(x) is found.
- Return type:
DoubleVector[float]
See also
CalibrationOption
- property p_max¶
upper parameter bound in at least one-dimensional space
- Type:
DoubleVector
- property p_min¶
lower parameter bound in at least one-dimensional space
- Type:
DoubleVector
- class shyft.hydrology.ParameterServer(self: shyft.hydrology.ParameterServer, root_dir: str, config: shyft.time_series.ServerConfig = shyft.time_series.ServerConfig(stale_duration='1970-01-01T01:00:00Z', stale_sweep_interval='1970-01-01T00:00:00.100000Z', log=shyft.time_series.LogConfig(file='', level=200)))¶
Bases:
pybind11_objectThe server-side component for the shyft.hydrology parameter model repository.
Creates a server object that serves models from root_dir. The root_dir will be create if it does not exists.
- Parameters:
root_dir (str) – Path to the root-directory that keeps/will keep the model-files
config (ServerConfig) – Configuration of the server
- __init__(self: shyft.hydrology.ParameterServer, root_dir: str, config: shyft.time_series.ServerConfig = shyft.time_series.ServerConfig(stale_duration='1970-01-01T01:00:00Z', stale_sweep_interval='1970-01-01T00:00:00.100000Z', log=shyft.time_series.LogConfig(file='', level=200))) None¶
Creates a server object that serves models from root_dir. The root_dir will be create if it does not exists.
- Parameters:
root_dir (str) – Path to the root-directory that keeps/will keep the model-files
config (ServerConfig) – Configuration of the server
- get_listening_port(self: shyft.hydrology.ParameterServer) int¶
returns the port number it’s listening at for serving incoming request
- get_max_connections(self: shyft.hydrology.ParameterServer) int¶
returns the maximum number of connections to be served concurrently
- get_model_infos(self: shyft.hydrology.ParameterServer, mids: collections.abc.Sequence[SupportsInt | SupportsIndex], created_in: shyft.time_series.UtcPeriod = UtcPeriod()) list[shyft.time_series.ModelInfo]¶
returns all or selected model-info objects based on model-identifiers(mids)
- Parameters:
mids (IntVector) – empty = all, or a list of known exisiting model-identifiers
created_in (UtcPeriod) – For which period you are interested in model-infos.
- Returns:
model_infos. Strongly typed list of ModelInfo
- Return type:
ModelInfoVector
- is_running(self: shyft.hydrology.ParameterServer) bool¶
true if server is listening and running
See also
start_server()
- read_model(self: shyft.hydrology.ParameterServer, mid: SupportsInt | SupportsIndex) shyft.hydrology.ParameterModel¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting model from the server
- Return type:
- read_model_blob(self: shyft.hydrology.ParameterServer, mid: SupportsInt | SupportsIndex) shyft.time_series.ByteVector¶
Read and return the model blob for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting blob model from the server
- Return type:
ByteVector
- read_models(self: shyft.hydrology.ParameterServer, mids: collections.abc.Sequence[SupportsInt | SupportsIndex]) shyft.hydrology.ParameterModelVector¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mids (list[int]) – A strongly typed list of ints, the model-identifers for the wanted models
- Returns:
The resulting model from the server
- Return type:
- remove_model(self: shyft.hydrology.ParameterServer, mid: SupportsInt | SupportsIndex) int¶
Remove the specified model bymodel-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
ec. 0 or error-code?
- Return type:
int
- set_listening_ip(self: shyft.hydrology.ParameterServer, ip: str) None¶
set the listening port for the service
- Parameters:
ip (str) – ip or host-name to start listening on
- Returns:
nothing.
- Return type:
None
- set_listening_port(self: shyft.hydrology.ParameterServer, port_no: SupportsInt | SupportsIndex) None¶
set the listening port for the service
- Parameters:
port_no (int) – a valid and available tcp-ip port number to listen on.
20000 (typically it could be)
- Returns:
nothing.
- Return type:
None
- set_max_connections(self: shyft.hydrology.ParameterServer, max_connect: SupportsInt | SupportsIndex) None¶
limits simultaneous connections to the server (it’s multithreaded, and uses on thread pr. connect)
- Parameters:
max_connect (int) – maximum number of connections before denying more connections
See also
get_max_connections()
- property stale_connection_close_count¶
returns count of connection closed due to stale/no communication activity
- Type:
int
- start_server(self: shyft.hydrology.ParameterServer) int¶
start server listening in background, and processing messages
See also
set_listening_port(port_no),is_running
- Returns:
port_no. the port used for listening operations, either the value as by set_listening_port, or if it was unspecified, a new available port
- Return type:
in
- stop_server(self: shyft.hydrology.ParameterServer, timeout: SupportsInt | SupportsIndex = 1000) None¶
stop serving connections, gracefully.
See also
start_server()
- store_model(self: shyft.hydrology.ParameterServer, m: shyft.hydrology.ParameterModel, mi: shyft.time_series.ModelInfo) int¶
Store the model to backend, if m.id==0 then a new unique model-info is created and used
- update_model_info(self: shyft.hydrology.ParameterServer, mid: SupportsInt | SupportsIndex, mi: shyft.time_series.ModelInfo) bool¶
Update the model-info for specified model-identifier(mid)
- Parameters:
mid (int) – model-identifer
mi (ModelInfo) – The new updated model-info
- Returns:
ok. true if success
- Return type:
bool
- class shyft.hydrology.PenmanMonteithCalculator(self: shyft.hydrology.PenmanMonteithCalculator, param: shyft.hydrology.PenmanMonteithParameter)¶
Bases:
pybind11_objectEvapotranspiration model, Penman-Monteith equation, PM reference
ASCE-EWRI The ASCE Standardized Reference Evapotranspiration Equation Environmental and * Water Resources Institute (EWRI) of the American Society of Civil Engineers Task Committee on Standardization of * Reference Evapotranspiration Calculation, ASCE, Washington, DC, Environmental and Water Resources Institute (EWRI) of * the American Society of Civil Engineers Task Committee on Standardization of Reference Evapotranspiration Calculation, * ASCE, Washington, DC, 2005
calculating reference evapotranspiration This function is plain and simple, taking albedo and turbidity into the constructor and provides function: reference_evapotranspiration; [mm/s] units.
- __init__(self: shyft.hydrology.PenmanMonteithCalculator, param: shyft.hydrology.PenmanMonteithParameter) None¶
- reference_evapotranspiration(self: shyft.hydrology.PenmanMonteithCalculator, response: shyft.hydrology.PenmanMonteithResponse, dt: shyft.time_series.time, net_radiation: SupportsFloat | SupportsIndex, tempmax: SupportsFloat | SupportsIndex, tempmin: SupportsFloat | SupportsIndex, rhumidity: SupportsFloat | SupportsIndex, elevation: SupportsFloat | SupportsIndex, windspeed: SupportsFloat | SupportsIndex) None¶
calculates reference evapotranspiration (standard or full based on full_model param), updating response
- class shyft.hydrology.PenmanMonteithParameter(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.PenmanMonteithParameter) -> None
__init__(self: shyft.hydrology.PenmanMonteithParameter, height_veg: typing.SupportsFloat | typing.SupportsIndex, height_ws: typing.SupportsFloat | typing.SupportsIndex, height_t: typing.SupportsFloat | typing.SupportsIndex, rl: typing.SupportsFloat | typing.SupportsIndex, full_model: bool) -> None
a new object with specified parameters
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.PenmanMonteithParameter) -> None
__init__(self: shyft.hydrology.PenmanMonteithParameter, height_veg: typing.SupportsFloat | typing.SupportsIndex, height_ws: typing.SupportsFloat | typing.SupportsIndex, height_t: typing.SupportsFloat | typing.SupportsIndex, rl: typing.SupportsFloat | typing.SupportsIndex, full_model: bool) -> None
a new object with specified parameters
- property full_model¶
boolean to specify if full penman-monteith required, set to false by default, so it is asce-ewri standard
- Type:
bool
- property height_t¶
typical value 2.0
- Type:
float
- property height_veg¶
grass 0.15
- Type:
float
- property height_ws¶
typical value 2.0
- Type:
float
- property rl¶
stomatal resistance, for full PM only, 140
- Type:
float
- class shyft.hydrology.PenmanMonteithResponse(self: shyft.hydrology.PenmanMonteithResponse)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.PenmanMonteithResponse) None¶
- property et_ref¶
- Type:
float
- property soil_heat¶
- Type:
float
- class shyft.hydrology.PenmanMonteithVegetationCalculator(self: shyft.hydrology.PenmanMonteithVegetationCalculator, param: shyft.hydrology.PenmanMonteithVegetationParameter)¶
Bases:
pybind11_objectEvapotranspiration model, Penman-Monteith equation with vegetation properties, PM reference
L. Dingman Stewart-Penmann-Monteith evapotranspiration
[mm/s] units.
- __init__(self: shyft.hydrology.PenmanMonteithVegetationCalculator, param: shyft.hydrology.PenmanMonteithVegetationParameter) None¶
- evapotranspiration(self: shyft.hydrology.PenmanMonteithVegetationCalculator, response: shyft.hydrology.PenmanMonteithVegetationResponse, dt: shyft.time_series.time, swin_radiation: SupportsFloat | SupportsIndex, lw_radiation: SupportsFloat | SupportsIndex, tempmax: SupportsFloat | SupportsIndex, tempmin: SupportsFloat | SupportsIndex, rhumidity: SupportsFloat | SupportsIndex, lai: SupportsFloat | SupportsIndex, albedo: SupportsFloat | SupportsIndex, hvegetation: SupportsFloat | SupportsIndex, cleaf_max: SupportsFloat | SupportsIndex, ks: SupportsFloat | SupportsIndex, soil_moisture_deficit: SupportsFloat | SupportsIndex, elevation: SupportsFloat | SupportsIndex, windspeed: SupportsFloat | SupportsIndex) None¶
calculates evapotranspiration, updating response
- class shyft.hydrology.PenmanMonteithVegetationParameter(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.PenmanMonteithVegetationParameter) -> None
__init__(self: shyft.hydrology.PenmanMonteithVegetationParameter, height_ws: typing.SupportsFloat | typing.SupportsIndex, height_t: typing.SupportsFloat | typing.SupportsIndex) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.PenmanMonteithVegetationParameter) -> None
__init__(self: shyft.hydrology.PenmanMonteithVegetationParameter, height_ws: typing.SupportsFloat | typing.SupportsIndex, height_t: typing.SupportsFloat | typing.SupportsIndex) -> None
- property height_t¶
typical value 2.0
- Type:
float
- property height_ws¶
typical value 2.0
- Type:
float
- class shyft.hydrology.PenmanMonteithVegetationResponse¶
Bases:
pybind11_object- __init__(*args, **kwargs)¶
- property et¶
- property soil_heat¶
- class shyft.hydrology.PrecipitationCorrectionCalculator(self: shyft.hydrology.PrecipitationCorrectionCalculator, scale_factor: SupportsFloat | SupportsIndex)¶
Bases:
pybind11_objectScales precipitation with the specified scale factor
- __init__(self: shyft.hydrology.PrecipitationCorrectionCalculator, scale_factor: SupportsFloat | SupportsIndex) None¶
- calc(self: shyft.hydrology.PrecipitationCorrectionCalculator, precipitation: SupportsFloat | SupportsIndex) float¶
returns scale_factor*precipitation
- class shyft.hydrology.PrecipitationCorrectionParameter(self: shyft.hydrology.PrecipitationCorrectionParameter, scale_factor: SupportsFloat | SupportsIndex = 1.0)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.PrecipitationCorrectionParameter, scale_factor: SupportsFloat | SupportsIndex = 1.0) None¶
- property scale_factor¶
default =1.0
- Type:
float
- shyft.hydrology.PrecipitationSource¶
alias of
GeoPointSource
- shyft.hydrology.PrecipitationSourceVector¶
alias of
GeoPointSourceVector
- class shyft.hydrology.PriestleyTaylorCalculator(self: shyft.hydrology.PriestleyTaylorCalculator, land_albedo: SupportsFloat | SupportsIndex, alpha: SupportsFloat | SupportsIndex)¶
Bases:
pybind11_objectPriestleyTaylor,PT, (google for PriestleyTaylor) primitive implementation for calculating the potential evaporation. This function is plain and simple, taking land_albedo and PT.alpha into the constructor and provides a function that calculates potential evapotransporation [mm/s] units.
- __init__(self: shyft.hydrology.PriestleyTaylorCalculator, land_albedo: SupportsFloat | SupportsIndex, alpha: SupportsFloat | SupportsIndex) None¶
- potential_evapotranspiration(self: shyft.hydrology.PriestleyTaylorCalculator, temperature: SupportsFloat | SupportsIndex, global_radiation: SupportsFloat | SupportsIndex, rhumidity: SupportsFloat | SupportsIndex) float¶
Calculate PotentialEvapotranspiration, given specified parameters
param temperature in [degC]
param global_radiation [W/m2]
param rhumidity in interval [0,1]
return PotentialEvapotranspiration in [mm/s] units
- class shyft.hydrology.PriestleyTaylorParameter(self: shyft.hydrology.PriestleyTaylorParameter, albedo: SupportsFloat | SupportsIndex = 0.2, alpha: SupportsFloat | SupportsIndex = 1.26)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.PriestleyTaylorParameter, albedo: SupportsFloat | SupportsIndex = 0.2, alpha: SupportsFloat | SupportsIndex = 1.26) None¶
- property albedo¶
typical value 0.2
- Type:
float
- property alpha¶
typical value 1.26
- Type:
float
- class shyft.hydrology.PriestleyTaylorResponse¶
Bases:
pybind11_object- __init__(*args, **kwargs)¶
- property pot_evapotranspiration¶
response
- Type:
float
- class shyft.hydrology.RadiationCalculator(self: shyft.hydrology.RadiationCalculator, param: shyft.hydrology.RadiationParameter)¶
Bases:
pybind11_objectRadiation,R,
reference
Allen, R. G.; Trezza, R. & Tasumi, M. Analytical integrated functions for daily solar radiation on slopes Agricultural and Forest Meteorology, 2006, 139, 55-73) primitive implementation for calculating predicted clear-sky short-wave solar radiation for inclined surfaces
This function is plain and simple, taking albedo and turbidity into the constructor and provides 2 functions:
net_radiation calculates predicted solar radiation (if no measured data available) or translates measured data into the slope plus adds the longwave radiation: instantaneously;
net_radiation_step calculates predicted solar radiation or/and translates measured horizontal radiation into sloped surface for the time period between tstart and tend plus adds the lw radiation
Recommended usage is the net_radiation_step for 24h-steps; it was also tested with 1h and 3h steps
- __init__(self: shyft.hydrology.RadiationCalculator, param: shyft.hydrology.RadiationParameter) None¶
- net_radiation(self: shyft.hydrology.RadiationCalculator, response: shyft.hydrology.RadiationResponse, latitude: SupportsFloat | SupportsIndex, t1: shyft.time_series.time, dt: shyft.time_series.time, slope: SupportsFloat | SupportsIndex, aspect: SupportsFloat | SupportsIndex, temperature: SupportsFloat | SupportsIndex, rhumidity: SupportsFloat | SupportsIndex, elevation: SupportsFloat | SupportsIndex, rsm: SupportsFloat | SupportsIndex) None¶
calculates net radiation using either step or instantaneous method, updating response
- net_radiation_inst(self: shyft.hydrology.RadiationCalculator, response: shyft.hydrology.RadiationResponse, latitude: SupportsFloat | SupportsIndex, t: shyft.time_series.time, slope: SupportsFloat | SupportsIndex, aspect: SupportsFloat | SupportsIndex, temperature: SupportsFloat | SupportsIndex, rhumidity: SupportsFloat | SupportsIndex, elevation: SupportsFloat | SupportsIndex, rsm: SupportsFloat | SupportsIndex) None¶
calculates net radiation using instantaneous method, updating response
- net_radiation_step(self: shyft.hydrology.RadiationCalculator, response: shyft.hydrology.RadiationResponse, latitude: SupportsFloat | SupportsIndex, t1: shyft.time_series.time, dt: shyft.time_series.time, slope: SupportsFloat | SupportsIndex, aspect: SupportsFloat | SupportsIndex, temperature: SupportsFloat | SupportsIndex, rhumidity: SupportsFloat | SupportsIndex, elevation: SupportsFloat | SupportsIndex, rsm: SupportsFloat | SupportsIndex) None¶
calculates net radiation, updating response
- net_radiation_step_asce_st(self: shyft.hydrology.RadiationCalculator, response: shyft.hydrology.RadiationResponse, latitude: SupportsFloat | SupportsIndex, t1: shyft.time_series.time, dt: shyft.time_series.time, slope: SupportsFloat | SupportsIndex, aspect: SupportsFloat | SupportsIndex, temperature: SupportsFloat | SupportsIndex, rhumidity: SupportsFloat | SupportsIndex, elevation: SupportsFloat | SupportsIndex, rsm: SupportsFloat | SupportsIndex) None¶
calculates net radiation, updating response
- class shyft.hydrology.RadiationParameter(self: shyft.hydrology.RadiationParameter, albedo: SupportsFloat | SupportsIndex = 0.2, turbidity: SupportsFloat | SupportsIndex = 1.0)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.RadiationParameter, albedo: SupportsFloat | SupportsIndex = 0.2, turbidity: SupportsFloat | SupportsIndex = 1.0) None¶
- property albedo¶
typical value 0.2
- Type:
float
- property turbidity¶
typical value 1.0
- Type:
float
- class shyft.hydrology.RadiationResponse(self: shyft.hydrology.RadiationResponse)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.RadiationResponse) None¶
- property net¶
- Type:
float
- property net_lw¶
- Type:
float
- property net_sw¶
- Type:
float
- property ra¶
- Type:
float
- property sw_cs_p¶
- Type:
float
- property sw_t¶
- Type:
float
- shyft.hydrology.RadiationSource¶
alias of
GeoPointSource
- shyft.hydrology.RadiationSourceVector¶
alias of
GeoPointSourceVector
- class shyft.hydrology.RegionModelType(self: shyft.hydrology.RegionModelType, value: SupportsInt | SupportsIndex)¶
Bases:
pybind11_objectRef to DrmClient, used do specify what remote region-model type to create
Members:
PT_GS_K
PT_GS_K_OPT
PT_SS_K
PT_SS_K_OPT
PT_HS_K
PT_HS_K_OPT
PT_HPS_K
PT_HPS_K_OPT
R_PM_GS_K
R_PM_GS_K_OPT
PT_ST_K
PT_ST_K_OPT
PT_ST_HBV
PT_ST_HBV_OPT
R_PT_GS_K
R_PT_GS_K_OPT
R_PM_ST_K
R_PM_ST_K_OPT
R_PMV_ST_K
R_PMV_ST_K_OPT
PT_FSM2_K
- PT_FSM2_K = <RegionModelType.PT_FSM2_K: 20>¶
- PT_GS_K = <RegionModelType.PT_GS_K: 0>¶
- PT_GS_K_OPT = <RegionModelType.PT_GS_K_OPT: 1>¶
- PT_HPS_K = <RegionModelType.PT_HPS_K: 6>¶
- PT_HPS_K_OPT = <RegionModelType.PT_HPS_K_OPT: 7>¶
- PT_HS_K = <RegionModelType.PT_HS_K: 4>¶
- PT_HS_K_OPT = <RegionModelType.PT_HS_K_OPT: 5>¶
- PT_SS_K = <RegionModelType.PT_SS_K: 2>¶
- PT_SS_K_OPT = <RegionModelType.PT_SS_K_OPT: 3>¶
- PT_ST_HBV = <RegionModelType.PT_ST_HBV: 12>¶
- PT_ST_HBV_OPT = <RegionModelType.PT_ST_HBV_OPT: 13>¶
- PT_ST_K = <RegionModelType.PT_ST_K: 10>¶
- PT_ST_K_OPT = <RegionModelType.PT_ST_K_OPT: 11>¶
- R_PMV_ST_K = <RegionModelType.R_PMV_ST_K: 18>¶
- R_PMV_ST_K_OPT = <RegionModelType.R_PMV_ST_K_OPT: 19>¶
- R_PM_GS_K = <RegionModelType.R_PM_GS_K: 8>¶
- R_PM_GS_K_OPT = <RegionModelType.R_PM_GS_K_OPT: 9>¶
- R_PM_ST_K = <RegionModelType.R_PM_ST_K: 16>¶
- R_PM_ST_K_OPT = <RegionModelType.R_PM_ST_K_OPT: 17>¶
- R_PT_GS_K = <RegionModelType.R_PT_GS_K: 14>¶
- R_PT_GS_K_OPT = <RegionModelType.R_PT_GS_K_OPT: 15>¶
- __init__(self: shyft.hydrology.RegionModelType, value: SupportsInt | SupportsIndex) None¶
- RegionModelType.name -> str
- property value¶
- shyft.hydrology.RelHumSource¶
alias of
GeoPointSource
- shyft.hydrology.RelHumSourceVector¶
alias of
GeoPointSourceVector
- class shyft.hydrology.River(*args, **kwargs)¶
Bases:
pybind11_objectA river that we use for routing, its a single piece of a RiverNetwork
The routing river have flow from:
zero or more ‘cell_nodes’, typically a cell_model type, lateral flow,like cell.rc.average_discharge [m3/s]
zero or more upstream connected rivers, taking their .output_m3s()
then a routing river can optionally be connected to a down-stream river providing a routing function (currently just a convolution of a uhg).
This definition is recursive, and we use RiverNetwork to ensure the routing graph is directed and with no cycles.
Overloaded function.
__init__(self: shyft.hydrology.River) -> None
__init__(self: shyft.hydrology.River, id: typing.SupportsInt | typing.SupportsIndex, downstream: shyft.hydrology.RoutingInfo = RoutingInfo(id=0, distance=0), parameter: shyft.hydrology.UHGParameter = UHGParameter(velocity=1, alpha=7, beta=0)) -> None
a new object with specified parameters, notice that a valid river-id|routing-id must be >0
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.River) -> None
__init__(self: shyft.hydrology.River, id: typing.SupportsInt | typing.SupportsIndex, downstream: shyft.hydrology.RoutingInfo = RoutingInfo(id=0, distance=0), parameter: shyft.hydrology.UHGParameter = UHGParameter(velocity=1, alpha=7, beta=0)) -> None
a new object with specified parameters, notice that a valid river-id|routing-id must be >0
- property downstream¶
routing information for downstream, target-id, and hydrological distance
- Type:
- property id¶
a valid identifier >0 for the river|routing element
- Type:
int
- property parameter¶
describing the downstream propagation
- Type:
- uhg(self: shyft.hydrology.River, dt: shyft.time_series.time) list[float]¶
create the hydro-graph for this river, taking specified delta-t, dt, static hydrological distance as well as the shape parameters alpha and beta used to form the gamma-function. The length of the uhg (delay) is determined by the downstream-distance, and the velocity parameter. The shape of the uhg is determined by alpha&beta parameters.
- class shyft.hydrology.RiverNetwork(*args, **kwargs)¶
Bases:
pybind11_objectA RiverNetwork takes care of the routing see also description of River The RiverNetwork provides all needed functions to build routing into the region model It ensures safe manipulation of rivers:
no cycles,
no duplicate object-id’s etc.
Overloaded function.
__init__(self: shyft.hydrology.RiverNetwork) -> None
__init__(self: shyft.hydrology.RiverNetwork, clone: shyft.hydrology.RiverNetwork) -> None
make a clone of river-network
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.RiverNetwork) -> None
__init__(self: shyft.hydrology.RiverNetwork, clone: shyft.hydrology.RiverNetwork) -> None
make a clone of river-network
- add(self: shyft.hydrology.RiverNetwork, river: shyft.hydrology.River) shyft.hydrology.RiverNetwork¶
add a river to the network, verifies river id, no cycles etc.
raises exception on error tip: build your river-network from downstream to upstream order
- downstream_by_id(self: shyft.hydrology.RiverNetwork, id: SupportsInt | SupportsIndex) int¶
return id of downstream river, 0 if none
- network_contains_directed_cycle(self: shyft.hydrology.RiverNetwork) bool¶
True if network have cycles detected
- remove_by_id(self: shyft.hydrology.RiverNetwork, id: SupportsInt | SupportsIndex) None¶
disconnect and remove river for network
- river_by_id(self: shyft.hydrology.RiverNetwork, id: SupportsInt | SupportsIndex) shyft.hydrology.River¶
get river by id
- set_downstream_by_id(self: shyft.hydrology.RiverNetwork, id: SupportsInt | SupportsIndex, downstream_id: SupportsInt | SupportsIndex) None¶
set downstream target for specified river id
- upstreams_by_id(self: shyft.hydrology.RiverNetwork, id: SupportsInt | SupportsIndex) list[int]¶
returns a list(vector) of id of upstream rivers from the specified one
- class shyft.hydrology.RoutingInfo(self: shyft.hydrology.RoutingInfo, id: SupportsInt | SupportsIndex = 0, distance: SupportsFloat | SupportsIndex = 0.0)¶
Bases:
pybind11_objectDescribe the hydrological distance and the id of the target routing element (river)
- __init__(self: shyft.hydrology.RoutingInfo, id: SupportsInt | SupportsIndex = 0, distance: SupportsFloat | SupportsIndex = 0.0) None¶
- property distance¶
the hydrological distance, in unit of [m]
- Type:
float
- property id¶
id of the target,down-stream river
- Type:
int
- class shyft.hydrology.SkaugenCalculator¶
Bases:
pybind11_objectSkaugen snow model method
This algorithm uses theory from Skaugen
- __init__(*args, **kwargs)¶
- step(self: shyft.hydrology.SkaugenCalculator, delta_t: shyft.time_series.time, parameter: shyft.hydrology.SkaugenParameter, temperature: SupportsFloat | SupportsIndex, precipitation: SupportsFloat | SupportsIndex, radiation: SupportsFloat | SupportsIndex, wind_speed: SupportsFloat | SupportsIndex, state: shyft.hydrology.SkaugenState, response: shyft.hydrology.SkaugenResponse) None¶
steps the model forward delta_t seconds, using specified input, updating state and response
- class shyft.hydrology.SkaugenParameter(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.SkaugenParameter, alpha_0: typing.SupportsFloat | typing.SupportsIndex = 40.77, d_range: typing.SupportsFloat | typing.SupportsIndex = 113.0, unit_size: typing.SupportsFloat | typing.SupportsIndex = 0.1, max_water_fraction: typing.SupportsFloat | typing.SupportsIndex = 0.1, tx: typing.SupportsFloat | typing.SupportsIndex = 0.16, cx: typing.SupportsFloat | typing.SupportsIndex = 2.5, ts: typing.SupportsFloat | typing.SupportsIndex = 0.14, cfr: typing.SupportsFloat | typing.SupportsIndex = 0.01) -> None
__init__(self: shyft.hydrology.SkaugenParameter, p: shyft.hydrology.SkaugenParameter) -> None
create a clone of p
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.SkaugenParameter, alpha_0: typing.SupportsFloat | typing.SupportsIndex = 40.77, d_range: typing.SupportsFloat | typing.SupportsIndex = 113.0, unit_size: typing.SupportsFloat | typing.SupportsIndex = 0.1, max_water_fraction: typing.SupportsFloat | typing.SupportsIndex = 0.1, tx: typing.SupportsFloat | typing.SupportsIndex = 0.16, cx: typing.SupportsFloat | typing.SupportsIndex = 2.5, ts: typing.SupportsFloat | typing.SupportsIndex = 0.14, cfr: typing.SupportsFloat | typing.SupportsIndex = 0.01) -> None
__init__(self: shyft.hydrology.SkaugenParameter, p: shyft.hydrology.SkaugenParameter) -> None
create a clone of p
- property alpha_0¶
default = 40.77
- Type:
float
- property cfr¶
default = 0.01
- Type:
float
- property cx¶
default = 2.5
- Type:
float
- property d_range¶
default = 113.0
- Type:
float
- property max_water_fraction¶
default = 0.1
- Type:
float
- property ts¶
default = 0.14
- Type:
float
- property tx¶
default = 0.16
- Type:
float
- property unit_size¶
default = 0.1
- Type:
float
- class shyft.hydrology.SkaugenResponse¶
Bases:
pybind11_object- __init__(*args, **kwargs)¶
- property outflow¶
from snow-routine in [mm/h] over cell-area
- Type:
float
- property sca¶
snow-covered area in fraction
- Type:
float
- property swe¶
snow water equivalient [mm] over cell-area
- Type:
float
- property total_stored_water¶
same as swe(deprecated)
- Type:
float
- class shyft.hydrology.SkaugenState(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.SkaugenState, nu: typing.SupportsFloat | typing.SupportsIndex = 4.077, alpha: typing.SupportsFloat | typing.SupportsIndex = 40.77, sca: typing.SupportsFloat | typing.SupportsIndex = 0.0, swe: typing.SupportsFloat | typing.SupportsIndex = 0.0, free_water: typing.SupportsFloat | typing.SupportsIndex = 0.0, residual: typing.SupportsFloat | typing.SupportsIndex = 0.0, num_units: typing.SupportsFloat | typing.SupportsIndex = 0) -> None
__init__(self: shyft.hydrology.SkaugenState, s: shyft.hydrology.SkaugenState) -> None
create a clone of s
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.SkaugenState, nu: typing.SupportsFloat | typing.SupportsIndex = 4.077, alpha: typing.SupportsFloat | typing.SupportsIndex = 40.77, sca: typing.SupportsFloat | typing.SupportsIndex = 0.0, swe: typing.SupportsFloat | typing.SupportsIndex = 0.0, free_water: typing.SupportsFloat | typing.SupportsIndex = 0.0, residual: typing.SupportsFloat | typing.SupportsIndex = 0.0, num_units: typing.SupportsFloat | typing.SupportsIndex = 0) -> None
__init__(self: shyft.hydrology.SkaugenState, s: shyft.hydrology.SkaugenState) -> None
create a clone of s
- property alpha¶
- Type:
float
- property free_water¶
- Type:
float
- property nu¶
- Type:
float
- property num_units¶
- Type:
int
- property residual¶
- Type:
float
- property sca¶
- Type:
float
- property swe¶
- Type:
float
- class shyft.hydrology.SnowTilesCalculator(self: shyft.hydrology.SnowTilesCalculator, parameter: shyft.hydrology.SnowTilesParameter)¶
Bases:
pybind11_objectTile based snow model method
This algorithm uses …
- __init__(self: shyft.hydrology.SnowTilesCalculator, parameter: shyft.hydrology.SnowTilesParameter) None¶
- step(self: shyft.hydrology.SnowTilesCalculator, state: shyft.hydrology.SnowTilesState, response: shyft.hydrology.SnowTilesResponse, t0: shyft.time_series.time, t1: shyft.time_series.time, precipitation: SupportsFloat | SupportsIndex, temperature: SupportsFloat | SupportsIndex) None¶
steps the model forward from t0 to t1, updating state and response
- class shyft.hydrology.SnowTilesParameter(self: shyft.hydrology.SnowTilesParameter, shape: SupportsFloat | SupportsIndex = 2.0, tx: SupportsFloat | SupportsIndex = 0.0, cx: SupportsFloat | SupportsIndex = 1.0, ts: SupportsFloat | SupportsIndex = 0.0, lwmax: SupportsFloat | SupportsIndex = 0.1, cfr: SupportsFloat | SupportsIndex = 0.5, area_fractions: collections.abc.Sequence[SupportsFloat | SupportsIndex] = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1])¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.SnowTilesParameter, shape: SupportsFloat | SupportsIndex = 2.0, tx: SupportsFloat | SupportsIndex = 0.0, cx: SupportsFloat | SupportsIndex = 1.0, ts: SupportsFloat | SupportsIndex = 0.0, lwmax: SupportsFloat | SupportsIndex = 0.1, cfr: SupportsFloat | SupportsIndex = 0.5, area_fractions: collections.abc.Sequence[SupportsFloat | SupportsIndex] = [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1]) None¶
- property area_fractions¶
area fractions of the individual tiles, unit (-), range per tile [0.01, 1], the sum of the elements in the vector must equal 1
- Type:
DoubleVector
- property cfr¶
refreeze coefficient, unit (-), range [0, 1]
- Type:
float
- property cx¶
degree-day melt factor, unit (mm/C/day), range [0, 30]
- Type:
float
- property lwmax¶
max liquid water content given as a fraction of ice in the snowpack, unit (-), range [0, 1]
- Type:
float
- property shape¶
shape parameter of the Gamma distribution defining the multiplication factors for snowfall, unit (-), range [0.1, inf]
- Type:
float
- property ts¶
threshold temperature for melt onset, unit (C), range [-4, 4]
- Type:
float
- property tx¶
threshold temperature determining precipitation phase, unit (C), range [-4, 4]
- Type:
float
- class shyft.hydrology.SnowTilesResponse(self: shyft.hydrology.SnowTilesResponse)¶
Bases:
pybind11_object- __init__(self: shyft.hydrology.SnowTilesResponse) None¶
- property outflow¶
average outflow, rain and snowmelt, for the cell, unit (mm/hour)
- property sca¶
average sca as a fraction of total cell area, unit (-)
- Type:
float
- property swe¶
average swe for the cell, unit (mm)
- Type:
float
- class shyft.hydrology.SnowTilesState(*args, **kwargs)¶
Bases:
pybind11_objectOverloaded function.
__init__(self: shyft.hydrology.SnowTilesState) -> None
__init__(self: shyft.hydrology.SnowTilesState, fw: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], lw: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex]) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.SnowTilesState) -> None
__init__(self: shyft.hydrology.SnowTilesState, fw: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex], lw: collections.abc.Sequence[typing.SupportsFloat | typing.SupportsIndex]) -> None
- property fw¶
frozen water in the snowpack, unit (mm)
- Type:
DoubleVector
- property lw¶
liquid water in the snowpack, unit (mm)
- Type:
DoubleVector
- class shyft.hydrology.StateClient(self: shyft.hydrology.StateClient, host_port: str, timeout_ms: SupportsInt | SupportsIndex, operation_timeout_ms: SupportsInt | SupportsIndex = 0)¶
Bases:
pybind11_objectThe client api for the shyft.hydrology state model service.
Creates a python client that can communicate with the corresponding server
- __init__(self: shyft.hydrology.StateClient, host_port: str, timeout_ms: SupportsInt | SupportsIndex, operation_timeout_ms: SupportsInt | SupportsIndex = 0) None¶
Creates a python client that can communicate with the corresponding server
- close(self: shyft.hydrology.StateClient) None¶
Close the connection. It will automatically reopen if needed.
- get_model_infos(self: shyft.hydrology.StateClient, mids: collections.abc.Sequence[SupportsInt | SupportsIndex], created_in: shyft.time_series.UtcPeriod = UtcPeriod()) list[shyft.time_series.ModelInfo]¶
returns all or selected model-info objects based on model-identifiers(mids)
- Parameters:
mids (IntVector) – empty = all, or a list of known exisiting model-identifiers
created_in (UtcPeriod) – For which period you are interested in model-infos.
- Returns:
model_infos. Strongly typed list of ModelInfo
- Return type:
ModelInfoVector
- property host_port¶
Endpoint network address of the remote server.
- Type:
str
- property is_open¶
If the connection to the remote server is (still) open.
- Type:
bool
- property operation_timeout_ms¶
Operation timeout for remote server operations, in number milliseconds.
- Type:
int
- read_model(self: shyft.hydrology.StateClient, mid: SupportsInt | SupportsIndex) shyft.hydrology.StateModel¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting model from the server
- Return type:
- read_models(self: shyft.hydrology.StateClient, mids: collections.abc.Sequence[SupportsInt | SupportsIndex]) shyft.hydrology.StateModelVector¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mids (list[int]) – A strongly typed list of ints, the model-identifers for the wanted models
- Returns:
The resulting model from the server
- Return type:
- property reconnect_count¶
Number of reconnects to the remote server that have been performed.
- Type:
int
- remove_model(self: shyft.hydrology.StateClient, mid: SupportsInt | SupportsIndex) int¶
Remove the specified model bymodel-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
ec. 0 or error-code?
- Return type:
int
- store_model(self: shyft.hydrology.StateClient, m: shyft.hydrology.StateModel, mi: shyft.time_series.ModelInfo) int¶
Store the model to backend, if m.id==0 then a new unique model-info is created and used
- property timeout_ms¶
Timout for remote server operations, in number milliseconds.
- Type:
int
- update_model_info(self: shyft.hydrology.StateClient, mid: SupportsInt | SupportsIndex, mi: shyft.time_series.ModelInfo) bool¶
Update the model-info for specified model-identifier(mid)
- Parameters:
mid (int) – model-identifer
mi (ModelInfo) – The new updated model-info
- Returns:
ok. true if success
- Return type:
bool
- class shyft.hydrology.StateModel(self: shyft.hydrology.StateModel)¶
Bases:
pybind11_objectA model identifier and a StateVector, where the vector can keep an uniform set of StateId of specified type
- __init__(self: shyft.hydrology.StateModel) None¶
- property id¶
unique model id
- Type:
int
- property states¶
- class shyft.hydrology.StateModelVector(*args, **kwargs)¶
Bases:
pybind11_objectA strongly typed list of StateModel’s
Overloaded function.
__init__(self: shyft.hydrology.StateModelVector) -> None
__init__(self: shyft.hydrology.StateModelVector, arg0: shyft.hydrology.StateModelVector) -> None
Copy constructor
__init__(self: shyft.hydrology.StateModelVector, arg0: collections.abc.Iterable) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.StateModelVector) -> None
__init__(self: shyft.hydrology.StateModelVector, arg0: shyft.hydrology.StateModelVector) -> None
Copy constructor
__init__(self: shyft.hydrology.StateModelVector, arg0: collections.abc.Iterable) -> None
- append(self: shyft.hydrology.StateModelVector, x: shyft.hydrology.StateModel) None¶
Add an item to the end of the list
- clear(self: shyft.hydrology.StateModelVector) None¶
Clear the contents
- extend(*args, **kwargs)¶
Overloaded function.
extend(self: shyft.hydrology.StateModelVector, L: shyft.hydrology.StateModelVector) -> None
Extend the list by appending all the items in the given list
extend(self: shyft.hydrology.StateModelVector, L: collections.abc.Iterable) -> None
Extend the list by appending all the items in the given list
- insert(self: shyft.hydrology.StateModelVector, i: SupportsInt | SupportsIndex, x: shyft.hydrology.StateModel) None¶
Insert an item at a given position.
- pop(*args, **kwargs)¶
Overloaded function.
pop(self: shyft.hydrology.StateModelVector) -> shyft.hydrology.StateModel
Remove and return the last item
pop(self: shyft.hydrology.StateModelVector, i: typing.SupportsInt | typing.SupportsIndex) -> shyft.hydrology.StateModel
Remove and return the item at index
i
- size(self: shyft.hydrology.StateModelVector) int¶
- class shyft.hydrology.StateServer(self: shyft.hydrology.StateServer, root_dir: str, config: shyft.time_series.ServerConfig = shyft.time_series.ServerConfig(stale_duration='1970-01-01T01:00:00Z', stale_sweep_interval='1970-01-01T00:00:00.100000Z', log=shyft.time_series.LogConfig(file='', level=200)))¶
Bases:
pybind11_objectThe server-side component for the shyft.hydrology state model repository.
Creates a server object that serves models from root_dir. The root_dir will be create if it does not exists.
- Parameters:
root_dir (str) – Path to the root-directory that keeps/will keep the model-files
config (ServerConfig) – Configuration of the server
- __init__(self: shyft.hydrology.StateServer, root_dir: str, config: shyft.time_series.ServerConfig = shyft.time_series.ServerConfig(stale_duration='1970-01-01T01:00:00Z', stale_sweep_interval='1970-01-01T00:00:00.100000Z', log=shyft.time_series.LogConfig(file='', level=200))) None¶
Creates a server object that serves models from root_dir. The root_dir will be create if it does not exists.
- Parameters:
root_dir (str) – Path to the root-directory that keeps/will keep the model-files
config (ServerConfig) – Configuration of the server
- get_listening_port(self: shyft.hydrology.StateServer) int¶
returns the port number it’s listening at for serving incoming request
- get_max_connections(self: shyft.hydrology.StateServer) int¶
returns the maximum number of connections to be served concurrently
- get_model_infos(self: shyft.hydrology.StateServer, mids: collections.abc.Sequence[SupportsInt | SupportsIndex], created_in: shyft.time_series.UtcPeriod = UtcPeriod()) list[shyft.time_series.ModelInfo]¶
returns all or selected model-info objects based on model-identifiers(mids)
- Parameters:
mids (IntVector) – empty = all, or a list of known exisiting model-identifiers
created_in (UtcPeriod) – For which period you are interested in model-infos.
- Returns:
model_infos. Strongly typed list of ModelInfo
- Return type:
ModelInfoVector
- is_running(self: shyft.hydrology.StateServer) bool¶
true if server is listening and running
See also
start_server()
- read_model(self: shyft.hydrology.StateServer, mid: SupportsInt | SupportsIndex) shyft.hydrology.StateModel¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting model from the server
- Return type:
- read_model_blob(self: shyft.hydrology.StateServer, mid: SupportsInt | SupportsIndex) shyft.time_series.ByteVector¶
Read and return the model blob for specified model-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
The resulting blob model from the server
- Return type:
ByteVector
- read_models(self: shyft.hydrology.StateServer, mids: collections.abc.Sequence[SupportsInt | SupportsIndex]) shyft.hydrology.StateModelVector¶
Read and return the model for specified model-identifier (mid)
- Parameters:
mids (list[int]) – A strongly typed list of ints, the model-identifers for the wanted models
- Returns:
The resulting model from the server
- Return type:
- remove_model(self: shyft.hydrology.StateServer, mid: SupportsInt | SupportsIndex) int¶
Remove the specified model bymodel-identifier (mid)
- Parameters:
mid (int) – the model-identifer for the wanted model
- Returns:
ec. 0 or error-code?
- Return type:
int
- set_listening_ip(self: shyft.hydrology.StateServer, ip: str) None¶
set the listening port for the service
- Parameters:
ip (str) – ip or host-name to start listening on
- Returns:
nothing.
- Return type:
None
- set_listening_port(self: shyft.hydrology.StateServer, port_no: SupportsInt | SupportsIndex) None¶
set the listening port for the service
- Parameters:
port_no (int) – a valid and available tcp-ip port number to listen on.
20000 (typically it could be)
- Returns:
nothing.
- Return type:
None
- set_max_connections(self: shyft.hydrology.StateServer, max_connect: SupportsInt | SupportsIndex) None¶
limits simultaneous connections to the server (it’s multithreaded, and uses on thread pr. connect)
- Parameters:
max_connect (int) – maximum number of connections before denying more connections
See also
get_max_connections()
- property stale_connection_close_count¶
returns count of connection closed due to stale/no communication activity
- Type:
int
- start_server(self: shyft.hydrology.StateServer) int¶
start server listening in background, and processing messages
See also
set_listening_port(port_no),is_running
- Returns:
port_no. the port used for listening operations, either the value as by set_listening_port, or if it was unspecified, a new available port
- Return type:
in
- stop_server(self: shyft.hydrology.StateServer, timeout: SupportsInt | SupportsIndex = 1000) None¶
stop serving connections, gracefully.
See also
start_server()
- store_model(self: shyft.hydrology.StateServer, m: shyft.hydrology.StateModel, mi: shyft.time_series.ModelInfo) int¶
Store the model to backend, if m.id==0 then a new unique model-info is created and used
- update_model_info(self: shyft.hydrology.StateServer, mid: SupportsInt | SupportsIndex, mi: shyft.time_series.ModelInfo) bool¶
Update the model-info for specified model-identifier(mid)
- Parameters:
mid (int) – model-identifer
mi (ModelInfo) – The new updated model-info
- Returns:
ok. true if success
- Return type:
bool
- class shyft.hydrology.TargetSpecCalcType(self: shyft.hydrology.TargetSpecCalcType, value: SupportsInt | SupportsIndex)¶
Bases:
pybind11_objectMembers:
NASH_SUTCLIFFE
KLING_GUPTA
ABS_DIFF
RMSE
- ABS_DIFF = <TargetSpecCalcType.ABS_DIFF: 2>¶
- KLING_GUPTA = <TargetSpecCalcType.KLING_GUPTA: 1>¶
- NASH_SUTCLIFFE = <TargetSpecCalcType.NASH_SUTCLIFFE: 0>¶
- RMSE = <TargetSpecCalcType.RMSE: 3>¶
- __init__(self: shyft.hydrology.TargetSpecCalcType, value: SupportsInt | SupportsIndex) None¶
- TargetSpecCalcType.name -> str
- property value¶
- class shyft.hydrology.TargetSpecificationPts(*args, **kwargs)¶
Bases:
pybind11_objectTo guide the model calibration, we have a goal-function that we try to minimize This class contains the needed specification of this goal-function so that we can:
from simulations, collect time-series at catchment level for (DISCHARGE|SNOW_COVERED_AREA|SNOW_WATER_EQUIVALENT)
from observations, have a user-specified series the expression above should be equal to
use user specified kling-gupta factors to evaluate kind-of-difference between target and simulated
scale-factor to put a weight on this specific target-specification compared to other(we can have multiple)
a user specified id, uid, a string to identify the external source for calibration
a user specified time-series expression with symbolic ref to sim, like TimeSeries(‘sim’).log()
Overloaded function.
__init__(self: shyft.hydrology.TargetSpecificationPts) -> None
__init__(self: shyft.hydrology.TargetSpecificationPts, ts: shyft.time_series.TsFixed, cids: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], scale_factor: typing.SupportsFloat | typing.SupportsIndex, calc_mode: shyft.hydrology.TargetSpecCalcType, s_r: typing.SupportsFloat | typing.SupportsIndex, s_a: typing.SupportsFloat | typing.SupportsIndex, s_b: typing.SupportsFloat | typing.SupportsIndex, catchment_property: shyft.hydrology.CatchmentPropertyType, uid: str) -> None
construct a target specification filled in with supplied parameters
- Parameters:
ts (TsFixed) – time-series containing the target time-series
cids (IntVector) – A list of catchment id’s(cids) that together adds up into same as the target-ts
scale_factor (float) – the weight of this target-specification
calc_mode (TargetSpecCalcType) – specifies how to calculate the goal function, NS, KG, Abs,RMSE method
s_r (float) – KG scalefactor for correlation
s_a (float) – KG scalefactor for alpha(variance)
s_b (float) – KG scalefactor for beta(bias)
catchment_property (CatchmentPropertyType) – what to extract from catchment(DISCHARGE|SNOW_COVERED_AREA|SNOW_WATER_EQUIVALENT|ROUTED_DISCHARGE|CELL_CHARGE)
uid (str) – user specified string/id to help integration efforts
__init__(self: shyft.hydrology.TargetSpecificationPts, ts: shyft.time_series.TimeSeries, cids: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], scale_factor: typing.SupportsFloat | typing.SupportsIndex, calc_mode: shyft.hydrology.TargetSpecCalcType, s_r: typing.SupportsFloat | typing.SupportsIndex, s_a: typing.SupportsFloat | typing.SupportsIndex, s_b: typing.SupportsFloat | typing.SupportsIndex, catchment_property: shyft.hydrology.CatchmentPropertyType, uid: str) -> None
construct a target specification filled in with supplied parameters
- Parameters:
ts (TimeSeries) – time-series containing the target time-series, note that the time-axis of this ts must be a fixed-interval type
cids (IntVector) – A list of catchment id’s(cids) that together adds up into same as the target-ts
scale_factor (float) – the weight of this target-specification
calc_mode (TargetSpecCalcType) – specifies how to calculate the goal function, NS, KG, Abs method
s_r (float) – KG scalefactor for correlation
s_a (float) – KG scalefactor for alpha(variance)
s_b (float) – KG scalefactor for beta(bias)
catchment_property (CatchmentPropertyType) – what to extract from catchment(DISCHARGE|SNOW_COVERED_AREA|SNOW_WATER_EQUIVALENT|ROUTED_DISCHARGE|CELL_CHARGE)
uid (str) – user specified string/id to help integration efforts
__init__(self: shyft.hydrology.TargetSpecificationPts, ts: shyft.time_series.TsFixed, cids: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], scale_factor: typing.SupportsFloat | typing.SupportsIndex, calc_mode: shyft.hydrology.TargetSpecCalcType) -> None
construct a target specification filled in with supplied parameters
- Parameters:
ts (TsFixed) – time-series containing the target time-series
cids (IntVector) – A list of catchment id’s(cids) that together adds up into same as the target-ts
scale_factor (float) – the weight of this target-specification
calc_mode (TargetSpecCalcType) – specifies how to calculate the goal function, NS, KG, Abs method
__init__(self: shyft.hydrology.TargetSpecificationPts, ts: shyft.time_series.TimeSeries, cids: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], scale_factor: typing.SupportsFloat | typing.SupportsIndex, calc_mode: shyft.hydrology.TargetSpecCalcType) -> None
construct a target specification filled in with supplied parameters
- Parameters:
ts (TimeSeries) – time-series containing the target time-series, note the time-axis needs to be fixed_dt!
cids (IntVector) – A list of catchment id’s(cids) that together adds up into same as the target-ts
scale_factor (float) – the weight of this target-specification
calc_mode (TargetSpecCalcType) – specifies how to calculate the goal function, NS, KG, Abs method
__init__(self: shyft.hydrology.TargetSpecificationPts, ts: shyft.time_series.TsFixed, rid: typing.SupportsInt | typing.SupportsIndex, scale_factor: typing.SupportsFloat | typing.SupportsIndex, calc_mode: shyft.hydrology.TargetSpecCalcType, s_r: typing.SupportsFloat | typing.SupportsIndex, s_a: typing.SupportsFloat | typing.SupportsIndex, s_b: typing.SupportsFloat | typing.SupportsIndex, uid: str) -> None
construct a target specification filled in with supplied parameters
- Parameters:
ts (TsFixed) – time-series containing the target time-series
rid (int) – A river-id identifying the point of flow in the river-network
scale_factor (float) – the weight of this target-specification
calc_mode (TargetSpecCalcType) – specifies how to calculate the goal function, NS, KG, Abs method
s_r (float) – KG scalefactor for correlation
s_a (float) – KG scalefactor for alpha(variance)
s_b (float) – KG scalefactor for beta(bias)
uid (str) – user specified string/id to help integration efforts
__init__(self: shyft.hydrology.TargetSpecificationPts, ts: shyft.time_series.TimeSeries, rid: typing.SupportsInt | typing.SupportsIndex, scale_factor: typing.SupportsFloat | typing.SupportsIndex, calc_mode: shyft.hydrology.TargetSpecCalcType, s_r: typing.SupportsFloat | typing.SupportsIndex, s_a: typing.SupportsFloat | typing.SupportsIndex, s_b: typing.SupportsFloat | typing.SupportsIndex, uid: str) -> None
construct a target specification filled in with supplied parameters
- Parameters:
ts (TimeSeries) – time-series containing the target time-series, note time-axis required to be fixed-dt type
rid (int) – A river-id identifying the point of flow in the river-network
scale_factor (float) – the weight of this target-specification
calc_mode (TargetSpecCalcType) – specifies how to calculate the goal function, NS, KG, Abs method
s_r (float) – KG scalefactor for correlation
s_a (float) – KG scalefactor for alpha(variance)
s_b (float) – KG scalefactor for beta(bias)
uid (str) – user specified string/id to help integration efforts
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.TargetSpecificationPts) -> None
__init__(self: shyft.hydrology.TargetSpecificationPts, ts: shyft.time_series.TsFixed, cids: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], scale_factor: typing.SupportsFloat | typing.SupportsIndex, calc_mode: shyft.hydrology.TargetSpecCalcType, s_r: typing.SupportsFloat | typing.SupportsIndex, s_a: typing.SupportsFloat | typing.SupportsIndex, s_b: typing.SupportsFloat | typing.SupportsIndex, catchment_property: shyft.hydrology.CatchmentPropertyType, uid: str) -> None
construct a target specification filled in with supplied parameters
- Parameters:
ts (TsFixed) – time-series containing the target time-series
cids (IntVector) – A list of catchment id’s(cids) that together adds up into same as the target-ts
scale_factor (float) – the weight of this target-specification
calc_mode (TargetSpecCalcType) – specifies how to calculate the goal function, NS, KG, Abs,RMSE method
s_r (float) – KG scalefactor for correlation
s_a (float) – KG scalefactor for alpha(variance)
s_b (float) – KG scalefactor for beta(bias)
catchment_property (CatchmentPropertyType) – what to extract from catchment(DISCHARGE|SNOW_COVERED_AREA|SNOW_WATER_EQUIVALENT|ROUTED_DISCHARGE|CELL_CHARGE)
uid (str) – user specified string/id to help integration efforts
__init__(self: shyft.hydrology.TargetSpecificationPts, ts: shyft.time_series.TimeSeries, cids: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], scale_factor: typing.SupportsFloat | typing.SupportsIndex, calc_mode: shyft.hydrology.TargetSpecCalcType, s_r: typing.SupportsFloat | typing.SupportsIndex, s_a: typing.SupportsFloat | typing.SupportsIndex, s_b: typing.SupportsFloat | typing.SupportsIndex, catchment_property: shyft.hydrology.CatchmentPropertyType, uid: str) -> None
construct a target specification filled in with supplied parameters
- Parameters:
ts (TimeSeries) – time-series containing the target time-series, note that the time-axis of this ts must be a fixed-interval type
cids (IntVector) – A list of catchment id’s(cids) that together adds up into same as the target-ts
scale_factor (float) – the weight of this target-specification
calc_mode (TargetSpecCalcType) – specifies how to calculate the goal function, NS, KG, Abs method
s_r (float) – KG scalefactor for correlation
s_a (float) – KG scalefactor for alpha(variance)
s_b (float) – KG scalefactor for beta(bias)
catchment_property (CatchmentPropertyType) – what to extract from catchment(DISCHARGE|SNOW_COVERED_AREA|SNOW_WATER_EQUIVALENT|ROUTED_DISCHARGE|CELL_CHARGE)
uid (str) – user specified string/id to help integration efforts
__init__(self: shyft.hydrology.TargetSpecificationPts, ts: shyft.time_series.TsFixed, cids: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], scale_factor: typing.SupportsFloat | typing.SupportsIndex, calc_mode: shyft.hydrology.TargetSpecCalcType) -> None
construct a target specification filled in with supplied parameters
- Parameters:
ts (TsFixed) – time-series containing the target time-series
cids (IntVector) – A list of catchment id’s(cids) that together adds up into same as the target-ts
scale_factor (float) – the weight of this target-specification
calc_mode (TargetSpecCalcType) – specifies how to calculate the goal function, NS, KG, Abs method
__init__(self: shyft.hydrology.TargetSpecificationPts, ts: shyft.time_series.TimeSeries, cids: collections.abc.Sequence[typing.SupportsInt | typing.SupportsIndex], scale_factor: typing.SupportsFloat | typing.SupportsIndex, calc_mode: shyft.hydrology.TargetSpecCalcType) -> None
construct a target specification filled in with supplied parameters
- Parameters:
ts (TimeSeries) – time-series containing the target time-series, note the time-axis needs to be fixed_dt!
cids (IntVector) – A list of catchment id’s(cids) that together adds up into same as the target-ts
scale_factor (float) – the weight of this target-specification
calc_mode (TargetSpecCalcType) – specifies how to calculate the goal function, NS, KG, Abs method
__init__(self: shyft.hydrology.TargetSpecificationPts, ts: shyft.time_series.TsFixed, rid: typing.SupportsInt | typing.SupportsIndex, scale_factor: typing.SupportsFloat | typing.SupportsIndex, calc_mode: shyft.hydrology.TargetSpecCalcType, s_r: typing.SupportsFloat | typing.SupportsIndex, s_a: typing.SupportsFloat | typing.SupportsIndex, s_b: typing.SupportsFloat | typing.SupportsIndex, uid: str) -> None
construct a target specification filled in with supplied parameters
- Parameters:
ts (TsFixed) – time-series containing the target time-series
rid (int) – A river-id identifying the point of flow in the river-network
scale_factor (float) – the weight of this target-specification
calc_mode (TargetSpecCalcType) – specifies how to calculate the goal function, NS, KG, Abs method
s_r (float) – KG scalefactor for correlation
s_a (float) – KG scalefactor for alpha(variance)
s_b (float) – KG scalefactor for beta(bias)
uid (str) – user specified string/id to help integration efforts
__init__(self: shyft.hydrology.TargetSpecificationPts, ts: shyft.time_series.TimeSeries, rid: typing.SupportsInt | typing.SupportsIndex, scale_factor: typing.SupportsFloat | typing.SupportsIndex, calc_mode: shyft.hydrology.TargetSpecCalcType, s_r: typing.SupportsFloat | typing.SupportsIndex, s_a: typing.SupportsFloat | typing.SupportsIndex, s_b: typing.SupportsFloat | typing.SupportsIndex, uid: str) -> None
construct a target specification filled in with supplied parameters
- Parameters:
ts (TimeSeries) – time-series containing the target time-series, note time-axis required to be fixed-dt type
rid (int) – A river-id identifying the point of flow in the river-network
scale_factor (float) – the weight of this target-specification
calc_mode (TargetSpecCalcType) – specifies how to calculate the goal function, NS, KG, Abs method
s_r (float) – KG scalefactor for correlation
s_a (float) – KG scalefactor for alpha(variance)
s_b (float) – KG scalefactor for beta(bias)
uid (str) – user specified string/id to help integration efforts
- property calc_mode¶
NASH_SUTCLIFFE, KLING_GUPTA,ABS_DIFF,RMSE
- Type:
- property catchment_indexes¶
catchment indexes, ‘cids’
- Type:
IntVector
- property catchment_property¶
DISCHARGE,SNOW_COVERED_AREA, SNOW_WATER_EQUIVALENT
- Type:
- evaluate_fx(self: shyft.hydrology.TargetSpecificationPts, ts: shyft.time_series.TimeSeries) shyft.time_series.TimeSeries¶
Compute the evaluated result using the fx expression.
- Parameters:
ts (TimeSeries)
- Returns:
result. The evaluated result using the passed time-series as substitute to symbolic reference(s).
- Return type:
- property fx¶
TimeSeries(‘sim’).log()
- Type:
- Type:
an expression to be applied to the simulated ts, e.g.
- property river_id¶
river identifier for routed discharge calibration
- Type:
int
- property s_a¶
KG-scalefactor for alpha (variance)
- Type:
float
- property s_b¶
KG-scalefactor for beta (bias)
- Type:
float
- property s_r¶
KG-scalefactor for correlation
- Type:
float
- property scale_factor¶
the scale factor to be used when considering multiple target_specifications
- Type:
float
- property ts¶
target ts
- Type:
- property uid¶
string
- Type:
str
- Type:
user specified identifier
- class shyft.hydrology.TargetSpecificationVector(*args, **kwargs)¶
Bases:
pybind11_objectA list of (weighted) target specifications to be used for model calibration
Overloaded function.
__init__(self: shyft.hydrology.TargetSpecificationVector) -> None
__init__(self: shyft.hydrology.TargetSpecificationVector, arg0: shyft.hydrology.TargetSpecificationVector) -> None
Copy constructor
__init__(self: shyft.hydrology.TargetSpecificationVector, arg0: collections.abc.Iterable) -> None
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: shyft.hydrology.TargetSpecificationVector) -> None
__init__(self: shyft.hydrology.TargetSpecificationVector, arg0: shyft.hydrology.TargetSpecificationVector) -> None
Copy constructor
__init__(self: shyft.hydrology.TargetSpecificationVector, arg0: collections.abc.Iterable) -> None
- append(self: shyft.hydrology.TargetSpecificationVector, x: shyft.hydrology.TargetSpecificationPts) None¶
Add an item to the end of the list
- clear(self: shyft.hydrology.TargetSpecificationVector) None¶
Clear the contents
- extend(*args, **kwargs)¶
Overloaded function.
extend(self: shyft.hydrology.TargetSpecificationVector, L: shyft.hydrology.TargetSpecificationVector) -> None
Extend the list by appending all the items in the given list
extend(self: shyft.hydrology.TargetSpecificationVector, L: collections.abc.Iterable) -> None
Extend the list by appending all the items in the given list
- insert(self: shyft.hydrology.TargetSpecificationVector, i: SupportsInt | SupportsIndex, x: shyft.hydrology.TargetSpecificationPts) None¶
Insert an item at a given position.
- pop(*args, **kwargs)¶
Overloaded function.
pop(self: shyft.hydrology.TargetSpecificationVector) -> shyft.hydrology.TargetSpecificationPts
Remove and return the last item
pop(self: shyft.hydrology.TargetSpecificationVector, i: typing.SupportsInt | typing.SupportsIndex) -> shyft.hydrology.TargetSpecificationPts
Remove and return the item at index
i
- size(self: shyft.hydrology.TargetSpecificationVector) int¶
- shyft.hydrology.TemperatureSource¶
alias of
GeoPointSource
- shyft.hydrology.TemperatureSourceVector¶
alias of
GeoPointSourceVector
- class shyft.hydrology.TsTransform(self: shyft.hydrology.TsTransform)¶
Bases:
pybind11_objecttransform the supplied time-series, f(t) interpreted according to its point_interpretation() policy into a new shyft core TsFixed time-series, that represents the true average for each of the n intervals of length dt, starting at start. the result ts will have the policy is set to POINT_AVERAGE_VALUE note: that the resulting ts is a fresh new ts, not connected to the source ts
- __init__(self: shyft.hydrology.TsTransform) None¶
- to_average(*args, **kwargs)¶
Overloaded function.
to_average(self: shyft.hydrology.TsTransform, start: shyft.time_series.time, dt: shyft.time_series.time, n: typing.SupportsInt | typing.SupportsIndex, src: shyft.time_series.TimeSeries) -> shyft.time_series.TsFixed
to_average(self: shyft.hydrology.TsTransform, start: shyft.time_series.time, dt: shyft.time_series.time, n: typing.SupportsInt | typing.SupportsIndex, src: shyft.time_series.TimeSeries) -> shyft.time_series.TsFixed
to_average(self: shyft.hydrology.TsTransform, start: shyft.time_series.time, dt: shyft.time_series.time, n: typing.SupportsInt | typing.SupportsIndex, src: shyft.time_series.TsFixed) -> shyft.time_series.TsFixed
to_average(self: shyft.hydrology.TsTransform, start: shyft.time_series.time, dt: shyft.time_series.time, n: typing.SupportsInt | typing.SupportsIndex, src: shyft.time_series.TsFixed) -> shyft.time_series.TsFixed
to_average(self: shyft.hydrology.TsTransform, start: typing.SupportsInt | typing.SupportsIndex, dt: typing.SupportsInt | typing.SupportsIndex, n: typing.SupportsInt | typing.SupportsIndex, src: shyft.time_series.TimeSeries) -> shyft.time_series.TsFixed
to_average(self: shyft.hydrology.TsTransform, start: typing.SupportsInt | typing.SupportsIndex, dt: typing.SupportsInt | typing.SupportsIndex, n: typing.SupportsInt | typing.SupportsIndex, src: shyft.time_series.TimeSeries) -> shyft.time_series.TsFixed
to_average(self: shyft.hydrology.TsTransform, start: typing.SupportsInt | typing.SupportsIndex, dt: typing.SupportsInt | typing.SupportsIndex, n: typing.SupportsInt | typing.SupportsIndex, src: shyft.time_series.TsFixed) -> shyft.time_series.TsFixed
to_average(self: shyft.hydrology.TsTransform, start: typing.SupportsInt | typing.SupportsIndex, dt: typing.SupportsInt | typing.SupportsIndex, n: typing.SupportsInt | typing.SupportsIndex, src: shyft.time_series.TsFixed) -> shyft.time_series.TsFixed
- class shyft.hydrology.UHGParameter(self: shyft.hydrology.UHGParameter, velocity: SupportsFloat | SupportsIndex = 1.0, alpha: SupportsFloat | SupportsIndex = 7.0, beta: SupportsFloat | SupportsIndex = 0.0)¶
Bases:
pybind11_objectThe Unit Hydro Graph Parameter contains sufficient description to create a unit hydro graph, that have a shape and a discretized ‘time-length’ according to the model time-step resolution. Currently we use a gamma function for the shape: <a ref=’https://en.wikipedia.org/wiki/Gamma_distribution’>gamma distribution</a>
- __init__(self: shyft.hydrology.UHGParameter, velocity: SupportsFloat | SupportsIndex = 1.0, alpha: SupportsFloat | SupportsIndex = 7.0, beta: SupportsFloat | SupportsIndex = 0.0) None¶
- property alpha¶
default 3.0,unit-less, ref. shape of gamma-function
- Type:
float
- property beta¶
default 0.0, unit-less, added to pdf of gamma(alpha,1.0)
- Type:
float
- property velocity¶
default 1.0, unit [m/s]
- Type:
float
- shyft.hydrology.WindSpeedSource¶
alias of
GeoPointSource
- shyft.hydrology.WindSpeedSourceVector¶
alias of
GeoPointSourceVector
- shyft.hydrology.bayesian_kriging_temperature(src: shyft.hydrology.GeoPointSourceVector, dst: shyft.time_series.GeoPointVector, time_axis: shyft.time_series.TimeAxisFixedDeltaT, btk_parameter: shyft.hydrology.BTKParameter) shyft.hydrology.GeoPointSourceVector¶
Runs kriging for temperature sources and project the temperatures out to the destination geo-timeseries
Notice that bayesian kriging is currently not very efficient for large grid inputs, using only one thread, and considering all source-timeseries (entire grid) for all destinations For few sources, spread out on a grid, it’s quite efficient should work well
- Parameters:
src (TemperatureSourceVector) – input a geo-located list of temperature time-series with filled in values (some might be nan etc.)
dst (GeoPointVector) – the GeoPoints,(x,y,z) locations to interpolate into
time_axis (TimeAxis) – the destination time-axis, recall that the inputs can be any-time-axis and they are transformed and interpolated into the destination-timeaxis
btk_parameter (BTKParameter) – the parameters to be used during interpolation
- Returns:
result. with filled in temperatures according to their position, the idw_parameters and time_axis
- Return type:
- shyft.hydrology.compute_geo_ts_values_at_time(geo_ts_vector: shyft.hydrology.GeoPointSourceVector, t: shyft.time_series.time) list[float]¶
compute the ts-values of the GeoPointSourceVector for the specified time t and return DoubleVector
- Parameters:
geo_ts_vector (GeoPointSourceVector) – Any kind of GeoPointSource vector
- Returns:
values. List of extracted values at same size/position as the geo_ts_vector
t (int): timestamp in utc seconds since epoch
- Return type:
DoubleValue
- shyft.hydrology.create_precipitation_source_vector_from_np_array(time_axis: shyft.time_series.TimeAxis, geo_points: shyft.time_series.GeoPointVector, np_array: Annotated[numpy.typing.ArrayLike, numpy.float64], point_fx: shyft.time_series.point_interpretation_policy) shyft.hydrology.GeoPointSourceVector¶
Create a PrecipitationSourceVector from specified time_axis,geo_points, 2-d np_array and point_fx.
- Parameters:
time_axis (TimeAxis) – time-axis that matches in length to 2nd dim of np_array
geo_points (GeoPointVector) – the geo-positions for the time-series, should be of length n_ts
np_array (np.ndarray) – numpy array of dtype=np.float64, and shape(n_ts,n_points)
point_fx (point interpretation) – one of POINT_AVERAGE_VALUE|POINT_INSTANT_VALUE
- Returns:
tsv. a PrecipitationSourceVector of length first np_array dim, n_ts, each with geo-point and time-series with time-axis, values and point_fx
- Return type:
- shyft.hydrology.create_radiation_source_vector_from_np_array(time_axis: shyft.time_series.TimeAxis, geo_points: shyft.time_series.GeoPointVector, np_array: Annotated[numpy.typing.ArrayLike, numpy.float64], point_fx: shyft.time_series.point_interpretation_policy) shyft.hydrology.GeoPointSourceVector¶
Create a RadiationSourceVector from specified time_axis,geo_points, 2-d np_array and point_fx.
- Parameters:
time_axis (TimeAxis) – time-axis that matches in length to 2nd dim of np_array
geo_points (GeoPointVector) – the geo-positions for the time-series, should be of length n_ts
np_array (np.ndarray) – numpy array of dtype=np.float64, and shape(n_ts,n_points)
point_fx (point interpretation) – one of POINT_AVERAGE_VALUE|POINT_INSTANT_VALUE
- Returns:
tsv. a RadiationSourceVector of length first np_array dim, n_ts, each with geo-point and time-series with time-axis, values and point_fx
- Return type:
- shyft.hydrology.create_rel_hum_source_vector_from_np_array(time_axis: shyft.time_series.TimeAxis, geo_points: shyft.time_series.GeoPointVector, np_array: Annotated[numpy.typing.ArrayLike, numpy.float64], point_fx: shyft.time_series.point_interpretation_policy) shyft.hydrology.GeoPointSourceVector¶
Create a RelHumSourceVector from specified time_axis,geo_points, 2-d np_array and point_fx.
- Parameters:
time_axis (TimeAxis) – time-axis that matches in length to 2nd dim of np_array
geo_points (GeoPointVector) – the geo-positions for the time-series, should be of length n_ts
np_array (np.ndarray) – numpy array of dtype=np.float64, and shape(n_ts,n_points)
point_fx (point interpretation) – one of POINT_AVERAGE_VALUE|POINT_INSTANT_VALUE
- Returns:
tsv. a RelHumSourceVector of length first np_array dim, n_ts, each with geo-point and time-series with time-axis, values and point_fx
- Return type:
- shyft.hydrology.create_temperature_source_vector_from_np_array(time_axis: shyft.time_series.TimeAxis, geo_points: shyft.time_series.GeoPointVector, np_array: Annotated[numpy.typing.ArrayLike, numpy.float64], point_fx: shyft.time_series.point_interpretation_policy) shyft.hydrology.GeoPointSourceVector¶
Create a TemperatureSourceVector from specified time_axis,geo_points, 2-d np_array and point_fx.
- Parameters:
time_axis (TimeAxis) – time-axis that matches in length to 2nd dim of np_array
geo_points (GeoPointVector) – the geo-positions for the time-series, should be of length n_ts
np_array (np.ndarray) – numpy array of dtype=np.float64, and shape(n_ts,n_points)
point_fx (point interpretation) – one of POINT_AVERAGE_VALUE|POINT_INSTANT_VALUE
- Returns:
tsv. a TemperatureSourceVector of length first np_array dim, n_ts, each with geo-point and time-series with time-axis, values and point_fx
- Return type:
- shyft.hydrology.create_wind_speed_source_vector_from_np_array(time_axis: shyft.time_series.TimeAxis, geo_points: shyft.time_series.GeoPointVector, np_array: Annotated[numpy.typing.ArrayLike, numpy.float64], point_fx: shyft.time_series.point_interpretation_policy) shyft.hydrology.GeoPointSourceVector¶
Create a WindSpeedSourceVector from specified time_axis,geo_points, 2-d np_array and point_fx.
- Parameters:
time_axis (TimeAxis) – time-axis that matches in length to 2nd dim of np_array
geo_points (GeoPointVector) – the geo-positions for the time-series, should be of length n_ts
np_array (np.ndarray) – numpy array of dtype=np.float64, and shape(n_ts,n_points)
point_fx (point interpretation) – one of POINT_AVERAGE_VALUE|POINT_INSTANT_VALUE
- Returns:
tsv. a WindSpeedSourceVector of length first np_array dim, n_ts, each with geo-point and time-series with time-axis, values and point_fx
- Return type:
- shyft.hydrology.glacier_melt_step(dtf: SupportsFloat | SupportsIndex, temperature: SupportsFloat | SupportsIndex, sca: SupportsFloat | SupportsIndex, glacier_fraction: SupportsFloat | SupportsIndex) float¶
Calculates outflow from glacier melt rate [mm/h].
- Parameters:
dtf (float) – degree timestep factor [mm/day/deg.C]; lit. values for Norway: 5.5 - 6.4 in Hock, R. (2003), J. Hydrol., 282, 104-115.
temperature (float) – degC, considered constant over timestep dt
sca (float) – fraction of snow cover in cell [0..1], glacier melt occurs only if glacier fraction > snow fraction
glacier_fraction (float) – glacier fraction [0..1] in the total area
- Returns:
glacier_melt. output from glacier, melt rate [mm/h]
- Return type:
float
- shyft.hydrology.idw_precipitation(src: shyft.hydrology.GeoPointSourceVector, dst: shyft.time_series.GeoPointVector, time_axis: shyft.time_series.TimeAxisFixedDeltaT, idw_param: shyft.hydrology.IDWPrecipitationParameter) shyft.hydrology.GeoPointSourceVector¶
Runs inverse distance interpolation to project precipitation sources out to the destination geo-timeseries
- Parameters:
src (PrecipitationSourceVector) – a geo-located list of precipitation time-series with filled in values (some might be nan etc.)
dst (GeoPointVector) – the GeoPoints,(x,y,z) locations to interpolate into
time_axis (TimeAxis) – the destination time-axis, recall that the inputs can be any-time-axis, they are transformed and interpolated into the destination-timeaxis
idw_param (IDWPrecipitationParameter) – the parameters to be used during interpolation
- Returns:
precipitation. with filled in precipitations according to their position, the idw_parameters and time_axis
- Return type:
- shyft.hydrology.idw_radiation(src: shyft.hydrology.GeoPointSourceVector, dst: shyft.time_series.GeoPointVector, time_axis: shyft.time_series.TimeAxisFixedDeltaT, idw_param: shyft.hydrology.IDWParameter, slope_factors: collections.abc.Sequence[SupportsFloat | SupportsIndex]) shyft.hydrology.GeoPointSourceVector¶
Runs inverse distance interpolation to project radiation sources out to the destination geo-timeseries
- Parameters:
src (RadiationSourceVector) – input a geo-located list of precipitation time-series with filled in values (some might be nan etc.)
dst (GeoPointVector) – the GeoPoints,(x,y,z) locations to interpolate into
time_axis (TimeAxis) – the destination time-axis, recall that the inputs can be any-time-axis, they are transformed and interpolated into the destination-timeaxis
idw_param (IDWParameter) – the parameters to be used during interpolation
slope_factors (DoubleVector) – the slope-factor corresponding to geopoints, typical 0.9
- Returns:
radiation. with filled in radiation according to their position, the idw_parameters and time_axis
- Return type:
- shyft.hydrology.idw_relative_humidity(src: shyft.hydrology.GeoPointSourceVector, dst: shyft.time_series.GeoPointVector, time_axis: shyft.time_series.TimeAxisFixedDeltaT, idw_param: shyft.hydrology.IDWParameter) shyft.hydrology.GeoPointSourceVector¶
Runs inverse distance interpolation to project relative humidity sources out to the destination geo-timeseries
- Parameters:
src (RelHumSourceVector) – input a geo-located list of precipitation time-series with filled in values (some might be nan etc.)
dst (GeoPointVector) – the GeoPoints,(x,y,z) locations to interpolate into
time_axis (TimeAxis) – the destination time-axis, recall that the inputs can be any-time-axis, they are transformed and interpolated into the destination-timeaxis
idw_param (IDWParameter) – the parameters to be used during interpolation
- Returns:
relhum. with filled in relative humidity according to their position, the idw_parameters and time_axis
- Return type:
- shyft.hydrology.idw_temperature(src: shyft.hydrology.GeoPointSourceVector, dst: shyft.time_series.GeoPointVector, time_axis: shyft.time_series.TimeAxisFixedDeltaT, idw_param: shyft.hydrology.IDWTemperatureParameter) shyft.hydrology.GeoPointSourceVector¶
Runs inverse distance interpolation to project temperature sources out to the destination geo-timeseries
- Parameters:
src (TemperatureSourceVectorn) – input a geo-located list of temperature time-series with filled in values (some might be nan etc.)
dst (GeoPointVector) – the GeoPoints,(x,y,z) locations to interpolate into
time_axis (TimeAxis) – the destination time-axis, recall that the inputs can be any-time-axis, they are transformed and interpolated into the destination-timeaxis
idw_param (IDWTemperatureParameter) – the parameters to be used during interpolation, defines the behaviour of the interpolation. Please use help on the IDWTemperatureParameter for details.
- Returns:
temperatures. with filled in temperatures according to their position, the idw_parameters and time_axis
- Return type:
- shyft.hydrology.idw_wind_speed(src: shyft.hydrology.GeoPointSourceVector, dst: shyft.time_series.GeoPointVector, time_axis: shyft.time_series.TimeAxisFixedDeltaT, idw_param: shyft.hydrology.IDWParameter, shear_factor: SupportsFloat | SupportsIndex = nan, hub_height: SupportsFloat | SupportsIndex = nan, reference_height: SupportsFloat | SupportsIndex = nan) shyft.hydrology.GeoPointSourceVector¶
Runs inverse distance interpolation to project geo located wind input sources out to the destination geo-timeseries
- Parameters:
src (WindspeedSourceVector) – input a geo-located list of wind speed time-series with filled in values (some might be nan etc.)
dst (GeoPointVector) – the GeoPoints,(x,y,z) locations to interpolate into
time_axis (TimeAxis) – the destination time-axis, recall that the inputs can be any-time-axis, they are transformed and interpolated into the destination-timeaxis
idw_param (IDWParametern) – the parameters to be used during interpolation
shear_factor (float) – optional:wind shear coefficient to estimate the wind speed at higher elevations, typical 0.11 onshore and 0.15 offshore,>0.0
hub_height (float) – optional:distance from the ground to the middle of the turbine’s rotor, >0.0
reference_height (float) – optional: height above ground of measured wind speed, >0.0
- Returns:
windspeed. with filled in wind speed according to their position, the idw_parameters and time_axis
- Return type:
- shyft.hydrology.make_initial_state(v_sat: SupportsFloat | SupportsIndex, t_prf: SupportsFloat | SupportsIndex, n_layers: SupportsInt | SupportsIndex = 4) shyft.hydrology.FSM2State¶
Create an initial FSM2 state from saturation and temperature.
- shyft.hydrology.make_uhg_from_gamma(n_steps: SupportsInt | SupportsIndex, alpha: SupportsFloat | SupportsIndex, beta: SupportsFloat | SupportsIndex) list[float]¶
make_uhg_from_gamma a simple function to create a uhg (unit hydro graph) weight vector containing n_steps, given the gamma shape factor alpha and beta. ensuring the sum of the weight vector is 1.0 and that it has a min-size of one element (1.0)
- Parameters:
n_steps (int) – number of time-steps, elements, in the vectorn
alpha (float) – the gamma_distribution gamma-factor
beta (float) – the base-line, added to pdf(gamma(alpha,1))
- Returns:
unit hydro graph factors. - normalized to sum 1.0
- shyft.hydrology.ordinary_kriging(src: shyft.hydrology.GeoPointSourceVector, dst: shyft.time_series.GeoPointVector, time_axis: shyft.time_series.TimeAxisFixedDeltaT, parameter: shyft.hydrology.OKParameter) shyft.hydrology.GeoPointSourceVector¶
Runs ordinary kriging for geo sources and project the source out to the destination geo-timeseries Notice that kriging is currently not very efficient for large grid inputs, using only one thread, and considering all source-timeseries (entire grid) for all destinations For few sources, spread out on a grid, it’s quite efficient should work well Also note that this function currently does not elicite observations with nan-data most useful when you have control on the inputs, providing full set of data.
- Parameters:
src (GeoSourceVector) – input a geo-located list of time-series with filled in values
dst (GeoPointVector) – the GeoPoints,(x,y,z) locations to interpolate into
time_axis (TimeAxis) – the destination time-axis, recall that the inputs can be any-time-axis, and they are transformed and interpolated into the destination-timeaxis
parameter (OKParameter) – the parameters to be used during interpolation
- Returns:
result. with filled in ts-values according to their position, the parameters and time_axis
- Return type:
GeoSourceVector
- shyft.hydrology.parse_cf_time(reference: str) shyft.time_series.UtcPeriod¶
parses cf time unit string like hours since 1970-01-01 00:00:00 and returs an UtcPeriod, where the .start is the reference time and the .timespan() is the delta time, e.g. 3600.0 If the reference is illformed, then the returned period is not .valid() The intended usage is to get the reference time and time-delta of netcdf files, replacing the need of cftime python library.
- Parameters:
reference (str) – netcdf time-reference
- Returns:
p.valid()==True if well formed,p.start equal to the reference time, and p.timespan() equal to the time-delta specified
- Return type:
- class shyft.hydrology.stat_scope(self: shyft.hydrology.stat_scope, value: SupportsInt | SupportsIndex)¶
Bases:
pybind11_objectDefines the scope of the indexes passed to statistics functions .cell : the indexes are considered as the i’th cell .catchment : the indexes are considered catchment identifiers
The statistics is then covering the cells that matches the selected criteria
Members:
cell
catchment
- __init__(self: shyft.hydrology.stat_scope, value: SupportsInt | SupportsIndex) None¶
- catchment = <stat_scope.catchment: 1>¶
- cell = <stat_scope.cell: 0>¶
- stat_scope.name -> str
- property value¶
- shyft.hydrology.version() str¶