From b3c886533fb7013f2ed56ef4d2e3d9edd9ec585f Mon Sep 17 00:00:00 2001 From: zssherman Date: Mon, 11 Nov 2024 14:09:29 -0600 Subject: [PATCH 1/2] MNT: Update code to remove warnings for datetime and pandas. --- act/io/arm.py | 4 ++-- tests/plotting/test_timeseriesdisplay.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/act/io/arm.py b/act/io/arm.py index 893bc84e28..2bf0338246 100644 --- a/act/io/arm.py +++ b/act/io/arm.py @@ -5,7 +5,6 @@ """ import copy -import datetime as dt import glob import json import re @@ -13,6 +12,7 @@ import tempfile import urllib import warnings +from datetime import datetime, timedelta from os import PathLike from pathlib import Path, PosixPath @@ -766,7 +766,7 @@ def write_netcdf( except KeyError: pass - current_time = dt.datetime.utcnow().replace(microsecond=0) + current_time = datetime.now(timezone.utc).replace(microsecond=0) history_value = ( f'Written to file by ACT-{act.__version__} ' f'with write_netcdf() at {current_time} UTC' diff --git a/tests/plotting/test_timeseriesdisplay.py b/tests/plotting/test_timeseriesdisplay.py index 464dfb82f5..7b29941ef8 100644 --- a/tests/plotting/test_timeseriesdisplay.py +++ b/tests/plotting/test_timeseriesdisplay.py @@ -690,7 +690,7 @@ def test_xlim_correction_plot(): @pytest.mark.mpl_image_compare(tolerance=10) def test_plot_stripes(): ds = act.io.read_arm_netcdf(sample_files.EXAMPLE_MET_WILDCARD) - ds = ds.resample(time='1H').mean() + ds = ds.resample(time='1h').mean() print(ds) reference_period = ['2019-01-01', '2019-10-02'] From 4a580bcdb5e20a64cb021b42bafef6fec17f5dc9 Mon Sep 17 00:00:00 2001 From: zssherman Date: Mon, 11 Nov 2024 14:14:06 -0600 Subject: [PATCH 2/2] FIX: Timezone not timedelta. --- act/io/arm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/act/io/arm.py b/act/io/arm.py index 2bf0338246..05c9201a87 100644 --- a/act/io/arm.py +++ b/act/io/arm.py @@ -12,7 +12,7 @@ import tempfile import urllib import warnings -from datetime import datetime, timedelta +from datetime import datetime, timezone from os import PathLike from pathlib import Path, PosixPath