Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ repos:
args: [ '--pytest-test-first' ]
- id: trailing-whitespace
- repo: https://github.com/pappasam/toml-sort
rev: v0.24.3
rev: v0.24.4
hooks:
- id: toml-sort-fix
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.37.1
rev: v1.38.0
hooks:
- id: yamllint
args: [ '--config-file=.yamllint.yaml' ]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.10
rev: v0.15.9
hooks:
- id: ruff-check
args: [ '--fix', '--show-fixes' ]
Expand All @@ -43,7 +43,7 @@ repos:
- id: flake8
args: [ '--config=.flake8' ]
- repo: https://github.com/kynan/nbstripout
rev: 0.8.2
rev: 0.9.1
hooks:
- id: nbstripout
files: ".ipynb"
Expand All @@ -59,7 +59,7 @@ repos:
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
rev: v2.4.2
hooks:
- id: codespell
additional_dependencies: [ 'tomli' ]
Expand All @@ -73,7 +73,7 @@ repos:
hooks:
- id: gitleaks
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.36.0
rev: 0.37.1
hooks:
- id: check-github-workflows
- id: check-readthedocs
Expand Down
6 changes: 3 additions & 3 deletions CI/requirements_ci.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bump-my-version==1.3.0
exceptiongroup==1.3.1
flit==3.12.0
pip==25.3
pip==26.0.1
tomli==2.4.0
tox==4.30.3
tox-gh==1.5.0
tox==4.52.0
tox-gh==1.7.1
86 changes: 42 additions & 44 deletions CI/requirements_ci.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.9
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --generate-hashes --output-file=CI/requirements_ci.txt CI/requirements_ci.in
Expand All @@ -19,10 +19,10 @@ bracex==2.5.post1 \
bump-my-version==1.3.0 \
--hash=sha256:3cdaa54588d2443a29303b77e7539417187952c3d22f87bfdd32c0fe6af2f570 \
--hash=sha256:5780137a8d93378af3839798fcba01c7e6cb28dcc5aa5a7ab4d8507787f1995c
# via -r requirements_ci.in
cachetools==6.1.0 \
--hash=sha256:1c7bb3cf9193deaf3508b7c5f2a79986c13ea38965c5adcff1f84519cf39163e \
--hash=sha256:b4c4f404392848db3ce7aac34950d17be4d864da4b8b66911008e430bc544587
# via -r CI/requirements_ci.in
cachetools==7.0.5 \
--hash=sha256:0cd042c24377200c1dcd225f8b7b12b0ca53cc2c961b43757e774ebe190fd990 \
--hash=sha256:46bc8ebefbe485407621d0a4264b23c080cedd913921bad7ac3ed2f26c183114
# via tox
certifi==2025.1.31 \
--hash=sha256:3d5da6925056f6f18f119200434a4780a94263f10d1c21d032a6f6b2baa20651 \
Expand All @@ -31,10 +31,6 @@ certifi==2025.1.31 \
# httpcore
# httpx
# requests
chardet==5.2.0 \
--hash=sha256:1b3b6ff479a8c414bc3fa2c0852995695c4a026dcd6d0633b2dd092ca39c1cf7 \
--hash=sha256:e1cf59446890a00105fe7b7912492ea04b6e6f06d4b742b2c788469e34c82970
# via tox
charset-normalizer==3.4.1 \
--hash=sha256:0167ddc8ab6508fe81860a57dd472b2ef4060e8d378f0cc555707126830f2537 \
--hash=sha256:01732659ba9b5b873fc117534143e4feefecf3b2078b0a6a2e925271bb6f4cfa \
Expand Down Expand Up @@ -150,19 +146,18 @@ docutils==0.21.2 \
exceptiongroup==1.3.1 \
--hash=sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219 \
--hash=sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598
# via -r CI/requirements_ci.in
filelock==3.25.2 \
--hash=sha256:b64ece2b38f4ca29dd3e810287aa8c48182bbecd1ae6e9ae126c9b35f1382694 \
--hash=sha256:ca8afb0da15f229774c9ad1b455ed96e85a81373065fb10446672f64444ddf70
# via
# -r requirements_ci.in
# anyio
filelock==3.19.1 \
--hash=sha256:66eda1888b0171c998b35be2bcc0f6d75c388a7ce20c3f3f37aa8e96c2dddf58 \
--hash=sha256:d38e30481def20772f5baf097c122c3babc4fcdb7e14e57049eb9d88c6dc017d
# via
# python-discovery
# tox
# virtualenv
flit==3.12.0 \
--hash=sha256:1c80f34dd96992e7758b40423d2809f48f640ca285d0b7821825e50745ec3740 \
--hash=sha256:2b4e7171dc22881fa6adc2dbf083e5ecc72520be3cd7587d2a803da94d6ef431
# via -r requirements_ci.in
# via -r CI/requirements_ci.in
flit-core==3.12.0 \
--hash=sha256:18f63100d6f94385c6ed57a72073443e1a71a4acb4339491615d0f16d6ff01b2 \
--hash=sha256:e7a0304069ea895172e3c7bb703292e992c5d1555dd1233ab7b5621b5b69e62c
Expand Down Expand Up @@ -194,16 +189,17 @@ mdurl==0.1.2 \
--hash=sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8 \
--hash=sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba
# via markdown-it-py
packaging==25.0 \
--hash=sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484 \
--hash=sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f
packaging==26.0 \
--hash=sha256:00243ae351a257117b6a241061796684b084ed1c516a08c48a3f7e147a9d80b4 \
--hash=sha256:b36f1fef9334a5588b4166f8bcd26a14e521f2b55e6b9de3aaa80d3ff7a37529
# via
# pyproject-api
# tox
platformdirs==4.4.0 \
--hash=sha256:abd01743f24e5287cd7a5db3752faf1a2d65353f38ec26d98e25a6db65958c85 \
--hash=sha256:ca753cf4d81dc309bc67b0ea38fd15dc97bc30ce419a7f58d13eb3bf14c4febf
platformdirs==4.9.4 \
--hash=sha256:1ec356301b7dc906d83f371c8f487070e99d3ccf9e501686456394622a01a934 \
--hash=sha256:68a9a4619a666ea6439f2ff250c12a853cd1cbd5158d258bd824a7df6be2f868
# via
# python-discovery
# tox
# virtualenv
pluggy==1.6.0 \
Expand Down Expand Up @@ -330,10 +326,16 @@ pygments==2.19.1 \
--hash=sha256:61c16d2a8576dc0649d9f39e089b5f02bcd27fba10d8fb4dcc28173f7a45151f \
--hash=sha256:9ea1544ad55cecf4b8242fab6dd35a93bbce657034b0611ee383099054ab6d8c
# via rich
pyproject-api==1.9.1 \
--hash=sha256:43c9918f49daab37e302038fc1aed54a8c7a91a9fa935d00b9a485f37e0f5335 \
--hash=sha256:7d6238d92f8962773dd75b5f0c4a6a27cce092a14b623b811dba656f3b628948
pyproject-api==1.10.0 \
--hash=sha256:40c6f2d82eebdc4afee61c773ed208c04c19db4c4a60d97f8d7be3ebc0bbb330 \
--hash=sha256:8757c41a79c0f4ab71b99abed52b97ecf66bd20b04fa59da43b5840bac105a09
# via tox
python-discovery==1.2.1 \
--hash=sha256:180c4d114bff1c32462537eac5d6a332b768242b76b69c0259c7d14b1b680c9e \
--hash=sha256:b6a957b24c1cd79252484d3566d1b49527581d46e789aaf43181005e56201502
# via
# tox
# virtualenv
python-dotenv==1.0.1 \
--hash=sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca \
--hash=sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a
Expand Down Expand Up @@ -408,28 +410,27 @@ tomli==2.4.0 \
--hash=sha256:d20b797a5c1ad80c516e41bc1fb0443ddb5006e9aaa7bda2d71978346aeb9132 \
--hash=sha256:d3d1654e11d724760cdb37a3d7691f0be9db5fbdaef59c9f532aabf87006dbaa \
--hash=sha256:d878f2a6707cc9d53a1be1414bbb419e629c3d6e67f69230217bb663e76b5087
# via
# -r requirements_ci.in
# pyproject-api
# tox
# via -r CI/requirements_ci.in
tomli-w==1.2.0 \
--hash=sha256:188306098d013b691fcadc011abd66727d3c414c571bb01b1a174ba8c983cf90 \
--hash=sha256:2dd14fac5a47c27be9cd4c976af5a12d87fb1f0b4512f81d69cce3b35ae25021
# via flit
# via
# flit
# tox
tomlkit==0.13.2 \
--hash=sha256:7a974427f6e119197f670fbbbeae7bef749a6c14e793db934baefc1b5f03efde \
--hash=sha256:fff5fe59a87295b278abd31bec92c15d9bc4a06885ab12bcea52c71119392e79
# via bump-my-version
tox==4.30.3 \
--hash=sha256:a9f17b4b2d0f74fe0d76207236925a119095011e5c2e661a133115a8061178c9 \
--hash=sha256:f3dd0735f1cd4e8fbea5a3661b77f517456b5f0031a6256432533900e34b90bf
tox==4.52.0 \
--hash=sha256:6054abf5c8b61d58776fbec991f9bf0d34bb883862beb93d2fe55601ef3977c9 \
--hash=sha256:624d8ea4a8c6d5e8d168eedf0e318d736fb22e83ca83137d001ac65ffdec46fd
# via
# -r requirements_ci.in
# -r CI/requirements_ci.in
# tox-gh
tox-gh==1.5.0 \
--hash=sha256:bd4c56d1ebcde4ca2450fed347610a739614a7225945bdc89a67c8395eac9d63 \
--hash=sha256:fd7e8c826f4576a02af4737fd4b738817660b63898c161d6ee8f658c885f7fa1
# via -r requirements_ci.in
tox-gh==1.7.1 \
--hash=sha256:4f4871ee4091b41464f2df9ab1fcedb14a48accdecbb60d53297301a9d8984c6 \
--hash=sha256:a82285b16a597516f9a24f20326b124ddc7924a8b70cb05a9192e1c53d7f701d
# via -r CI/requirements_ci.in
typing-extensions==4.14.1 \
--hash=sha256:38b39f4aeeab64884ce9f74c94263ef78f3c22467c8724005483154c26648d36 \
--hash=sha256:d1e1e3b58374dc93031d6eda2420a48ea44a36c2b4766a4fdeb3710755731d76
Expand All @@ -438,17 +439,14 @@ typing-extensions==4.14.1 \
# exceptiongroup
# pydantic
# pydantic-core
# rich
# rich-click
# tox
# virtualenv
urllib3==2.6.3 \
--hash=sha256:1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed \
--hash=sha256:bf272323e553dfb2e87d9bfd225ca7b0f467b919d7bbd355436d3fd37cb0acd4
# via requests
virtualenv==20.36.1 \
--hash=sha256:575a8d6b124ef88f6f51d56d656132389f961062a9177016a50e4f507bbcc19f \
--hash=sha256:8befb5c81842c641f8ee658481e42641c68b5eab3521d8e092d18320902466ba
virtualenv==21.2.0 \
--hash=sha256:1720dc3a62ef5b443092e3f499228599045d7fea4c79199770499df8becf9098 \
--hash=sha256:1bd755b504931164a5a496d217c014d098426cddc79363ad66ac78125f9d908f
# via tox
wcmatch==10.0 \
--hash=sha256:0dd927072d03c0a6527a20d2e6ad5ba8d0380e60870c383bc533b71744df7b7a \
Expand Down
14 changes: 7 additions & 7 deletions clisops/core/regrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,20 +583,20 @@ def _apply_lsm(self, mask: str | None = None) -> bool:

