Module statistics¶
createCompositeObjective(simulation, state_name, observation, yamlstring_statistic, start_date, end_date)
¶
Creates a composite objective calculator
Creates a composite objective calculator
Parameters:
Name | Type | Description | Default |
---|---|---|---|
simulation |
Simulation
|
A SWIFT simulation object (i.e. a model runner) |
required |
state_name |
Any
|
The name identifying the model state variable to calibrate against the observation |
required |
observation |
Any
|
an xts |
required |
yamlstring_statistic |
Any
|
a yaml string representing objective functions and weights eg... |
required |
start_date |
Any
|
start date of the period to calculate statistics on |
required |
end_date |
Any
|
end date of the period to calculate statistics on |
required |
Returns:
Type | Description |
---|---|
objective evaluator |
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/statistics.py
create_multisite_objective(simulation, statspec, observations, weights)
¶
Creates an objective that combines multiple statistics
Creates an objective that combines multiple statistics. Used for joined, "whole of catchment" calibration
Parameters:
Name | Type | Description | Default |
---|---|---|---|
simulation |
Simulation
|
A SWIFT simulation object (i.e. a model runner) |
required |
statspec |
pd.DataFrame
|
dataframe defining the objectives used. See function |
required |
observations |
Sequence[TimeSeriesLike]
|
A list of (time series) observations to calculated the statistics. Must be of same length as the number of rows of statspec. |
required |
weights |
Dict[str, float]
|
numeric vector of weights to ponderate each objective. |
required |
Examples |
|
required |
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/statistics.py
create_objective(simulation, state_name, observation, statistic, start_date, end_date)
¶
Creates an objective calculator
Parameters:
Name | Type | Description | Default |
---|---|---|---|
simulation |
Simulation
|
A SWIFT simulation object (i.e. a model runner) |
required |
state_name |
Any
|
The name identifying the model state variable to calibrate against the observation |
required |
observation |
TimeSeriesLike
|
an xts |
required |
statistic |
str
|
statistic identifier, e.g. "NSE" |
required |
start_date |
ConvertibleToTimestamp
|
start date of the period to calculate statistics on |
required |
end_date |
ConvertibleToTimestamp
|
end date of the period to calculate statistics on |
required |
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/statistics.py
get_score(objective_evaluator, p_set)
¶
Evaluate an objective for a given parameterisation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
objective_evaluator |
ObjectiveEvaluator
|
objective evaluator |
required |
p_set |
HypercubeParameteriser
|
parameteriser |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
Dict[str,Any]: score(s), and a data frame representation of the input parameters. |
Source code in /home/per202/src/swift/bindings/python/swift2/swift2/statistics.py
multi_statistic_definition(model_var_ids, statistic_ids, objective_ids, objective_names, starts, ends)
¶
Collate information for use in multisite multiobjective definition
Collate information for use in multisite multiobjective definition
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_var_ids |
Any
|
character vector, model state identifiers where statistics are calculated |
required |
statistic_ids |
Any
|
character vector, identifiers for bivariate statistics (e.g. nse, lognse, et.) |
required |
objective_ids |
Any
|
character vector, identifiers for the objectives. Can be the same as modelVarIds. |
required |
objective_names |
Any
|
character vector, display names for the objectives. Can be the same as modelVarIds. |
required |
starts |
Any
|
POSIXct vector of start dates for statistics |
required |
ends |
Any
|
POSIXct vector of end dates for statistics |
required |