Commit 805e4a6a authored by Thibault Hallouin's avatar Thibault Hallouin
Browse files

fix bug in bootstrap sampling when period starts on Jan 1st

resolves #8
1 merge request!6release v0.1.1
Pipeline #47895 passed with stage
in 3 minutes and 39 seconds
Showing with 14 additions and 3 deletions
+14 -3
......@@ -9,7 +9,7 @@ Yet to be versioned and released. Only available from *dev* branch until then.
* remove `"WSS"` and `"AWI"` as probabilistic evaluation metric because of the
arbitrary nature of using the sample climatology as reference/benchmark
(`#7-CPP <https://gitlab.irstea.fr/HYCAR-Hydro/evalhyd/evalhyd-cpp/-/issues/7>`_)
(`CPP#7 <https://gitlab.irstea.fr/HYCAR-Hydro/evalhyd/evalhyd-cpp/-/issues/7>`_)
.. rubric:: Bug fixes
......@@ -21,6 +21,8 @@ Yet to be versioned and released. Only available from *dev* branch until then.
to the presence of square brackets in the regular expressions that do not seem
supported
(`R#6 <https://gitlab.irstea.fr/HYCAR-Hydro/evalhyd/evalhyd-r/-/issues/6>`_)
* fix bug when using calendar year as block for the bootstrapping functionality
(`CPP#8 <https://gitlab.irstea.fr/HYCAR-Hydro/evalhyd/evalhyd-cpp/-/issues/8>`_)
v0.1.0
------
......
......@@ -76,7 +76,16 @@ namespace evalhyd
int start_yr = v_tm.front().tm_year + 1900;
int end_yr = v_tm.back().tm_year + 1900;
// assume start of year block as start of time series
// deal with special case with a start on 1st of January
// (note: use string rather than *tm_yday* member of time_point
// because *tm_yday* is not set when using `std::get_time`)
if (datetimes[0].substr(5, 5) == "01-01")
{
// add one year to make sure last year is included in loop
end_yr += 1;
}
// take start of year block as start of time series
std::tm start_hy = v_tm.front();
xt::xtensor<int, 1> year_blocks = xt::zeros<int>({v_tm.size()});
......@@ -100,7 +109,7 @@ namespace evalhyd
if ((n_days != 365) && (n_days != 366))
{
throw std::runtime_error(
"year starting in " + std::to_string(y)
"year starting in " + std::to_string(y - 400)
+ " is incomplete"
);
}
......
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