cf-xarray 0.10.2__tar.gz → 0.10.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/PKG-INFO +1 -1
- cf_xarray-0.10.4/cf_xarray/_version.py +1 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/accessor.py +27 -6
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/parametric.py +1 -1
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/tests/test_accessor.py +16 -7
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray.egg-info/PKG-INFO +1 -1
- cf_xarray-0.10.2/cf_xarray/_version.py +0 -1
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/.binder/environment.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/.deepsource.toml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/.github/dependabot.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/.github/release.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/.github/workflows/ci.yaml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/.github/workflows/parse_logs.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/.github/workflows/pypi.yaml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/.github/workflows/testpypi-release.yaml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/.github/workflows/upstream-dev-ci.yaml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/.gitignore +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/.pre-commit-config.yaml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/.readthedocs.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/.tributors +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/CITATION.cff +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/LICENSE +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/README.rst +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/__init__.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/coding.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/criteria.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/datasets.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/formatting.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/geometry.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/groupers.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/helpers.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/options.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/py.typed +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/scripts/make_doc.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/scripts/print_versions.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/sgrid.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/tests/__init__.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/tests/conftest.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/tests/test_coding.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/tests/test_geometry.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/tests/test_groupers.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/tests/test_helpers.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/tests/test_options.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/tests/test_parametric.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/tests/test_scripts.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/tests/test_units.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/units.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray/utils.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray.egg-info/SOURCES.txt +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray.egg-info/dependency_links.txt +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray.egg-info/requires.txt +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/cf_xarray.egg-info/top_level.txt +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/ci/doc.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/ci/environment-all-min-deps.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/ci/environment-no-optional-deps.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/ci/environment.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/ci/upstream-dev-env.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/codecov.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/2D_bounds_averaged.png +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/2D_bounds_error.png +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/2D_bounds_nonunique.png +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/Makefile +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/_static/dataset-diagram-logo.tex +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/_static/full-logo.png +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/_static/logo.png +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/_static/logo.svg +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/_static/rich-repr-example.png +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/_static/style.css +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/api.rst +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/bounds.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/cartopy_rotated_pole.png +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/coding.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/conf.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/contributing.rst +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/coord_axes.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/custom-criteria.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/dsg.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/examples/introduction.ipynb +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/faq.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/flags.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/geometry.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/grid_mappings.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/howtouse.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/index.rst +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/make.bat +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/parametricz.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/plotting.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/provenance.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/quickstart.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/roadmap.rst +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/selecting.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/sgrid_ugrid.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/units.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/doc/whats-new.rst +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/pyproject.toml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.4}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.10.4"
|
|
@@ -24,11 +24,29 @@ from typing import (
|
|
|
24
24
|
|
|
25
25
|
import xarray as xr
|
|
26
26
|
from xarray import DataArray, Dataset
|
|
27
|
-
from xarray.core.arithmetic import SupportsArithmetic
|
|
28
27
|
from xarray.core.groupby import GroupBy
|
|
29
28
|
from xarray.core.resample import Resample
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
|
|
30
|
+
try:
|
|
31
|
+
from xarray.core.rolling import ( # type:ignore[import-not-found,no-redef,unused-ignore]
|
|
32
|
+
Coarsen,
|
|
33
|
+
Rolling,
|
|
34
|
+
)
|
|
35
|
+
except ImportError:
|
|
36
|
+
from xarray.computation.rolling import ( # type:ignore[import-not-found,no-redef,unused-ignore]
|
|
37
|
+
Coarsen,
|
|
38
|
+
Rolling,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
try:
|
|
42
|
+
from xarray.core.weighted import (
|
|
43
|
+
Weighted, # type:ignore[import-not-found,no-redef,unused-ignore]
|
|
44
|
+
)
|
|
45
|
+
except ImportError:
|
|
46
|
+
from xarray.computation.weighted import ( # type:ignore[import-not-found,no-redef,unused-ignore]
|
|
47
|
+
Weighted,
|
|
48
|
+
)
|
|
49
|
+
|
|
32
50
|
|
|
33
51
|
from . import parametric, sgrid
|
|
34
52
|
from .criteria import (
|
|
@@ -997,7 +1015,7 @@ def _possible_x_y_plot(obj, key, skip=None):
|
|
|
997
1015
|
return _get_possible(obj.cf, y_criteria)
|
|
998
1016
|
|
|
999
1017
|
|
|
1000
|
-
class _CFWrappedClass
|
|
1018
|
+
class _CFWrappedClass:
|
|
1001
1019
|
"""
|
|
1002
1020
|
This class is used to wrap any class in _WRAPPED_CLASSES.
|
|
1003
1021
|
"""
|
|
@@ -2727,7 +2745,9 @@ class CFDatasetAccessor(CFAccessor):
|
|
|
2727
2745
|
results[v].append(k)
|
|
2728
2746
|
return results
|
|
2729
2747
|
|
|
2730
|
-
def decode_vertical_coords(
|
|
2748
|
+
def decode_vertical_coords(
|
|
2749
|
+
self, *, outnames: dict[str, str] | None = None, prefix: str | None = None
|
|
2750
|
+
) -> None:
|
|
2731
2751
|
"""
|
|
2732
2752
|
Decode parameterized vertical coordinates in place.
|
|
2733
2753
|
|
|
@@ -2765,6 +2785,7 @@ class CFDatasetAccessor(CFAccessor):
|
|
|
2765
2785
|
allterms = self.formula_terms
|
|
2766
2786
|
|
|
2767
2787
|
for dim in allterms:
|
|
2788
|
+
dim = cast(str, dim)
|
|
2768
2789
|
if prefix is None:
|
|
2769
2790
|
assert outnames is not None, (
|
|
2770
2791
|
"if prefix is None, outnames must be provided"
|
|
@@ -2810,7 +2831,7 @@ class CFDatasetAccessor(CFAccessor):
|
|
|
2810
2831
|
f"Coordinate function for {stdname!r} not implmented yet. Contributions welcome!"
|
|
2811
2832
|
) from None
|
|
2812
2833
|
|
|
2813
|
-
ds.coords[zname] = transform.from_terms(terms)
|
|
2834
|
+
ds.coords[zname] = transform.from_terms(terms).decode()
|
|
2814
2835
|
|
|
2815
2836
|
|
|
2816
2837
|
@xr.register_dataarray_accessor("cf")
|
|
@@ -782,7 +782,7 @@ class OceanDoubleSigma(ParametricVerticalCoordinate):
|
|
|
782
782
|
return cls(**get_terms(terms, "sigma", "depth", "z1", "z2", "a", "href", "k_c"))
|
|
783
783
|
|
|
784
784
|
|
|
785
|
-
TRANSFORM_FROM_STDNAME = {
|
|
785
|
+
TRANSFORM_FROM_STDNAME: dict[str, type[ParametricVerticalCoordinate]] = {
|
|
786
786
|
"atmosphere_ln_pressure_coordinate": AtmosphereLnPressure,
|
|
787
787
|
"atmosphere_sigma_coordinate": AtmosphereSigma,
|
|
788
788
|
"atmosphere_hybrid_sigma_pressure_coordinate": AtmosphereHybridSigmaPressure,
|
|
@@ -1306,15 +1306,25 @@ def test_Z_vs_vertical_ROMS() -> None:
|
|
|
1306
1306
|
|
|
1307
1307
|
|
|
1308
1308
|
def test_decode_vertical_coords() -> None:
|
|
1309
|
+
# Fixes 'UnboundLocalError: cannot access local variable 'romsds' where it is not associated with a value'
|
|
1310
|
+
from ..datasets import romsds
|
|
1311
|
+
|
|
1312
|
+
# needs standard names on `eta` and `depth` to derive computed standard name
|
|
1313
|
+
romsds.h.attrs["standard_name"] = "sea_floor_depth_below_geopotential_datum"
|
|
1314
|
+
romsds.zeta.attrs["standard_name"] = "sea_surface_height_above_geopotential_datum"
|
|
1315
|
+
|
|
1316
|
+
romsds.cf.decode_vertical_coords(outnames={"s_rho": "z_rho"})
|
|
1317
|
+
|
|
1318
|
+
assert romsds.z_rho.shape == (2, 30)
|
|
1319
|
+
assert romsds.z_rho.attrs["standard_name"] == "height_above_geopotential_datum"
|
|
1320
|
+
|
|
1321
|
+
romsds = romsds.drop_vars("z_rho")
|
|
1322
|
+
|
|
1309
1323
|
with pytest.raises(
|
|
1310
1324
|
AssertionError, match="if prefix is None, outnames must be provided"
|
|
1311
1325
|
):
|
|
1312
1326
|
romsds.cf.decode_vertical_coords()
|
|
1313
1327
|
|
|
1314
|
-
# needs standard names on `eta` and `depth` to derive computed standard name
|
|
1315
|
-
romsds.h.attrs["standard_name"] = "sea_floor_depth_below_ geopotential_datum"
|
|
1316
|
-
romsds.zeta.attrs["standard_name"] = "sea_surface_height_above_ geopotential_datum"
|
|
1317
|
-
|
|
1318
1328
|
with pytest.warns(DeprecationWarning):
|
|
1319
1329
|
romsds.cf.decode_vertical_coords(prefix="z_rho")
|
|
1320
1330
|
|
|
@@ -1514,15 +1524,14 @@ def test_groupby_special_ops() -> None:
|
|
|
1514
1524
|
grouped = airds.groupby_bins("lat", np.arange(20, 50, 10))
|
|
1515
1525
|
|
|
1516
1526
|
# __iter__
|
|
1517
|
-
for (label, group), (cflabel, cfgroup) in zip(grouped, cfgrouped, strict=
|
|
1527
|
+
for (label, group), (cflabel, cfgroup) in zip(grouped, cfgrouped, strict=True):
|
|
1518
1528
|
assert label == cflabel
|
|
1519
1529
|
assert_identical(group, cfgroup)
|
|
1520
1530
|
|
|
1521
1531
|
# arithmetic
|
|
1522
1532
|
# TODO: Extremely buggy!
|
|
1523
1533
|
# 1. cfgrouped - cfgrouped.mean() raises RecursionError
|
|
1524
|
-
|
|
1525
|
-
with xr.set_options(keep_attrs=True):
|
|
1534
|
+
with xr.set_options(keep_attrs=True, use_flox=True):
|
|
1526
1535
|
expected = grouped - grouped.mean()
|
|
1527
1536
|
actual = grouped - cfgrouped.mean()
|
|
1528
1537
|
assert_identical(expected, actual)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.10.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|