Skip to content

Commit

Permalink
Update for duration attribute.
Browse files Browse the repository at this point in the history
Ensure that Grib2Message object attribute, duration, is always of
type datetime.timedelta object, even when 0.
  • Loading branch information
EricEngle-NOAA committed Mar 29, 2024
1 parent bb6d67c commit 9ef5e53
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/grib2io/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def get_duration(pdtn: int, pdt: ArrayLike) -> datetime.timedelta:
try:
return datetime.timedelta(hours=pdt[_key[pdtn]+1]*tables.get_value_from_table(pdt[_key[pdtn]],'scale_time_hours'))
except(KeyError):
return None
return datetime.timedelta(hours=0)


def decode_wx_strings(lus: bytes) -> Dict[int, str]:
Expand Down

0 comments on commit 9ef5e53

Please sign in to comment.