Skip to content

Commit

Permalink
Merge pull request #430 from olemke/fix-warnings
Browse files Browse the repository at this point in the history
Fix several deprecation warnings
  • Loading branch information
olemke authored Nov 14, 2024
2 parents 4b69247 + c82de5b commit d45ba14
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion typhon/files/handlers/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ def _get_dimension_name(ds, group, path, dim):
ancestor_dim = "/".join(
ancestor_groups[1:len(ancestor_groups) - i] + [dim])

ancestor_size = ds.dims.get(ancestor_dim, None)
ancestor_size = ds.sizes.get(ancestor_dim, None)

if ancestor_size is not None \
and group.dimensions[dim].size == ancestor_size:
Expand Down
2 changes: 1 addition & 1 deletion typhon/spectroscopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def linewidth(f, a):
1.571048056449009
"""
s = interpolate.UnivariateSpline(f, a - np.max(a)/2, s=0)
return float(np.diff(s.roots()))
return float(np.diff(s.roots())[0])


def doppler_broadening(t, f0, m):
Expand Down
2 changes: 1 addition & 1 deletion typhon/tests/utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_undo_xarray_floatification(self):
{"a": (["x"], np.array([1, 2, 3], dtype="f4")),
"b": (["x"], np.array([2.0, 3.0, 4.0])),
"c": (["x"], np.array(["2010-01-01", "2010-01-02",
"2010-01-03"], dtype="M8"))})
"2010-01-03"], dtype="M8[ns]"))})
ds["a"].encoding = {"dtype": np.dtype("i4"),
"_FillValue": 1234}
# c should NOT be converted because it's a time
Expand Down
2 changes: 1 addition & 1 deletion typhon/utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ def undo_xarray_floatification(ds, fields=None):

to_correct = {k for (k, v) in ds.data_vars.items()
if v.encoding.get("dtype", np.dtype("O")).kind[0] in "ui" and
not v.dtype.kind in "uiMm"} # don't convert datetime/deltas
v.dtype.kind not in "uiMm"} # don't convert datetime/deltas

if fields is not None:
to_correct &= fields
Expand Down

0 comments on commit d45ba14

Please sign in to comment.