Skip to content

Commit

Permalink
FIX: prevent integer overflow when calculating azimuth in FURUNO scn …
Browse files Browse the repository at this point in the history
…files (#138)
  • Loading branch information
kmuehlbauer committed Oct 26, 2023
1 parent 2bbb5cd commit 8a6740e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/history.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* FIX: Add history to cfradial1 output, and fix minor error in CfRadial1_Export.ipynb notebook({pull}`132`) by [@syedhamidali](https://github.com/syedhamidali)
* FIX: fix readthedocs build for python 3.12 ({pull}`140`) by [@kmuehlbauer](https://github.com/kmuehlbauer).
* FIX: align coordinates in backends ({pull}`139`) by [@kmuehlbauer](https://github.com/kmuehlbauer)
* 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)

## 0.4.0 (2023-09-27)

Expand Down
4 changes: 3 additions & 1 deletion xradar/io/backends/furuno.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,10 @@ def get_data(self):
self._data[item] = data[:, i, :]
# get angles
angles = raw_data[:, :4].reshape(rays, 4)
# need to promote to uint32 to prevent integer overflow
# https://github.com/openradar/xradar/issues/137
self._data["azimuth"] = np.fmod(
angles[:, 1] + self.header["azimuth_offset"], 36000
angles[:, 1].astype("uint32") + self.header["azimuth_offset"], 36000
)
# elevation angles are dtype "int16"
# which was tested against a sweep with -1deg elevation
Expand Down

0 comments on commit 8a6740e

Please sign in to comment.