From fe853d3ed569ed11e8fceb00d856be3fedf5f43e Mon Sep 17 00:00:00 2001 From: Martin Paule <67288701+martinpaule@users.noreply.github.com> Date: Thu, 22 Feb 2024 16:26:15 +0100 Subject: [PATCH] FIX: use len(unique) to estimate unique entry (#151) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Addressed an issue in model.py, where having multiple distances between gates (either by manually setting the radar to have varying steps or by small float inaccuracies) causes the reading of a ODIM h5 file to crash. More info on this in issue #150. * Update history.md --------- Co-authored-by: Martin Paule Co-authored-by: Kai Mühlbauer --- docs/history.md | 4 ++++ xradar/model.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/history.md b/docs/history.md index ad84b90..aa9d3af 100644 --- a/docs/history.md +++ b/docs/history.md @@ -1,5 +1,9 @@ # History +## 0.4.3 (2024-02-24) + +* FIX: use len(unique) to estimate unique entry for odim range ({pull}`151`) by [@martinpaule](https://github.com/martinpaule). + ## 0.4.2 (2023-11-02) * FIX: Fix handling of sweep_mode attributes ({pull}`143`) by [@mgrover1](https://github.com/mgrover1) diff --git a/xradar/model.py b/xradar/model.py index 5a91a30..ed37b64 100644 --- a/xradar/model.py +++ b/xradar/model.py @@ -627,7 +627,7 @@ def get_range_attrs(rng=None): if rng is not None: diff = np.diff(rng) unique = np.unique(diff) - if unique: + if len(unique) == 1: spacing = "true" range_attrs["meters_between_gates"] = diff[0] else: