Skip to content

Commit 8a6740e

Browse files
authored
FIX: prevent integer overflow when calculating azimuth in FURUNO scn files (#138)
1 parent 2bbb5cd commit 8a6740e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

docs/history.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* FIX: Add history to cfradial1 output, and fix minor error in CfRadial1_Export.ipynb notebook({pull}`132`) by [@syedhamidali](https://github.com/syedhamidali)
66
* FIX: fix readthedocs build for python 3.12 ({pull}`140`) by [@kmuehlbauer](https://github.com/kmuehlbauer).
77
* FIX: align coordinates in backends ({pull}`139`) by [@kmuehlbauer](https://github.com/kmuehlbauer)
8+
* FIX: prevent integer overflow when calculating azimuth in FURUNO scn files ({issue}`137`) by [@giacant](https://github.com/giacant) , ({pull}`138`) by [@kmuehlbauer](https://github.com/kmuehlbauer)
89

910
## 0.4.0 (2023-09-27)
1011

xradar/io/backends/furuno.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,10 @@ def get_data(self):
362362
self._data[item] = data[:, i, :]
363363
# get angles
364364
angles = raw_data[:, :4].reshape(rays, 4)
365+
# need to promote to uint32 to prevent integer overflow
366+
# https://github.com/openradar/xradar/issues/137
365367
self._data["azimuth"] = np.fmod(
366-
angles[:, 1] + self.header["azimuth_offset"], 36000
368+
angles[:, 1].astype("uint32") + self.header["azimuth_offset"], 36000
367369
)
368370
# elevation angles are dtype "int16"
369371
# which was tested against a sweep with -1deg elevation

0 commit comments

Comments
 (0)