Parameters
----------
self: Grid
self : Grid
The Grid object to which the mask will be applied.
mask: str, optional
mask : str, optional
Whether to mask "ocean" cells or "land" cells. The default is None.

Raises
------
Warning
If mask is specified but not found in dataset.

Returns
-------
bool
Whether self.lsm was assigned to a 2D-mask in form of a xr.DataArray or not.

Raises
------
UserWarning
If mask is specified but not found in dataset.
"""
if any(maskvar in self.ds for maskvar in ["sftlf", "lsm"]) and mask is not None:
if "sftlf" in self.ds:
Expand Down
9 changes: 4 additions & 5 deletions clisops/ops/base_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ def _remove_redundant_coordinates_attr(ds):
"""
Remove the coordinate attribute added by xarray.

See Also
--------
https://github.com/roocs/clisops/issues/224

Examples
--------
If you have a dataset with a time_bnds variable that has a coordinate attribute:
Expand All @@ -202,11 +206,6 @@ def _remove_redundant_coordinates_attr(ds):
.. code-block:: shell

Warning (cdf_set_var): Inconsistent variable definition for time_bnds!

See Also
--------
https://github.com/roocs/clisops/issues/224

"""
if isinstance(ds, xr.Dataset):
var_list = list(ds.coords) + list(ds.data_vars)
Expand Down
7 changes: 5 additions & 2 deletions tests/test_dataset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,12 @@ def test_determine_lon_lat_range_unstructured(mini_esgf_data):
def test_determine_lon_lat_range_regular_lat_lon(mini_esgf_data):
"""Test the function determine_lon_lat_range for regular lat lon grids."""
with xr.open_mfdataset(mini_esgf_data["CMIP5_TAS"], decode_times=xr.coders.CFDatetimeCoder(use_cftime=True)) as ds:
ds.lat.values[1] = -999.0
# Deal with immutable numpy arrays
lat = ds.lat.values.copy()
lat[1] = -999.0
ds_copy = ds.assign_coords(lat=lat)
with pytest.warns(UserWarning, match="fix is not possible for regular"):
clidu.determine_lon_lat_range(ds, "lon", "lat", "lon_bnds", "lat_bnds", apply_fix=True)
clidu.determine_lon_lat_range(ds_copy, "lon", "lat", "lon_bnds", "lat_bnds", apply_fix=True)


def test_crosses_0_meridian(mini_esgf_data):
Expand Down
Loading