Skip to content

Commit

Permalink
add error message with better description
Browse files Browse the repository at this point in the history
  • Loading branch information
alhelguera authored Feb 19, 2025
1 parent 94764d3 commit e84d08a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bufr2geojson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,14 @@ def get_zcoordinate(self, bufr_class: int = None) -> Union[dict, None]:

if len(rel_height) == 1 and station_ground is not None:
assert station_ground.get('attributes').get('units') == self.qualifiers["07"].get(rel_height[0]).get('attributes').get('units') # noqa
z_amsl = station_ground.get('value') + self.qualifiers["07"].get(rel_height[0], {}).get('value') # noqa
z_alg = self.qualifiers["07"].get(rel_height[0], {}).get('value')
try:
z_amsl = station_ground.get('value') + self.qualifiers["07"].get(rel_height[0], {}).get('value') # noqa
z_alg = self.qualifiers["07"].get(rel_height[0], {}).get('value')
except TypeError as err:
name = str(self.qualifiers["07"].get(rel_height[0]).get("code"))
msg = f"Missing value between {name} descriptors."
LOGGER.error(msg)
raise RuntimeError(msg)
if 'depth' in rel_height[0]:
z_alg = -1 * z_alg
elif len(abs_height) == 1 and station_ground is not None:
Expand Down

0 comments on commit e84d08a

Please sign in to comment.