Commit 900fab52 authored by Thibault Hallouin's avatar Thibault Hallouin
Browse files

make deterministic metrics uppercase

Showing with 9 additions and 9 deletions
+9 -9
...@@ -78,12 +78,12 @@ namespace evalhyd ...@@ -78,12 +78,12 @@ namespace evalhyd
for ( const auto& metric : metrics ) for ( const auto& metric : metrics )
{ {
if ( metric == "nse" ) 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(evaluator.nse); r.emplace_back(evaluator.NSE);
} }
} }
......
...@@ -30,11 +30,11 @@ namespace evalhyd ...@@ -30,11 +30,11 @@ namespace evalhyd
} }
}; };
// members for evaluation metrics // members for evaluation metrics
A nse; A NSE;
// methods to compute elements // methods to compute elements
// TODO // TODO
// methods to compute metrics // methods to compute metrics
void calc_nse(); void calc_NSE();
}; };
// Compute the Nash-Sutcliffe Efficiency (NSE). // Compute the Nash-Sutcliffe Efficiency (NSE).
...@@ -54,7 +54,7 @@ namespace evalhyd ...@@ -54,7 +54,7 @@ namespace evalhyd
// Array of computed Nash-Sutcliffe efficiencies. // Array of computed Nash-Sutcliffe efficiencies.
// shape: (...) // shape: (...)
template <class A> template <class A>
void Evaluator<A>::calc_nse() void Evaluator<A>::calc_NSE()
{ {
// compute average observed flow // compute average observed flow
A q_avg = xt::mean(q_obs, -1, xt::keep_dims); A q_avg = xt::mean(q_obs, -1, xt::keep_dims);
...@@ -64,7 +64,7 @@ namespace evalhyd ...@@ -64,7 +64,7 @@ namespace evalhyd
A f_den = xt::sum(xt::square(q_obs - q_avg), -1, xt::keep_dims); A f_den = xt::sum(xt::square(q_obs - q_avg), -1, xt::keep_dims);
// return computed NSE // return computed NSE
nse = 1 - (f_num / f_den); NSE = 1 - (f_num / f_den);
} }
} }
} }
......
...@@ -29,12 +29,12 @@ TEST(DeterministTests, TestNSE) { ...@@ -29,12 +29,12 @@ TEST(DeterministTests, TestNSE) {
// compute scores (both with 2D and 1D tensors) // compute scores (both with 2D and 1D tensors)
std::vector<xt::xtensor<double, 2>> metrics_2d = std::vector<xt::xtensor<double, 2>> metrics_2d =
evalhyd::determinist::evaluate<xt::xtensor<double, 2>>( evalhyd::determinist::evaluate<xt::xtensor<double, 2>>(
{"nse"}, observed_2d, forecast_2d {"NSE"}, observed_2d, forecast_2d
); );
std::vector<xt::xtensor<double, 1>> metrics_1d = std::vector<xt::xtensor<double, 1>> metrics_1d =
evalhyd::determinist::evaluate<xt::xtensor<double, 1>>( evalhyd::determinist::evaluate<xt::xtensor<double, 1>>(
{"nse"}, observed_1d, forecast_1d {"NSE"}, observed_1d, forecast_1d
); );
// check results (both with 2D and 1D tensors) // check results (both with 2D and 1D tensors)
......
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