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

remove unnecessary internal namespace

1 merge request!3release v0.1.0
Pipeline #42786 passed with stage
in 2 minutes and 9 seconds
Showing with 23 additions and 24 deletions
+23 -24
...@@ -175,7 +175,7 @@ namespace evalhyd ...@@ -175,7 +175,7 @@ namespace evalhyd
); );
// check that optional parameters are valid // check that optional parameters are valid
eh::utils::check_bootstrap(bootstrap); utils::check_bootstrap(bootstrap);
// check that data dimensions are compatible // check that data dimensions are compatible
// > time // > time
...@@ -220,7 +220,7 @@ namespace evalhyd ...@@ -220,7 +220,7 @@ namespace evalhyd
for (int m = 0; m < n_msk; m++) for (int m = 0; m < n_msk; m++)
xt::view(c_msk, m) = xt::view(c_msk, m) =
eh::masks::generate_mask_from_conditions( masks::generate_mask_from_conditions(
m_cdt[0], xt::view(q_obs_, 0), q_prd_ m_cdt[0], xt::view(q_obs_, 0), q_prd_
); );
...@@ -297,7 +297,7 @@ namespace evalhyd ...@@ -297,7 +297,7 @@ namespace evalhyd
"bootstrap requested but datetimes not provided" "bootstrap requested but datetimes not provided"
); );
exp = eh::uncertainty::bootstrap( exp = uncertainty::bootstrap(
dts, n_samples, len_sample dts, n_samples, len_sample
); );
} }
...@@ -310,7 +310,7 @@ namespace evalhyd ...@@ -310,7 +310,7 @@ namespace evalhyd
} }
// instantiate determinist evaluator // instantiate determinist evaluator
eh::determinist::Evaluator<D2, B2> evaluator(obs, prd, msk, exp); determinist::Evaluator<D2, B2> evaluator(obs, prd, msk, exp);
// declare maps for memoisation purposes // declare maps for memoisation purposes
std::unordered_map<std::string, std::vector<std::string>> elt; std::unordered_map<std::string, std::vector<std::string>> elt;
...@@ -331,7 +331,7 @@ namespace evalhyd ...@@ -331,7 +331,7 @@ namespace evalhyd
std::vector<std::string> req_elt; std::vector<std::string> req_elt;
std::vector<std::string> req_dep; std::vector<std::string> req_dep;
eh::utils::find_requirements(metrics, elt, dep, req_elt, req_dep); utils::find_requirements(metrics, elt, dep, req_elt, req_dep);
// pre-compute required elt // pre-compute required elt
for ( const auto& element : req_elt ) for ( const auto& element : req_elt )
...@@ -372,28 +372,28 @@ namespace evalhyd ...@@ -372,28 +372,28 @@ namespace evalhyd
if (std::find(req_dep.begin(), req_dep.end(), metric) if (std::find(req_dep.begin(), req_dep.end(), metric)
== req_dep.end()) == req_dep.end())
evaluator.calc_RMSE(); evaluator.calc_RMSE();
r.emplace_back(eh::uncertainty::summarise(evaluator.RMSE, summary)); r.emplace_back(uncertainty::summarise(evaluator.RMSE, summary));
} }
else if ( metric == "NSE" ) else if ( metric == "NSE" )
{ {
if (std::find(req_dep.begin(), req_dep.end(), metric) if (std::find(req_dep.begin(), req_dep.end(), metric)
== req_dep.end()) == req_dep.end())
evaluator.calc_NSE(); evaluator.calc_NSE();
r.emplace_back(eh::uncertainty::summarise(evaluator.NSE, summary)); r.emplace_back(uncertainty::summarise(evaluator.NSE, summary));
} }
else if ( metric == "KGE" ) else if ( metric == "KGE" )
{ {
if (std::find(req_dep.begin(), req_dep.end(), metric) if (std::find(req_dep.begin(), req_dep.end(), metric)
== req_dep.end()) == req_dep.end())
evaluator.calc_KGE(); evaluator.calc_KGE();
r.emplace_back(eh::uncertainty::summarise(evaluator.KGE, summary)); r.emplace_back(uncertainty::summarise(evaluator.KGE, summary));
} }
else if ( metric == "KGEPRIME" ) else if ( metric == "KGEPRIME" )
{ {
if (std::find(req_dep.begin(), req_dep.end(), metric) if (std::find(req_dep.begin(), req_dep.end(), metric)
== req_dep.end()) == req_dep.end())
evaluator.calc_KGEPRIME(); evaluator.calc_KGEPRIME();
r.emplace_back(eh::uncertainty::summarise(evaluator.KGEPRIME, summary)); r.emplace_back(uncertainty::summarise(evaluator.KGEPRIME, summary));
} }
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <type_traits>
#include <xtensor/xexpression.hpp> #include <xtensor/xexpression.hpp>
#include <xtensor/xtensor.hpp> #include <xtensor/xtensor.hpp>
...@@ -146,14 +147,14 @@ namespace evalhyd ...@@ -146,14 +147,14 @@ namespace evalhyd
const B4& t_msk_ = t_msk.derived_cast(); const B4& t_msk_ = t_msk.derived_cast();
// check that the metrics to be computed are valid // check that the metrics to be computed are valid
eh::utils::check_metrics( utils::check_metrics(
metrics, metrics,
{"BS", "BSS", "BS_CRD", "BS_LBD", "QS", "CRPS"} {"BS", "BSS", "BS_CRD", "BS_LBD", "QS", "CRPS"}
); );
// check that optional parameters are given as arguments // check that optional parameters are given as arguments
eh::utils::evalp::check_optionals(metrics, q_thr_); utils::evalp::check_optionals(metrics, q_thr_);
eh::utils::check_bootstrap(bootstrap); utils::check_bootstrap(bootstrap);
// check that data dimensions are compatible // check that data dimensions are compatible
// > time // > time
...@@ -242,7 +243,7 @@ namespace evalhyd ...@@ -242,7 +243,7 @@ namespace evalhyd
std::vector<std::string> req_elt; std::vector<std::string> req_elt;
std::vector<std::string> req_dep; std::vector<std::string> req_dep;
eh::utils::find_requirements(metrics, elt, dep, req_elt, req_dep); utils::find_requirements(metrics, elt, dep, req_elt, req_dep);
// generate masks from conditions if provided // generate masks from conditions if provided
auto gen_msk = [&]() { auto gen_msk = [&]() {
...@@ -252,7 +253,7 @@ namespace evalhyd ...@@ -252,7 +253,7 @@ namespace evalhyd
for (int l = 0; l < n_ltm; l++) for (int l = 0; l < n_ltm; l++)
for (int m = 0; m < n_msk; m++) for (int m = 0; m < n_msk; m++)
xt::view(c_msk, s, l, m) = xt::view(c_msk, s, l, m) =
eh::masks::generate_mask_from_conditions( masks::generate_mask_from_conditions(
xt::view(m_cdt, s, m), xt::view(m_cdt, s, m),
xt::view(q_obs_, s), xt::view(q_obs_, s),
xt::view(q_prd_, s, l) xt::view(q_prd_, s, l)
...@@ -272,9 +273,7 @@ namespace evalhyd ...@@ -272,9 +273,7 @@ namespace evalhyd
"bootstrap requested but datetimes not provided" "bootstrap requested but datetimes not provided"
); );
b_exp = eh::uncertainty::bootstrap( b_exp = uncertainty::bootstrap(dts, n_samples, len_sample);
dts, n_samples, len_sample
);
} }
else else
{ {
...@@ -307,7 +306,7 @@ namespace evalhyd ...@@ -307,7 +306,7 @@ namespace evalhyd
xt::view(c_msk, s, l, xt::all(), xt::all()) : xt::view(c_msk, s, l, xt::all(), xt::all()) :
xt::view(t_msk_, s, l, xt::all(), xt::all())); xt::view(t_msk_, s, l, xt::all(), xt::all()));
eh::probabilist::Evaluator<D2, D4, B4> evaluator( probabilist::Evaluator<D2, D4, B4> evaluator(
q_obs_v, q_prd_v, q_thr_v, t_msk_v, b_exp q_obs_v, q_prd_v, q_thr_v, t_msk_v, b_exp
); );
...@@ -347,7 +346,7 @@ namespace evalhyd ...@@ -347,7 +346,7 @@ namespace evalhyd
evaluator.calc_BS(); evaluator.calc_BS();
// (sites, lead times, subsets, samples, thresholds) // (sites, lead times, subsets, samples, thresholds)
xt::view(r[m], s, l, xt::all(), xt::all(), xt::all()) = xt::view(r[m], s, l, xt::all(), xt::all(), xt::all()) =
eh::uncertainty::summarise(evaluator.BS, summary); uncertainty::summarise(evaluator.BS, summary);
} }
else if ( metric == "BSS" ) else if ( metric == "BSS" )
{ {
...@@ -356,7 +355,7 @@ namespace evalhyd ...@@ -356,7 +355,7 @@ namespace evalhyd
evaluator.calc_BSS(); evaluator.calc_BSS();
// (sites, lead times, subsets, samples, thresholds) // (sites, lead times, subsets, samples, thresholds)
xt::view(r[m], s, l, xt::all(), xt::all(), xt::all()) = xt::view(r[m], s, l, xt::all(), xt::all(), xt::all()) =
eh::uncertainty::summarise(evaluator.BSS, summary); uncertainty::summarise(evaluator.BSS, summary);
} }
else if ( metric == "BS_CRD" ) else if ( metric == "BS_CRD" )
{ {
...@@ -365,7 +364,7 @@ namespace evalhyd ...@@ -365,7 +364,7 @@ namespace evalhyd
evaluator.calc_BS_CRD(); evaluator.calc_BS_CRD();
// (sites, lead times, subsets, samples, thresholds, components) // (sites, lead times, subsets, samples, thresholds, components)
xt::view(r[m], s, l, xt::all(), xt::all(), xt::all(), xt::all()) = xt::view(r[m], s, l, xt::all(), xt::all(), xt::all(), xt::all()) =
eh::uncertainty::summarise(evaluator.BS_CRD, summary); uncertainty::summarise(evaluator.BS_CRD, summary);
} }
else if ( metric == "BS_LBD" ) else if ( metric == "BS_LBD" )
{ {
...@@ -374,7 +373,7 @@ namespace evalhyd ...@@ -374,7 +373,7 @@ namespace evalhyd
evaluator.calc_BS_LBD(); evaluator.calc_BS_LBD();
// (sites, lead times, subsets, samples, thresholds, components) // (sites, lead times, subsets, samples, thresholds, components)
xt::view(r[m], s, l, xt::all(), xt::all(), xt::all(), xt::all()) = xt::view(r[m], s, l, xt::all(), xt::all(), xt::all(), xt::all()) =
eh::uncertainty::summarise(evaluator.BS_LBD, summary); uncertainty::summarise(evaluator.BS_LBD, summary);
} }
else if ( metric == "QS" ) else if ( metric == "QS" )
{ {
...@@ -383,7 +382,7 @@ namespace evalhyd ...@@ -383,7 +382,7 @@ namespace evalhyd
evaluator.calc_QS(); evaluator.calc_QS();
// (sites, lead times, subsets, samples, quantiles) // (sites, lead times, subsets, samples, quantiles)
xt::view(r[m], s, l, xt::all(), xt::all(), xt::all()) = xt::view(r[m], s, l, xt::all(), xt::all(), xt::all()) =
eh::uncertainty::summarise(evaluator.QS, summary); uncertainty::summarise(evaluator.QS, summary);
} }
else if ( metric == "CRPS" ) else if ( metric == "CRPS" )
{ {
...@@ -392,7 +391,7 @@ namespace evalhyd ...@@ -392,7 +391,7 @@ namespace evalhyd
evaluator.calc_CRPS(); evaluator.calc_CRPS();
// (sites, lead times, subsets, samples) // (sites, lead times, subsets, samples)
xt::view(r[m], s, l, xt::all(), xt::all()) = xt::view(r[m], s, l, xt::all(), xt::all()) =
eh::uncertainty::summarise(evaluator.CRPS, summary); uncertainty::summarise(evaluator.CRPS, summary);
} }
} }
} }
......
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