smash.signatures#
- smash.signatures(model, sign=None, event_seg=None, domain='obs')[source]#
Compute simulated or observed hydrological signatures of Model.
- Parameters:
- model
Model
Primary data structure of the hydrological model
smash
.- signstr, list[str, …] or None, default None
Define signature(s) to compute. Should be one of
'Crc'
,'Crchf'
,'Crclf'
,'Crch2r'
,'Cfp2'
,'Cfp10'
,'Cfp50'
,'Cfp90'
(continuous signatures-based error metrics)'Eff'
,'Ebf'
,'Erc'
,'Erchf'
,'Erclf'
,'Erch2r'
,'Elt'
,'Epf'
(flood event signatures-based error metrics)
Note
If not given, all of continuous and flood event signatures will be computed.
- event_segdict[str, Any] or None, default None
A dictionary of event segmentation options when calculating flood event signatures. The keys are
'peak_quant'
,'max_duration'
, and'by'
.Note
If not given, default values will be set for all elements. If a specific element is not given in the dictionary, a default value will be set for that element. See
hydrograph_segmentation
for more.- domainstr, default ‘obs’
Compute observed (
'obs'
) or simulated ('sim'
) signatures.
- model
- Returns:
- signatures
Signatures
It returns an object containing the results of the signatures computation.
- signatures
See also
Signatures
Represents signatures computation result.
Examples
>>> from smash.factory import load_dataset >>> setup, mesh = load_dataset("cance") >>> model = smash.Model(setup, mesh)
Run the forward Model
>>> model.forward_run()
Compute simulated signatures
>>> sign = smash.signatures(model, domain="sim") >>> sign cont: <class 'pandas.core.frame.DataFrame'> event: <class 'pandas.core.frame.DataFrame'>
Access simulated flood event signatures as a
pandas.DataFrame
>>> sign.event code season start ... Erch2r Elt Epf 0 V3524010 autumn 2014-11-03 03:00:00 ... 0.324836 3.0 100.448631 1 V3515010 autumn 2014-11-03 10:00:00 ... 0.339471 0.0 20.168104 2 V3517010 autumn 2014-11-03 08:00:00 ... 0.319605 1.0 5.356519 [3 rows x 12 columns]
Access simulated continuous signatures as a
pandas.DataFrame
>>> sign.cont code Crc Crchf ... Cfp10 Cfp50 Cfp90 0 V3524010 0.208410 0.064490 ... 6.270661e-04 1.767450 27.806826 1 V3515010 0.139829 0.049087 ... 4.919724e-05 0.150414 5.161743 2 V3517010 0.139431 0.047900 ... 6.545733e-07 0.031947 1.355473 [3 rows x 9 columns]
Access specific simulated continuous signature for each gauge
>>> sign.cont["Crc"] 0 0.208410 1 0.139829 2 0.139431 Name: Crc, dtype: float64
Access all simulated continuous signatures for a single gauge
>>> sign.cont[sign.cont["code"] == "V3524010"] code Crc Crchf ... Cfp10 Cfp50 Cfp90 0 V3524010 0.20841 0.06449 ... 0.000627 1.76745 27.806826 [1 rows x 9 columns]
Access specific simulated continuous signatures for a single gauge
>>> sign.cont["Crc"][sign.cont["code"] == "V3524010"] 0 0.20841 Name: Crc, dtype: float64
Use the
item
method to return the underlying data as a Python scalar>>> sign.cont["Crc"][sign.cont["code"] == "V3524010"].item() 0.20841039717197418