Skip to content

Commit 562eff8

Browse files
committed
updates:
* update Python test versions * update dependencies * some fixes in `extract_model` to keep things working with `ocean-model-skill-assessor`
1 parent c25ad82 commit 562eff8

13 files changed

+108
-78
lines changed

ci/environment-py3.11-win.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
name: test-env-win
1+
name: test-env-extract-model
22
channels:
33
- conda-forge
44
dependencies:
55
- python=3.11
6-
- cf_xarray>=0.6
6+
- cf_xarray
77
- dask
88
- netcdf4
9-
- numpy #<1.24 # https://github.com/numba/numba/issues/8615#issuecomment-1360792615
9+
- numpy
1010
- pip
1111
- requests
12-
- scikit-learn # used by xoak for tree
12+
- scikit-learn
1313
- xarray
1414
- xoak
15-
# - xroms
1615
- pytest
1716
- pytest-benchmark
1817
- pip:
19-
- xroms >=0.5.3
18+
- xroms >=0.6.2
2019
- codecov
2120
- pytest-cov
2221
- coverage[toml]

ci/environment-py3.11.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: test-env-mac-unix
1+
name: test-env-extract-model
22
channels:
33
- conda-forge
44
dependencies:
@@ -9,15 +9,15 @@ dependencies:
99
- numpy #<1.24 # https://github.com/numba/numba/issues/8615#issuecomment-1360792615
1010
- pip
1111
- requests
12-
- scikit-learn # used by xoak for tree
12+
- scikit-learn
1313
- xarray
1414
- xesmf
1515
- xoak
1616
# - xroms
1717
- pytest
1818
- pytest-benchmark
1919
- pip:
20-
- xroms >=0.5.3
20+
- xroms >=0.6.2
2121
- codecov
2222
- pytest-cov
2323
- coverage[toml]

ci/environment-py3.12-win.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: test-env-win
1+
name: test-env-extract-model
22
channels:
33
- conda-forge
44
dependencies:
@@ -9,14 +9,14 @@ dependencies:
99
- numpy #<1.24 # https://github.com/numba/numba/issues/8615#issuecomment-1360792615
1010
- pip
1111
- requests
12-
- scikit-learn # used by xoak for tree
12+
- scikit-learn
1313
- xarray
1414
- xoak
1515
# - xroms
1616
- pytest
1717
- pytest-benchmark
1818
- pip:
19-
- xroms >=0.5.3
19+
- xroms >=0.6.2
2020
- codecov
2121
- pytest-cov
2222
- coverage[toml]

ci/environment-py3.12.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
name: test-env-mac-unix
1+
name: test-env-extract-model
22
channels:
33
- conda-forge
44
dependencies:
55
- python=3.12
6-
- cf_xarray>=0.6
6+
- cf_xarray
77
- dask
88
- netcdf4
9-
- numpy #<1.24 # https://github.com/numba/numba/issues/8615#issuecomment-1360792615
9+
- numpy
1010
- pip
1111
- requests
12-
- scikit-learn # used by xoak for tree
12+
- scikit-learn
1313
- xarray
1414
- xesmf
1515
- xoak
1616
# - xroms
1717
- pytest
1818
- pytest-benchmark
1919
- pip:
20-
- xroms >=0.5.3
20+
- xroms >=0.6.2
2121
- codecov
2222
- pytest-cov
2323
- coverage[toml]

ci/environment-py3.10-win.yml renamed to ci/environment-py3.13-win.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
name: test-env-win
1+
name: test-env-extract-model
22
channels:
33
- conda-forge
44
dependencies:
5-
- python=3.10
5+
- python=3.13
66
- cf_xarray>=0.6
77
- dask
88
- netcdf4
99
- numpy #<1.24 # https://github.com/numba/numba/issues/8615#issuecomment-1360792615
1010
- pip
1111
- requests
12-
- scikit-learn # used by xoak for tree
12+
- scikit-learn
1313
- xarray
1414
- xoak
1515
# - xroms
1616
- pytest
1717
- pytest-benchmark
1818
- pip:
19-
- xroms >=0.5.3
19+
- xroms >=0.6.2
2020
- codecov
2121
- pytest-cov
2222
- coverage[toml]

ci/environment-py3.10.yml renamed to ci/environment-py3.13.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
name: test-env-mac-unix
1+
name: test-env-extract-model
22
channels:
33
- conda-forge
44
dependencies:
5-
- python=3.10
5+
- python=3.13
66
- cf_xarray>=0.6
77
- dask
88
- netcdf4
99
- numpy #<1.24 # https://github.com/numba/numba/issues/8615#issuecomment-1360792615
1010
- pip
1111
- requests
12-
- scikit-learn # used by xoak for tree
12+
- scikit-learn
1313
- xarray
1414
- xesmf
1515
- xoak
1616
# - xroms
1717
- pytest
1818
- pytest-benchmark
1919
- pip:
20-
- xroms >=0.5.3
20+
- xroms >=0.6.2
2121
- codecov
2222
- pytest-cov
2323
- coverage[toml]

