Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Elevation Angle for some products #925

Merged
merged 1 commit into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
.pydevproject
*.rej
.settings/
.spyproject
.*.sw[nop]
.sw[nop]
*.tmp
Expand Down
9 changes: 8 additions & 1 deletion pyart/io/nexrad_level3.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ def get_range(self):
def get_elevation(self):
""" Return the sweep elevation angle in degrees. """
hw30 = self.prod_descr['halfwords_30']
elevation = struct.unpack('>h', hw30)[0] * 0.1
if self.msg_header['code'] in ELEVATION_ANGLE:
elevation = struct.unpack('>h', hw30)[0] * 0.1
else:
elevation = None
return elevation

def get_volume_start_datetime(self):
Expand Down Expand Up @@ -348,6 +351,10 @@ def _int16_to_float16(val):

_8_OR_16_LEVELS = [19, 20, 25, 27, 28, 30, 56, 78, 79, 80, 169, 171, 181]

# List of product numbers for which Halfword 30 corresponds to sweep elev angle
# Per Table V of the ICD
ELEVATION_ANGLE = [19, 20, 25, 27, 28, 30, 56, 94, 99, 159, 161, 163, 165]

PRODUCT_RANGE_RESOLUTION = {
19: 1., # 124 nm
20: 2., # 248 nm
Expand Down
8 changes: 6 additions & 2 deletions pyart/io/nexradl3_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,12 @@ def read_nexrad_level3(filename, field_names=None, additional_metadata=None,
fixed_angle = filemetadata('fixed_angle')
azimuth['data'] = nfile.get_azimuth()
elev = nfile.get_elevation()
elevation['data'] = np.ones((nradials, ), dtype='float32') * elev
fixed_angle['data'] = np.array([elev], dtype='float32')
if elev is not None:
elevation['data'] = np.ones((nradials, ), dtype='float32') * elev
fixed_angle['data'] = np.array([elev], dtype='float32')
else:
elevation['data'] = None
fixed_angle['data'] = None

nfile.close()
return Radar(
Expand Down