cf-xarray 0.10.2__tar.gz → 0.10.3__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.3}/PKG-INFO +1 -1
- cf_xarray-0.10.3/cf_xarray/_version.py +1 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/accessor.py +6 -4
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/parametric.py +1 -1
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/tests/test_accessor.py +16 -7
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/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.3}/.binder/environment.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/.deepsource.toml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/.github/dependabot.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/.github/release.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/.github/workflows/ci.yaml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/.github/workflows/parse_logs.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/.github/workflows/pypi.yaml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/.github/workflows/testpypi-release.yaml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/.github/workflows/upstream-dev-ci.yaml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/.gitignore +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/.pre-commit-config.yaml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/.readthedocs.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/.tributors +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/CITATION.cff +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/LICENSE +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/README.rst +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/__init__.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/coding.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/criteria.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/datasets.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/formatting.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/geometry.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/groupers.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/helpers.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/options.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/py.typed +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/scripts/make_doc.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/scripts/print_versions.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/sgrid.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/tests/__init__.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/tests/conftest.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/tests/test_coding.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/tests/test_geometry.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/tests/test_groupers.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/tests/test_helpers.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/tests/test_options.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/tests/test_parametric.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/tests/test_scripts.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/tests/test_units.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/units.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray/utils.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray.egg-info/SOURCES.txt +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray.egg-info/dependency_links.txt +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray.egg-info/requires.txt +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/cf_xarray.egg-info/top_level.txt +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/ci/doc.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/ci/environment-all-min-deps.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/ci/environment-no-optional-deps.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/ci/environment.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/ci/upstream-dev-env.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/codecov.yml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/2D_bounds_averaged.png +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/2D_bounds_error.png +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/2D_bounds_nonunique.png +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/Makefile +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/_static/dataset-diagram-logo.tex +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/_static/full-logo.png +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/_static/logo.png +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/_static/logo.svg +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/_static/rich-repr-example.png +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/_static/style.css +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/api.rst +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/bounds.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/cartopy_rotated_pole.png +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/coding.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/conf.py +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/contributing.rst +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/coord_axes.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/custom-criteria.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/dsg.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/examples/introduction.ipynb +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/faq.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/flags.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/geometry.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/grid_mappings.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/howtouse.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/index.rst +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/make.bat +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/parametricz.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/plotting.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/provenance.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/quickstart.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/roadmap.rst +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/selecting.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/sgrid_ugrid.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/units.md +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/doc/whats-new.rst +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/pyproject.toml +0 -0
- {cf_xarray-0.10.2 → cf_xarray-0.10.3}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.10.3"
|
|
@@ -24,7 +24,6 @@ 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
29
|
from xarray.core.rolling import Coarsen, Rolling
|
|
@@ -997,7 +996,7 @@ def _possible_x_y_plot(obj, key, skip=None):
|
|
|
997
996
|
return _get_possible(obj.cf, y_criteria)
|
|
998
997
|
|
|
999
998
|
|
|
1000
|
-
class _CFWrappedClass
|
|
999
|
+
class _CFWrappedClass:
|
|
1001
1000
|
"""
|
|
1002
1001
|
This class is used to wrap any class in _WRAPPED_CLASSES.
|
|
1003
1002
|
"""
|
|
@@ -2727,7 +2726,9 @@ class CFDatasetAccessor(CFAccessor):
|
|
|
2727
2726
|
results[v].append(k)
|
|
2728
2727
|
return results
|
|
2729
2728
|
|
|
2730
|
-
def decode_vertical_coords(
|
|
2729
|
+
def decode_vertical_coords(
|
|
2730
|
+
self, *, outnames: dict[str, str] | None = None, prefix: str | None = None
|
|
2731
|
+
) -> None:
|
|
2731
2732
|
"""
|
|
2732
2733
|
Decode parameterized vertical coordinates in place.
|
|
2733
2734
|
|
|
@@ -2765,6 +2766,7 @@ class CFDatasetAccessor(CFAccessor):
|
|
|
2765
2766
|
allterms = self.formula_terms
|
|
2766
2767
|
|
|
2767
2768
|
for dim in allterms:
|
|
2769
|
+
dim = cast(str, dim)
|
|
2768
2770
|
if prefix is None:
|
|
2769
2771
|
assert outnames is not None, (
|
|
2770
2772
|
"if prefix is None, outnames must be provided"
|
|
@@ -2810,7 +2812,7 @@ class CFDatasetAccessor(CFAccessor):
|
|
|
2810
2812
|
f"Coordinate function for {stdname!r} not implmented yet. Contributions welcome!"
|
|
2811
2813
|
) from None
|
|
2812
2814
|
|
|
2813
|
-
ds.coords[zname] = transform.from_terms(terms)
|
|
2815
|
+
ds.coords[zname] = transform.from_terms(terms).decode()
|
|
2814
2816
|
|
|
2815
2817
|
|
|
2816
2818
|
@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
|