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:
### Deterministic evaluation
## `evalhyd-python` demonstration
%% Cell type:code id: tags:
``` python
import numpy
import evalhyd
```
%% Cell type:markdown id: tags:
### Deterministic evaluation
# define streamflow observations
# > shape: {1, time: 4}
%% Cell type:markdown id: tags:
Define streamflow observations
%% Cell type:code id: tags:
``` python
# shape: {1, time: 4}
obs = numpy.array(
[[4.7, 4.3, 5.5, 2.7]]
)
```
%% Cell type:markdown id: tags:
Define streamflow predictions
%% Cell type:code id: tags:
# define streamflow predictions
# > shape: {series: 1, time:4}
``` python
# shape: {series: 1, time: 4}
prd = numpy.array(
[[5.3, 4.2, 5.7, 2.3]]
)
```
%% Cell type:markdown id: tags:
Compute Nash-Sutcliffe efficiency
%% Cell type:code id: tags:
``` python
import evalhyd
# compute Nash-Sutcliffe efficiency
# > shape: {series: 1, subsets: 1, samples: 1}
# shape: {series: 1, subsets: 1, samples: 1}
evalhyd.evald(obs, prd, ["NSE"])
```
%% Cell type:markdown id: tags:
### Probabilistic evaluation
%% Cell type:markdown id: tags:
Define streamflow observations
%% Cell type:code id: tags:
``` python
import numpy
# define streamflow observations
# > shape: {sites: 1, time: 5}
# shape: {sites: 1, time: 5}
obs = numpy.array(
[[4.7, 4.3, 5.5, 2.7, 4.1]]
)
```
# define streamflow predictions
# > shape: {sites: 1, lead times: 1, members: 3, time: 5}
%% Cell type:markdown id: tags:
Define streamflow predictions
%% Cell type:code id: tags:
``` python
# shape: {sites: 1, lead times: 1, members: 3, time: 5}
prd = numpy.array(
[[[[5.3, 4.2, 5.7, 2.3, 3.1],
[4.3, 4.2, 4.7, 4.3, 3.3],
[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:
``` python
import evalhyd
# shape: {sites: 1, thresholds: 2}
thr = numpy.array(
[[4., 5.]]
)
```
# compute Brier score
# > shape: {sites: 1, lead times: 1, subsets: 1, samples: 1, thresholds: 2}
%% Cell type:markdown id: tags:
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")
```
......
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