diff --git a/include/evalhyd/evald.hpp b/include/evalhyd/evald.hpp index 98409964faf7c07c893f84c35690fbf5c323367b..32e9c161506d9b0bfb69d633eb21470bc3381aba 100644 --- a/include/evalhyd/evald.hpp +++ b/include/evalhyd/evald.hpp @@ -175,7 +175,7 @@ namespace evalhyd ); // check that optional parameters are valid - eh::utils::check_bootstrap(bootstrap); + utils::check_bootstrap(bootstrap); // check that data dimensions are compatible // > time @@ -220,7 +220,7 @@ namespace evalhyd for (int m = 0; m < n_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_ ); @@ -297,7 +297,7 @@ namespace evalhyd "bootstrap requested but datetimes not provided" ); - exp = eh::uncertainty::bootstrap( + exp = uncertainty::bootstrap( dts, n_samples, len_sample ); } @@ -310,7 +310,7 @@ namespace evalhyd } // 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 std::unordered_map<std::string, std::vector<std::string>> elt; @@ -331,7 +331,7 @@ namespace evalhyd std::vector<std::string> req_elt; 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 for ( const auto& element : req_elt ) @@ -372,28 +372,28 @@ namespace evalhyd if (std::find(req_dep.begin(), req_dep.end(), metric) == req_dep.end()) evaluator.calc_RMSE(); - r.emplace_back(eh::uncertainty::summarise(evaluator.RMSE, summary)); + r.emplace_back(uncertainty::summarise(evaluator.RMSE, summary)); } else if ( metric == "NSE" ) { if (std::find(req_dep.begin(), req_dep.end(), metric) == req_dep.end()) evaluator.calc_NSE(); - r.emplace_back(eh::uncertainty::summarise(evaluator.NSE, summary)); + r.emplace_back(uncertainty::summarise(evaluator.NSE, summary)); } else if ( metric == "KGE" ) { if (std::find(req_dep.begin(), req_dep.end(), metric) == req_dep.end()) evaluator.calc_KGE(); - r.emplace_back(eh::uncertainty::summarise(evaluator.KGE, summary)); + r.emplace_back(uncertainty::summarise(evaluator.KGE, summary)); } else if ( metric == "KGEPRIME" ) { if (std::find(req_dep.begin(), req_dep.end(), metric) == req_dep.end()) evaluator.calc_KGEPRIME(); - r.emplace_back(eh::uncertainty::summarise(evaluator.KGEPRIME, summary)); + r.emplace_back(uncertainty::summarise(evaluator.KGEPRIME, summary)); } } diff --git a/include/evalhyd/evalp.hpp b/include/evalhyd/evalp.hpp index 2a9725c5eb5da5664fe51bed93583bc2f155b6db..0103ab3c01e3349b49a55e7b8534ead22d178f1e 100644 --- a/include/evalhyd/evalp.hpp +++ b/include/evalhyd/evalp.hpp @@ -3,6 +3,7 @@ #include <unordered_map> #include <vector> +#include <type_traits> #include <xtensor/xexpression.hpp> #include <xtensor/xtensor.hpp> @@ -146,14 +147,14 @@ namespace evalhyd const B4& t_msk_ = t_msk.derived_cast(); // check that the metrics to be computed are valid - eh::utils::check_metrics( + utils::check_metrics( metrics, {"BS", "BSS", "BS_CRD", "BS_LBD", "QS", "CRPS"} ); // check that optional parameters are given as arguments - eh::utils::evalp::check_optionals(metrics, q_thr_); - eh::utils::check_bootstrap(bootstrap); + utils::evalp::check_optionals(metrics, q_thr_); + utils::check_bootstrap(bootstrap); // check that data dimensions are compatible // > time @@ -242,7 +243,7 @@ namespace evalhyd std::vector<std::string> req_elt; 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 auto gen_msk = [&]() { @@ -252,7 +253,7 @@ namespace evalhyd for (int l = 0; l < n_ltm; l++) for (int m = 0; m < n_msk; 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(q_obs_, s), xt::view(q_prd_, s, l) @@ -272,9 +273,7 @@ namespace evalhyd "bootstrap requested but datetimes not provided" ); - b_exp = eh::uncertainty::bootstrap( - dts, n_samples, len_sample - ); + b_exp = uncertainty::bootstrap(dts, n_samples, len_sample); } else { @@ -307,7 +306,7 @@ namespace evalhyd xt::view(c_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 ); @@ -347,7 +346,7 @@ namespace evalhyd evaluator.calc_BS(); // (sites, lead times, subsets, samples, thresholds) 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" ) { @@ -356,7 +355,7 @@ namespace evalhyd evaluator.calc_BSS(); // (sites, lead times, subsets, samples, thresholds) 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" ) { @@ -365,7 +364,7 @@ namespace evalhyd evaluator.calc_BS_CRD(); // (sites, lead times, subsets, samples, thresholds, components) 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" ) { @@ -374,7 +373,7 @@ namespace evalhyd evaluator.calc_BS_LBD(); // (sites, lead times, subsets, samples, thresholds, components) 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" ) { @@ -383,7 +382,7 @@ namespace evalhyd evaluator.calc_QS(); // (sites, lead times, subsets, samples, quantiles) 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" ) { @@ -392,7 +391,7 @@ namespace evalhyd evaluator.calc_CRPS(); // (sites, lead times, subsets, samples) xt::view(r[m], s, l, xt::all(), xt::all()) = - eh::uncertainty::summarise(evaluator.CRPS, summary); + uncertainty::summarise(evaluator.CRPS, summary); } } }