diff --git a/ChangeLog b/ChangeLog index 867cc357464b57f29d1be79088e48d1a59fd49a1..4b3caa733917b48aa182881d10a795e3a70f929e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,12 @@ -2023-04-21 Uwe Schulzweida +2023-04-24 Uwe Schulzweida * Using CDI library version 2.2.1 * Version 2.2.0 release +2023-04-24 Uwe Schulzweida + + * percentiles_hist: fix problem with time constant data (bug fix) + 2023-04-20 Uwe Schulzweida * Vertstat: wrong result for non monotonic levels in GRIB format [Bug #11323] diff --git a/src/cdo.cc b/src/cdo.cc index 0aaf66e06692792a37531f07cf91a528de178ea9..4e01a92045800f7db75fff1f5e41182b975255b2 100644 --- a/src/cdo.cc +++ b/src/cdo.cc @@ -487,7 +487,7 @@ static void define_compress(const std::string &argString) { const char *arg = argString.c_str(); - size_t len = strlen(arg); + size_t len = argString.size(); if (argString == "szip") { diff --git a/src/percentiles_hist.cc b/src/percentiles_hist.cc index 2d80b23689ec579b87ba0847ecaa9fee8947f13d..db44953b6bcbc9d1d38be6e82a6f628d8c568641 100644 --- a/src/percentiles_hist.cc +++ b/src/percentiles_hist.cc @@ -58,8 +58,9 @@ histDefBounds(Histogram &hist, float a, float b) static inline int calc_bin(int nbins, float histMin, float histStep, float value) { - assert(histStep > 0.0f); - return std::min((int) ((value - histMin) / histStep), nbins - 1); + //assert(histStep > 0.0f); + //return std::min((int) ((value - histMin) / histStep), nbins - 1); + return (histStep > 0.0f) ? std::min((int) ((value - histMin) / histStep), nbins - 1) : 0; } template <typename T> @@ -241,7 +242,7 @@ histGetPercentile(const Histogram &hist, double p) auto bin = hist.isUint32 ? histGetBin(hist.nbins, s, INT_PTR(hist.ptr)) : histGetBin(hist.nbins, s, SHR_PTR(hist.ptr)); - assert(hist.step > 0.0f); + //assert(hist.step > 0.0f); return hist.min + bin * hist.step; }