Commit 8a0de460 authored by Thibault Hallouin's avatar Thibault Hallouin
Browse files

refactor into separate cells

parent 1548ec44
No related merge requests found
Showing with 128 additions and 33 deletions
+128 -33
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
### Deterministic evaluation ## `evalhyd-python` demonstration
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import numpy import numpy
import evalhyd
```
%% Cell type:markdown id: tags:
### Deterministic evaluation
# define streamflow observations %% Cell type:markdown id: tags:
# > shape: {1, time: 4}
Define streamflow observations
%% Cell type:code id: tags:
``` python
# shape: {1, time: 4}
obs = numpy.array( obs = numpy.array(
[[4.7, 4.3, 5.5, 2.7]] [[4.7, 4.3, 5.5, 2.7]]
) )
```
%% Cell type:markdown id: tags:
Define streamflow predictions
%% Cell type:code id: tags:
# define streamflow predictions ``` python
# > shape: {series: 1, time:4} # shape: {series: 1, time: 4}
prd = numpy.array( prd = numpy.array(
[[5.3, 4.2, 5.7, 2.3]] [[5.3, 4.2, 5.7, 2.3]]
) )
``` ```
%% Cell type:markdown id: tags:
Compute Nash-Sutcliffe efficiency
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import evalhyd # shape: {series: 1, subsets: 1, samples: 1}
# compute Nash-Sutcliffe efficiency
# > shape: {series: 1, subsets: 1, samples: 1}
evalhyd.evald(obs, prd, ["NSE"]) evalhyd.evald(obs, prd, ["NSE"])
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
### Probabilistic evaluation ### Probabilistic evaluation
%% Cell type:markdown id: tags:
Define streamflow observations
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import numpy # shape: {sites: 1, time: 5}
# define streamflow observations
# > shape: {sites: 1, time: 5}
obs = numpy.array( obs = numpy.array(
[[4.7, 4.3, 5.5, 2.7, 4.1]] [[4.7, 4.3, 5.5, 2.7, 4.1]]
) )
```
# define streamflow predictions %% Cell type:markdown id: tags:
# > shape: {sites: 1, lead times: 1, members: 3, time: 5}
Define streamflow predictions
%% Cell type:code id: tags:
``` python
# shape: {sites: 1, lead times: 1, members: 3, time: 5}
prd = numpy.array( prd = numpy.array(
[[[[5.3, 4.2, 5.7, 2.3, 3.1], [[[[5.3, 4.2, 5.7, 2.3, 3.1],
[4.3, 4.2, 4.7, 4.3, 3.3], [4.3, 4.2, 4.7, 4.3, 3.3],
[5.3, 5.2, 5.7, 2.3, 3.9]]]] [5.3, 5.2, 5.7, 2.3, 3.9]]]]
) )
# define streamflow thresholds
# > shape: {sites: 1, thresholds: 2}
thr = numpy.array([[4., 5.]])
``` ```
%% Cell type:markdown id: tags:
Define streamflow thresholds
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` python ``` python
import evalhyd # shape: {sites: 1, thresholds: 2}
thr = numpy.array(
[[4., 5.]]
)
```
# compute Brier score %% Cell type:markdown id: tags:
# > shape: {sites: 1, lead times: 1, subsets: 1, samples: 1, thresholds: 2}
Compute Brier score
%% Cell type:code id: tags:
``` python
# shape: {sites: 1, lead times: 1, subsets: 1, samples: 1, thresholds: 2}
evalhyd.evalp(obs, prd, ["BS"], thr, events="high") evalhyd.evalp(obs, prd, ["BS"], thr, events="high")
``` ```
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment