Skip to content

Commit 32fb1a9

Browse files
committed
Change .drop to .drop_vars, solve test and some code typo
1 parent 9312d1c commit 32fb1a9

5 files changed

Lines changed: 13 additions & 13 deletions

File tree

lenapy/lenapy_ocean.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ def ocean_depth(self):
470470
@property
471471
def mld_theta0(self):
472472

473-
theta0 = self.PT.interp(depth=10).drop("depth")
473+
theta0 = self.PT.interp(depth=10).drop_vars("depth")
474474
mld1 = self.PT.lngeo.isosurface(
475475
theta0 - self.oml_theta0_threshold, "depth", upper=True
476476
)
@@ -491,7 +491,7 @@ def mld_theta0(self):
491491
@property
492492
def mld_theta0minus_only(self):
493493

494-
theta0 = self.PT.interp(depth=10).drop("depth")
494+
theta0 = self.PT.interp(depth=10).drop_vars("depth")
495495
self.mld_theta0_ = (
496496
self.PT.lngeo.isosurface(
497497
theta0 - self.oml_theta0_threshold, "depth", upper=True
@@ -506,7 +506,7 @@ def mld_theta0minus_only(self):
506506
@property
507507
def mld_sigma0(self):
508508

509-
sigma0 = self.sigma0.interp(depth=10).drop("depth")
509+
sigma0 = self.sigma0.interp(depth=10).drop_vars("depth")
510510
self.mld_sigma0_ = (
511511
self.sigma0.lngeo.isosurface(
512512
sigma0 + self.oml_sigma0_threshold, "depth", upper=True
@@ -524,7 +524,7 @@ def mld_sigma0var(self):
524524
ref["PT"] = ref["PT"] - self.oml_theta0_threshold
525525
self.mld_sigma0var_ = (
526526
self.sigma0.lngeo.isosurface(
527-
ref.lnocean.sigma0.drop("depth"), "depth", upper=True
527+
ref.lnocean.sigma0.drop_vars("depth"), "depth", upper=True
528528
)
529529
.rename("OMLD_sigma0var")
530530
.fillna(self.ocean_depth)

lenapy/readers/ocean.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,11 @@ def year(f):
217217
"temp": (
218218
temp.groupby("time.month")
219219
+ climtemp.groupby("time.month").mean("time")
220-
).drop("month"),
220+
).drop_vars("month"),
221221
"psal": (
222222
sal.groupby("time.month")
223223
+ climsal.groupby("time.month").mean("time")
224-
).drop("month"),
224+
).drop_vars("month"),
225225
}
226226
)
227227

@@ -477,7 +477,7 @@ def preproc(ds):
477477
ds = (
478478
ds.set_index(i="longitude", j="latitude", k="Z")
479479
.rename(i="longitude", j="latitude", k="depth")
480-
.drop("timestep")
480+
.drop_vars("timestep")
481481
)
482482
return ds.assign_coords(depth=-ds.depth)
483483

lenapy/utils/geo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,15 +106,15 @@ def isosurface(data, target, dim, coord=None, upper=False):
106106
slice0 = {dim: slice(None, -1)}
107107
slice1 = {dim: slice(1, None)}
108108

109-
field0 = data.isel(slice0).drop(coord)
110-
field1 = data.isel(slice1).drop(coord)
109+
field0 = data.isel(slice0).drop_vars(coord)
110+
field1 = data.isel(slice1).drop_vars(coord)
111111

112112
crossing_mask_decr = (field0 > target) & (field1 <= target)
113113
crossing_mask_incr = (field0 < target) & (field1 >= target)
114114
crossing_mask = xr.where(crossing_mask_decr | crossing_mask_incr, 1, np.nan)
115115

116-
coords0 = crossing_mask * data[coord].isel(slice0).drop(coord)
117-
coords1 = crossing_mask * data[coord].isel(slice1).drop(coord)
116+
coords0 = crossing_mask * data[coord].isel(slice0).drop_vars(coord)
117+
coords1 = crossing_mask * data[coord].isel(slice1).drop_vars(coord)
118118
field0 = crossing_mask * field0
119119
field1 = crossing_mask * field1
120120

lenapy/utils/gravity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,7 @@ def sh_to_deflection_of_vertical(
13541354
radius=radius,
13551355
ellipsoidal_earth=ellipsoidal_earth,
13561356
normalization_plm=normalization_plm,
1357-
dtype=dtype_plm,
1357+
dtype_plm=dtype_plm,
13581358
use_dask=use_dask,
13591359
chunks_lfactor=chunks_lfactor,
13601360
chunks_plm=chunks_plm,

lenapy/utils/harmo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ def _prefix_parser(unit: str) -> float:
13251325
----------
13261326
unit : str
13271327
Unit name that may include a prefix. The function accepts common ASCII and Unicode forms for the micro prefix
1328-
(both 'u' and 'µ') and is case\-sensitive where relevant (e.g. 'M' for mega vs 'm' for milli).
1328+
(both 'u' and 'µ') and is case-sensitive where relevant (e.g. 'M' for mega vs 'm' for milli).
13291329
13301330
Unit cannot be defined using 'm' for milli because it is used for meter unit,
13311331
so 'milli' or 'mm' should be used instead. Same for 'p' for pico, 'pico' should be used instead.

0 commit comments

Comments
 (0)