Skip to content

Commit

Permalink
FIX: use rstart in meter for ODIM_H5/V2_4 (#197)
Browse files Browse the repository at this point in the history
* FIX: use correct rstart in meter for ODIM_H5/V2_4
* add history.md entry
  • Loading branch information
kmuehlbauer authored Aug 13, 2024
1 parent 33d9132 commit bd774ba
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/history.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# History

## 0.6.3 (2024-08-13)

FIX: use rstart in meter for ODIM_H5/V2_4 ({issue}`196`) by [@kmuehlbauer](https://github.com/kmuehlbauer), ({pull}`197`) by [@kmuehlbauer](https://github.com/kmuehlbauer).

## 0.6.2 (2024-08-12)

* FIX: Passing 'engine' kwarg in "open_cfradial1_datatree" method to enable fsspec.open when using url ({issue}`194`) by [@aladinor](https://github.com/aladinor), ({pull}`195`) by [@aladinor](https://github.com/aladinor)
Expand Down
17 changes: 14 additions & 3 deletions xradar/io/backends/odim.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,12 @@ def _get_time_what(what, where, nrays=None):
return time_data


def _get_range(where):
def _get_range(where, odim_version=None):
scale = 1000.0
if odim_version == "ODIM_H5/V2_4":
scale = 1.0
ngates = where["nbins"]
range_start = where["rstart"] * 1000.0
range_start = where["rstart"] * scale
bin_range = where["rscale"]
cent_first = range_start + bin_range / 2.0
range_data = np.arange(
Expand Down Expand Up @@ -303,6 +306,10 @@ def where(self):
self._where = self.grp["where"].attrs
return self._where

def _get_odim_version(self):
version = self._root.attrs["Conventions"]
return version

def _get_site_coords(self):
lon = self._root["where"].attrs["lon"]
lat = self._root["where"].attrs["lat"]
Expand Down Expand Up @@ -411,7 +418,7 @@ def _get_ray_times(self, nrays=None):
return time_data

def _get_range(self):
return _get_range(self.where)
return _get_range(self.where, odim_version=self._odim_version)

def _get_time(self, point="start"):
return _get_time(self.what, point=point)
Expand Down Expand Up @@ -461,6 +468,10 @@ def _sweep_number(self):
"""Return sweep number."""
return int(self._group.split("/")[0][7:]) - 1

@property
def _odim_version(self):
return self._get_odim_version()


class H5NetCDFArrayWrapper(BackendArray):
"""H5NetCDFArrayWrapper
Expand Down

0 comments on commit bd774ba

Please sign in to comment.