Skip to content

Commit 0e80f8a

Browse files
committed
Address @rajeeja's pointed case
1 parent 78d6123 commit 0e80f8a

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

uxarray/core/dataset.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,16 @@ def __init__(
9797
ds = args[0]
9898
# Replacee only args[0], `ds`, with `ds.data_vars` as `dict`
9999
args = (dict(ds.data_vars),) + args[1:]
100-
# Set `coords` and `attrs` only if they are not explicitly provided
101-
kwargs.setdefault("coords", dict(ds.coords))
102-
kwargs.setdefault("attrs", ds.attrs)
100+
# coords not passed positionally
101+
if len(args) < 2:
102+
kwargs.setdefault(
103+
"coords", dict(ds.coords)
104+
) # Set it as kwarg only if not explicitly provided
105+
# attrs not passed positionally
106+
if len(args) < 3:
107+
kwargs.setdefault(
108+
"attrs", ds.attrs
109+
) # Set it as kwarg only if not explicitly provided
103110

104111
super().__init__(*args, **kwargs)
105112

0 commit comments

Comments
 (0)