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
1 change: 0 additions & 1 deletion cf_xarray/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,6 @@ def _guess_bounds(da, dim=None, out_dim="bounds"):
f"If dim is None, variable {da.name} must be 1D or 2D. Received {da.ndim}D variable instead."
)
dim = da.dims

if not isinstance(dim, str):
if len(dim) > 2:
raise NotImplementedError(
Expand Down
6 changes: 5 additions & 1 deletion cf_xarray/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,11 @@ def points_to_cf(
coord = None
pts_ = pts

x, y, node_count, crdX, crdY = [], [], [], [], []
x: list[np.ndarray] = []
y: list[np.ndarray] = []
node_count: list[int] = []
crdX: list[float] = []
crdY: list[float] = []
for pt in pts_:
if isinstance(pt, MultiPoint):
xy = np.concatenate([p.coords for p in pt.geoms])
Expand Down
2 changes: 1 addition & 1 deletion cf_xarray/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def _guess_bounds_1d(da, dim):
result = xr.concat([first, bounds], dim=dim).transpose(..., "bounds")
if ADDED_INDEX:
result = result.drop_vars(dim)
return result
return result.drop_attrs(deep=False)


def _guess_bounds_2d(da, dims):
Expand Down
3 changes: 3 additions & 0 deletions cf_xarray/tests/test_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,9 @@ def test_add_bounds(dims):
assert_allclose(
added[name].reset_coords(drop=True), expected[dim].transpose(..., "bounds")
)
if dim == "lat":
# The CF axes shouldn't have changed
assert added.cf.axes["Y"] == ["lat"]

_check_unchanged(original, ds)

Expand Down
2 changes: 1 addition & 1 deletion cf_xarray/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def short_formatter(unit, registry, **options):
# Reused with modification from MetPy under the terms of the BSD 3-Clause License.
# Copyright (c) 2015,2017,2019 MetPy Developers.
# Create registry, with preprocessors for UDUNITS-style powers (m2 s-2) and percent signs
units = pint.UnitRegistry(
units: pint.UnitRegistry = pint.UnitRegistry(
autoconvert_offset_to_baseunit=True,
preprocessors=[
functools.partial(
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ docstring-code-format = true


[tool.pytest]
python_files = "test_*.py"
testpaths = ["cf_xarray/tests"]

[tool.rstcheck]
Expand Down
Loading