Skip to content

Commit

Permalink
Fix cftime bug, no fail on pip check, pin xarray/pandas (#322)
Browse files Browse the repository at this point in the history
## Overview

Changes:

* Added pins to xarray and pandas to prevent issues with breaking
changes.
* Fixed an error with a cftime index fixing function.
* Switched `bump2version` for `bump-my-version`
* Do not fail when running pip check in conda environments

## Related Issue / Discussion

Ouranosinc/xclim#1534
pydata/xarray#8394
  • Loading branch information
Zeitsperre authored Dec 5, 2023
2 parents e24c78a + 1556e0c commit 710150f
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/bump-version-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
echo "current_version=${CURRENT_VERSION}"
- name: Bump Version
run: |
pip install bump2version
echo "running `bump2version ${{ github.event.inputs.bumpversion }}`"
pip install bump-my-version
echo "running `bump-my-version bump ${{ github.event.inputs.bumpversion }}`"
NEW_VERSION="$(grep -E '__version__' finch/__version__.py | cut -d ' ' -f3)"
echo "new_version=${NEW_VERSION}"
- name: Tag Release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Check versions
run: |
conda list
pip check
pip check || true
- name: Run tests
run: |
make start
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changes
*******

0.11.4 (2023-12-05)
===================
* Fixed a bug that occurred when fixing a broken cftime-index with newer `cftime` versions.
* Placed pins on xarray and pandas to prevent future errors from changes to frequency codes.

0.11.3 (2023-08-23)
===================
* Updated ReadTheDocs to use the new mambaforge version (`2022.9`).
Expand Down
2 changes: 2 additions & 0 deletions environment-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ dependencies:
- ipython
- matplotlib-base
- nbsphinx
- pandas >=1.5.3,<2.2.0
- pywps >=4.5.1
- sphinx >=4.0
- sphinxcontrib-bibtex
- unidecode
- xarray >=2023.01.0,<2023.11.0
- xclim =0.43 # remember to match xclim version in requirements_docs.txt as well
6 changes: 4 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ dependencies:
- python >=3.8,<3.12
- pip
- bottleneck
- cftime
- cf_xarray
- click
- clisops >=0.9.3
- dask
Expand All @@ -13,7 +15,7 @@ dependencies:
- h5netcdf
- netcdf4
- numpy
- pandas
- pandas >=1.5.3,<2.2.0
- parse
- psutil
- python-slugify
Expand All @@ -24,6 +26,6 @@ dependencies:
- sentry-sdk
- siphon
- unidecode
- xarray >=2023.01.0
- xarray >=2023.01.0,<2023.11.0
- xclim =0.43 # remember to match xclim version in requirements_docs.txt as well
- xesmf >=0.8.2
2 changes: 2 additions & 0 deletions finch/processes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,8 @@ def fix_broken_time_index(ds: xr.Dataset):
if times_are_encoded:
wrong_id = np.argwhere(np.isclose(time_dim, 0))
else:
if ds.time.dt.calendar != "noleap":
return
wrong_id = np.argwhere(
time_dim == cftime.DatetimeNoLeap(year=1850, month=1, day=1, hour=0)
)
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
bottleneck
cftime
cf-xarray
click
clisops>=0.9.3
dask[complete]
geopandas!=0.13.1
netcdf4
numpy
pandas
pandas>=1.5.3,<2.2.0
parse
psutil
python-slugify
Expand All @@ -17,7 +18,7 @@ scipy
sentry-sdk
siphon
unidecode
xarray>=0.18.2
xarray>=2023.01.0,<2023.11.0
xclim==0.43
xesmf>=0.6.2
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
Expand Down
2 changes: 1 addition & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ nbsphinx
nbval>=0.9.6
nbconvert
sphinx>=1.8.5
bump2version
bump-my-version
twine
cruft
jupyter_client
Expand Down
8 changes: 6 additions & 2 deletions requirements_docs.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
birdhouse-birdy>=0.8.1
cftime
cf-xarray
ipython
matplotlib
nbsphinx
pandas>=1.5.3,<2.2.0
pillow>=10.0.1 # not directly required, pinned by Snyk to avoid a vulnerability
pywps>=4.5.1
setuptools>=65.5.1 # not directly required, pinned by Snyk to avoid a vulnerability
sphinx>=4.0
sphinxcontrib-bibtex
tornado>=6.3.3 # not directly required, pinned by Snyk to avoid a vulnerability
unidecode
xclim==0.43
werkzeug>=3.0.1 # not directly required, pinned by Snyk to avoid a vulnerability
tornado>=6.3.3 # not directly required, pinned by Snyk to avoid a vulnerability
xarray>=2023.01.0,<2023.11.0
xclim==0.43

0 comments on commit 710150f

Please sign in to comment.