Skip to content

Commit

Permalink
Merge pull request #550 from kafitzgerald/hourly_deprecation
Browse files Browse the repository at this point in the history
Update hourly frequency aliases
  • Loading branch information
kafitzgerald authored Feb 5, 2024
2 parents f3ea60b + d814f9c commit 7bde074
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions docs/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ Documentation
^^^^^^^^^^^^^
* Override branding for light/dark theme by `Cora Schneck`_ in (:pr:`545`)

Internal Changes
^^^^^^^^^^^^^^^^
* Update hourly frequency aliases by `Katelyn FitzGerald`_ in (:pr:`550`)


v2024.01.0 (January 30, 2023)
-----------------------
Expand Down
4 changes: 2 additions & 2 deletions geocat/comp/climatologies.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def calendar_average(
"""
# TODO: add functionality for users to select specific seasons or hours for averages
freq_dict = {
'hour': ('%m-%d %H', 'H'),
'hour': ('%m-%d %H', 'h'),
'day': ('%m-%d', 'D'),
'month': ('%m', 'MS'),
'season': (None, 'QS-DEC'),
Expand Down Expand Up @@ -526,7 +526,7 @@ def climatology_average(
`month_to_season <https://www.ncl.ucar.edu/Document/Functions/Contributed/month_to_season.shtml>`__
"""
freq_dict = {
'hour': ('%m-%d %H', 'H'),
'hour': ('%m-%d %H', 'h'),
'day': ('%m-%d', 'D'),
'month': ('%m', 'MS'),
'season': (None, 'QS-DEC')
Expand Down
10 changes: 5 additions & 5 deletions test/test_climatologies.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ def test_month_to_season_custom_time_coordinate(self, name, dataset,

class Test_Calendar_Average():
minute = _get_dummy_data('2020-01-01', '2021-12-31 23:30:00', '30min', 1, 1)
hourly = _get_dummy_data('2020-01-01', '2021-12-31 23:00:00', 'H', 1, 1)
hourly = _get_dummy_data('2020-01-01', '2021-12-31 23:00:00', 'h', 1, 1)
daily = _get_dummy_data('2020-01-01', '2021-12-31', 'D', 1, 1)
monthly = _get_dummy_data('2020-01-01', '2021-12-01', 'MS', 1, 1)

Expand Down Expand Up @@ -559,7 +559,7 @@ def test_30min_to_hourly_calendar_average(self) -> None:
hour_avg = np.arange(0.5, 35088.5, 2).reshape((365 + 366) * 24, 1, 1)
hour_avg_time = xr.cftime_range('2020-01-01 00:30:00',
'2021-12-31 23:30:00',
freq='H')
freq='h')
min_2_hour_avg = xr.Dataset(
data_vars={'data': (('time', 'lat', 'lon'), hour_avg)},
coords={
Expand Down Expand Up @@ -670,7 +670,7 @@ def test_non_standard_calendars_calendar_average(self, name, dset,
class Test_Climatology_Average():
minute = _get_dummy_data('2020-01-01', '2021-12-31 23:30:00', '30min', 1, 1)

hourly = _get_dummy_data('2020-01-01', '2021-12-31 23:00:00', 'H', 1, 1)
hourly = _get_dummy_data('2020-01-01', '2021-12-31 23:00:00', 'h', 1, 1)

daily = _get_dummy_data('2020-01-01', '2021-12-31', 'D', 1, 1)

Expand All @@ -682,7 +682,7 @@ class Test_Climatology_Average():
.reshape(8784, 1, 1)
hour_clim_time = xr.cftime_range('2020-01-01 00:30:00',
'2020-12-31 23:30:00',
freq='H')
freq='h')
min_2_hourly_clim = xr.Dataset(
data_vars={'data': (('time', 'lat', 'lon'), hour_clim)},
coords={
Expand All @@ -696,7 +696,7 @@ class Test_Climatology_Average():
.reshape(366, 1, 1)
day_clim_time = xr.cftime_range('2020-01-01 12:00:00',
'2020-12-31 12:00:00',
freq='24H')
freq='24h')

hour_2_day_clim = xr.Dataset(
data_vars={'data': (('time', 'lat', 'lon'), day_clim)},
Expand Down

0 comments on commit 7bde074

Please sign in to comment.