From 03cd4dc35271c66ef0669bddb6b4b572b2a6c19a Mon Sep 17 00:00:00 2001 From: veenstrajelmer <60435591+veenstrajelmer@users.noreply.github.com> Date: Fri, 20 Sep 2024 14:53:07 +0200 Subject: [PATCH] lowered minimal pandas version restriction and defined _TIMESTR only once --- envs/hydromt-delft3dfm-min.yml | 2 +- envs/hydromt-delft3dfm.yml | 2 +- hydromt_delft3dfm/workflows/boundaries.py | 6 +++--- pyproject.toml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/envs/hydromt-delft3dfm-min.yml b/envs/hydromt-delft3dfm-min.yml index 1e8d4191..f538cc1d 100644 --- a/envs/hydromt-delft3dfm-min.yml +++ b/envs/hydromt-delft3dfm-min.yml @@ -10,7 +10,7 @@ dependencies: - geopandas<1 - hydromt==0.10.0 - numpy<2 - - pandas + - pandas>=2.0.0 - pip - pyflwdir >=0.5.4 - pyproj diff --git a/envs/hydromt-delft3dfm.yml b/envs/hydromt-delft3dfm.yml index 12965e9d..62aeedca 100644 --- a/envs/hydromt-delft3dfm.yml +++ b/envs/hydromt-delft3dfm.yml @@ -15,7 +15,7 @@ dependencies: - hydromt>=0.10.0,<0.15 # To avoid getting v1 alpha - nbsphinx # docs notebook examples - numpy<2 - - pandas>=2.2.0 + - pandas>=2.0.0 - pip - pre-commit # linting - pydata-sphinx-theme # docs diff --git a/hydromt_delft3dfm/workflows/boundaries.py b/hydromt_delft3dfm/workflows/boundaries.py index ada2e628..9afad740 100644 --- a/hydromt_delft3dfm/workflows/boundaries.py +++ b/hydromt_delft3dfm/workflows/boundaries.py @@ -13,6 +13,9 @@ logger = logging.getLogger(__name__) +_TIMESTR = {"D": "days", "h": "hours", "min": "minutes", "s": "seconds", + "H": "hours", "S": "seconds", # support for pandas<2.2.0 + } __all__ = [ "get_boundaries_with_nodeid", @@ -319,7 +322,6 @@ def compute_2dboundary_values( else: # prepare boundary data # get data freq in seconds - _TIMESTR = {"D": "days", "h": "hours", "min": "minutes", "s": "seconds"} dt = df_bnd.time[1] - df_bnd.time[0] freq = dt.resolution_string multiplier = 1 @@ -508,7 +510,6 @@ def compute_meteo_forcings( logger.info("Preparing global (spatially uniform) timeseries.") # get data freq in seconds - _TIMESTR = {"D": "days", "h": "hours", "min": "minutes", "s": "seconds"} dt = df_meteo.time[1] - df_meteo.time[0] freq = dt.resolution_string multiplier = 1 @@ -559,7 +560,6 @@ def compute_meteo_forcings( def _standardize_forcing_timeindexes(da): """Standardize timeindexes frequency based on forcing DataArray.""" - _TIMESTR = {"D": "days", "h": "hours", "min": "minutes", "s": "seconds"} dt = pd.to_timedelta((da.time[1].values - da.time[0].values)) freq = dt.resolution_string multiplier = 1 diff --git a/pyproject.toml b/pyproject.toml index ca7ce06c..c71568bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ dependencies = [ "hydromt>=0.10.0, <0.15", "geopandas>=0.10, <1", # TODO: remove upper bound: https://github.com/Deltares/hydromt_delft3dfm/issues/135 "numpy<2", - "pandas>=2.2.0", + "pandas>=2.0.0", "xarray", "hydrolib-core>=0.6.1, <0.8", "xugrid>=0.9.0",