docs/environment.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ channels:
33
- conda-forge
44
- nodefaults
55
dependencies:
6-
- python=3.8
6+
- python=3.12
77
# If your docs code examples depend on other packages add them here
88
- cf_xarray
99
- cmocean
10-
- dask <=2022.05.0 # for xESMF, https://github.com/axiom-data-science/extract_model/issues/49
10+
- dask
1111
- matplotlib-base
1212
- netcdf4
13-
- numpy <1.24 # https://github.com/numba/numba/issues/8615#issuecomment-1360792615
13+
- numpy
1414
- numba # required by xesmf
1515
- pip
1616
- pooch

docs/whats_new.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
:mod:`What's New`
22
-----------------
33

4+
v1.4.2 (August 27, 2025)
5+
========================
6+
* update Python test versions
7+
* update dependencies
8+
* some fixes in `extract_model` to keep things working with `ocean-model-skill-assessor`
9+
410
v1.4.1 (October 25, 2024)
511
=========================
612
* Small changes so horizontal coordinate search works more consistently with past.

environment.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,24 @@ name: extract_model
22
channels:
33
- conda-forge
44
dependencies:
5-
- python=3.10
5+
- python=3.12
66
# Required for full project functionality (dont remove)
77
- pytest
88
- pytest-benchmark
99
# Examples (remove and add as needed)
1010
- cf_xarray
1111
- cmocean
12-
- dask #<=2022.05.0 # for xESMF, https://github.com/axiom-data-science/extract_model/issues/49
12+
- dask
1313
- extract_model
1414
- matplotlib
1515
- netcdf4
16-
- numpy #<1.24 # https://github.com/numba/numba/issues/8615#issuecomment-1360792615
16+
- numpy
1717
- numba # required by xesmf
1818
- pip
1919
- pooch
2020
- requests
21-
- scikit-learn # used by xoak for tree
2221
- xarray
2322
- xcmocean
2423
- xesmf # don't install if on windows
25-
- xoak
2624
# - pip: # install from github to get recent PRs I contributed
2725
# - [email protected]:xarray-contrib/cf-xarray.git

extract_model/extract_model.py

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -613,11 +613,34 @@ def pt_in_itriangle_proj(ix, iy):
613613
z_attrs = da.cf["vertical"].attrs
614614
z_attrs.update({"axis": "Z"})
615615
zkey = da.cf["vertical"].name
616-
da = xgcm_grid.transform(
617-
da, "Z", np.array(Z), target_data=da.cf["vertical"], method="linear"
618-
)
619-
da[zkey].attrs = z_attrs
620-
da = order(da) # reorder dimensions to convention
616+
if isinstance(da, xr.DataArray):
617+
with warnings.catch_warnings():
618+
warnings.simplefilter("ignore")
619+
da = xgcm_grid.transform(
620+
da, "Z", np.array(Z), target_data=da.cf["vertical"], method="linear"
621+
)
622+
da[zkey].attrs = z_attrs
623+
da = order(da) # reorder dimensions to convention
624+
elif isinstance(da, xr.Dataset):
625+
da_calcs = {}
626+
for data_var in da.data_vars:
627+
if "s_rho" in da.dims:
628+
dause = da[data_var].chunk({"s_rho": -1})#.copy()
629+
else:
630+
dause = da[data_var]
631+
with warnings.catch_warnings():
632+
warnings.simplefilter("ignore")
633+
da_calcs[data_var] = xgcm_grid.transform(
634+
dause,
635+
"Z",
636+
np.array(Z),
637+
target_data=dause.cf["vertical"],
638+
method="linear",
639+
)
640+
da_calcs[data_var][zkey].attrs = z_attrs
641+
for data_var in da_calcs.keys():
642+
da[data_var] = da_calcs[data_var]
643+
da = order(da) # reorder dimensions to convention
621644

622645
# # if the vertical coord is greater than 1D, can only do restricted interpolation
623646
# # at the moment
@@ -902,11 +925,10 @@ def sel2d(
902925
return output
903926

904927
else:
905-
906928
# make sure the mask matches
907929
if mask is not None:
908-
# import pdb; pdb.set_trace()
909-
msg = f"Mask {mask.name} dimensions do not match horizontal var {var.name} dimensions. mask dims: {mask.dims}, var dims: {var.dims}"
930+
msg = f"Mask {mask.name} dimensions do not match horizontal Dataset/DataArray dimensions. mask dims: {mask.dims}, var dims: {var.dims}"
931+
# msg = f"Mask {mask.name} dimensions do not match horizontal var {var.name} dimensions. mask dims: {mask.dims}, var dims: {var.dims}"
910932
assert len(set(mask.dims) - set(var.dims)) == 0, msg
911933

912934
# currently lons, lats 1D only

0 commit comments

Comments
 (0)