Skip to content

Commit 3fd43da

Browse files
Revert "Do not use len() without comparison to determine if a sequence is empty"
This reverts commit ac49254. FOR TESTING PURPOSES
1 parent 11df2ca commit 3fd43da

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

xarray/computation/fit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def _wrapper(Y, *args, **kwargs):
474474
mask = np.all([np.any(~np.isnan(x), axis=0), ~np.isnan(y)], axis=0)
475475
x = x[:, mask]
476476
y = y[mask]
477-
if y.size == 0:
477+
if not len(y):
478478
popt = np.full([n_params], np.nan)
479479
pcov = np.full([n_params, n_params], np.nan)
480480
return popt, pcov

xarray/core/coordinates.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ def merge(self, other: Mapping[Any, Any] | None) -> Dataset:
549549
"""
550550
from xarray.core.dataset import Dataset
551551

552-
if not other:
552+
if other is None:
553553
return self.to_dataset()
554554

555555
if not isinstance(other, Coordinates):
@@ -567,7 +567,7 @@ def __setitem__(self, key: Hashable, value: Any) -> None:
567567
def update(self, other: Mapping[Any, Any]) -> None:
568568
"""Update this Coordinates variables with other coordinate variables."""
569569

570-
if not other:
570+
if not len(other):
571571
return
572572

573573
other_coords: Coordinates

0 commit comments

Comments
 (0)