From d814f9c82585792277e3b17ffa3e6ca419c0e039 Mon Sep 17 00:00:00 2001 From: Katelyn FitzGerald <7872563+kafitzgerald@users.noreply.github.com> Date: Mon, 5 Feb 2024 12:09:13 -0700 Subject: [PATCH] 'H' to 'h' for Pandas hour alias --- docs/release-notes.rst | 4 ++++ geocat/comp/climatologies.py | 4 ++-- test/test_climatologies.py | 10 +++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/docs/release-notes.rst b/docs/release-notes.rst index f017c51e..2b7bbcee 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -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) ----------------------- diff --git a/geocat/comp/climatologies.py b/geocat/comp/climatologies.py index 7f9e9c1e..9ee8f721 100644 --- a/geocat/comp/climatologies.py +++ b/geocat/comp/climatologies.py @@ -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'), @@ -526,7 +526,7 @@ def climatology_average( `month_to_season `__ """ freq_dict = { - 'hour': ('%m-%d %H', 'H'), + 'hour': ('%m-%d %H', 'h'), 'day': ('%m-%d', 'D'), 'month': ('%m', 'MS'), 'season': (None, 'QS-DEC') diff --git a/test/test_climatologies.py b/test/test_climatologies.py index 4adbc588..c684dbe8 100644 --- a/test/test_climatologies.py +++ b/test/test_climatologies.py @@ -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) @@ -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={ @@ -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) @@ -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={ @@ -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)},