Skip to content

Commit

Permalink
only apply mask for 2 byte data
Browse files Browse the repository at this point in the history
  • Loading branch information
kmuehlbauer committed Nov 2, 2024
1 parent b2841d1 commit 361e9d2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions xradar/io/backends/nexrad_level2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1253,10 +1253,13 @@ def _getitem(self, key):
self.datastore.root.get_data(self.group, self.name)
data = self.datastore.ds["sweep_data"][self.name]["data"]
# see 3.2.4.17.6 Table XVII-I Data Moment Characteristics and Conversion for Data Names
if self.name == "PHI":
x = np.uint16(0x3FF) # 10 bit mask
elif self.name == "ZDR":
x = np.uint16(0x7FF) # 11 bit mask
word_size = self.datastore.ds["sweep_data"][self.name]["word_size"]
if self.name == "PHI" and word_size == 16:
# 10 bit mask, but only for 2 byte data
x = np.uint16(0x3FF)
elif self.name == "ZDR" and word_size == 16:
# 11 bit mask, but only for 2 byte data
x = np.uint16(0x7FF)

Check warning on line 1262 in xradar/io/backends/nexrad_level2.py

View check run for this annotation

Codecov / codecov/patch

xradar/io/backends/nexrad_level2.py#L1262

Added line #L1262 was not covered by tests
else:
x = np.uint8(0xFF)
if len(data[0]) < self.shape[1]:
Expand Down

0 comments on commit 361e9d2

Please sign in to comment.