Skip to content

Commit b32d244

Browse files
authored
Merge pull request #44 from JamesMcClung/compat-fix
Compatibility hotfix
2 parents 392ea28 + 9e7554f commit b32d244

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎src/pscpy/psc.py‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
from __future__ import annotations
22

3+
import warnings
4+
from typing import Any
5+
36
import xarray as xr
47
from typing_extensions import deprecated
58

@@ -31,7 +34,7 @@ def check_psc_output_version(attrs: dict[str, object]) -> None:
3134
@deprecated(
3235
"As of PSC output version v1, `decode_psc`'s only transformative action is to squeeze `time` and rename it to `t` to preserve backwards compatibility. From now on, the officially-supported way to get usable PSC data is to call `xr.open_dataset()` or `xr.open_mfdataset()` with default options."
3336
)
34-
def decode_psc(ds: xr.Dataset) -> xr.Dataset:
37+
def decode_psc(ds: xr.Dataset, *args: Any, **kwargs: Any) -> xr.Dataset:
3538
"""Decode a dataset written by psc (psc_output_version 1.x.y).
3639
3740
Each field component is already its own variable with (z, y, x) dims and
@@ -41,6 +44,12 @@ def decode_psc(ds: xr.Dataset) -> xr.Dataset:
4144
"""
4245
check_psc_output_version(ds.attrs)
4346

47+
if args or kwargs:
48+
warnings.warn(
49+
"Other args to `decode_psc` are no longer used.",
50+
stacklevel=2,
51+
)
52+
4453
if "time" in ds.variables or "time" in ds.dims:
4554
ds = ds.rename(time="t")
4655
if ds.sizes.get("t") == 1:

0 commit comments

Comments
 (0)