Skip to content

Commit

Permalink
change value for for hourly data search in datelabel get_timedelta_kw…
Browse files Browse the repository at this point in the history
…args to return 1hr instead of hr so that the frequency for hourly data matchew required catalog specification
  • Loading branch information
wrongkindofdoctor committed Sep 16, 2024
1 parent 5510898 commit f0951ee
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/util/datelabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@

# match-case statement to give date format
# input can be int or str


def date_fmt(date: str):
date_digits = len(date)
match date_digits:
Expand All @@ -72,6 +74,8 @@ def date_fmt(date: str):
return fmt

# convert a string to a cftime object


def str_to_cftime(time_str: str, fmt=None, calendar=None):
if fmt is None:
fmt = date_fmt(time_str)
Expand Down Expand Up @@ -1175,8 +1179,8 @@ def _parse_input_string(cls, quantity, unit):
s = 'wk'
elif s in ['daily', 'day', 'days', 'dy', 'd', 'diurnal', 'diurnally']:
s = 'day'
elif s in ['hourly', 'hour', 'hours', 'hr', 'h']:
s = 'hr'
elif s in ['hourly', 'hour', 'hours', 'hr', 'h', '1hr']:
s = '1hr'
elif s in ['minutes', 'minute', 'min']:
s = 'min'
else:
Expand All @@ -1201,7 +1205,7 @@ def _get_timedelta_kwargs(cls, q, s):
return {'weeks': q}
elif s == 'day':
return {'days': q}
elif s == 'hr':
elif s == '1hr':
return {'hours': q}
elif s == 'min':
return {'minutes': q}
Expand Down

0 comments on commit f0951ee

Please sign in to comment.