Skip to content

Commit

Permalink
lowered minimal pandas version restriction and defined _TIMESTR only …
Browse files Browse the repository at this point in the history
…once
  • Loading branch information
veenstrajelmer authored Sep 20, 2024
1 parent 14aa56f commit 03cd4dc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion envs/hydromt-delft3dfm-min.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies:
- geopandas<1
- hydromt==0.10.0
- numpy<2
- pandas
- pandas>=2.0.0
- pip
- pyflwdir >=0.5.4
- pyproj
Expand Down
2 changes: 1 addition & 1 deletion envs/hydromt-delft3dfm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions hydromt_delft3dfm/workflows/boundaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 03cd4dc

Please sign in to comment.