Commit b0d2554d authored by Thibault Hallouin's avatar Thibault Hallouin
Browse files

update notebook with actual C++ example

parent e59a0be6
No related merge requests found
Showing with 27 additions and 17 deletions
+27 -17
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
## `evalhyd-cli` demonstration ## `evalhyd-cli` demonstration
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` C++14 ``` C++14
! evalhyd --help #include <xtensor/xtensor.hpp>
#include <xtensor/xio.hpp>
#include <evalhyd/evald.hpp>
#include <evalhyd/evalp.hpp>
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
### Deterministic evaluation ### Deterministic evaluation
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Visualise streamflow observations Define streamflow observations
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` C++14 ``` C++14
# shape: {1, time: 4} // shape: {1, time: 4}
! cat "data/obs.csv" xt::xtensor<double, 2> obs =
{{4.7, 4.3, 5.5, 2.7}};
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Visualise streamflow predictions Define streamflow predictions
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` C++14 ``` C++14
# shape: {series: 1, time: 4} // shape: {series: 1, time: 4}
! cat "data/prd.csv" xt::xtensor<double, 2> prd =
{{5.3, 4.2, 5.7, 2.3}};
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Compute Nash-Sutcliffe efficiency Compute Nash-Sutcliffe efficiency
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` C++14 ``` C++14
# shape: {series: 1, subsets: 1, samples: 1} // shape: {series: 1, subsets: 1, samples: 1}
! evalhyd evald "data/obs.csv" "data/prd.csv" "NSE" std::cout << evalhyd::evald(obs, prd, {"NSE"}) << std::endl;
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
### Probabilistic evaluation ### Probabilistic evaluation
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Visualise streamflow observations Visualise streamflow observations
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` C++14 ``` C++14
# shape: {sites: 1, time: 5} // shape: {sites: 1, time: 5}
! cat "data/obs/site_a.csv" xt::xtensor<double, 2> obs =
{{4.7, 4.3, 5.5, 2.7, 4.1}};
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Visualise streamflow predictions Visualise streamflow predictions
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` C++14 ``` C++14
# shape: {sites: 1, lead times: 1, members: 3, time: 5} // shape: {sites: 1, lead times: 1, members: 3, time: 5}
! cat "data/prd/leadtime_1/site_a.csv" xt::xtensor<double, 4> prd =
{{{{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}}}};
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Visualise streamflow thresholds Visualise streamflow thresholds
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` C++14 ``` C++14
# shape: {sites: 1, thresholds: 2} // shape: {sites: 1, thresholds: 2}
! cat "data/thr/site_a.csv" xt::xtensor<double, 2> thr =
{{4., 5.}};
``` ```
%% Cell type:markdown id: tags: %% Cell type:markdown id: tags:
Compute Brier score Compute Brier score
%% Cell type:code id: tags: %% Cell type:code id: tags:
``` C++14 ``` C++14
# shape: {sites: 1, lead times: 1, subsets: 1, samples: 1, thresholds: 2} // shape: {sites: 1, lead times: 1, subsets: 1, samples: 1, thresholds: 2}
! evalhyd evalp "data/obs" "data/prd" "BS" --q_thr "data/thr" --events "high" std::cout << evalhyd::evalp(obs, prd, {"BS"}, thr, "high") << std::endl;
``` ```
......
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