-
-
Notifications
You must be signed in to change notification settings - Fork 427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added methods from xr.Dataset #1254
Conversation
Added the methods: |
Tasks:
|
Hi all, I have created the wrapper function for adding xr.Dataset methods:
Please review, so I can implement it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not reviewed everything completely yet, will get to it whenever I have time. There is one issue that needs some discussion between us though, so I'll push for a lab meeting.
There are also several comments on docs which could also be tackled on a follow-up PR if desired.
arviz/data/inference_data.py
Outdated
for key, value in kwargs.items(): | ||
if not set(value).difference(dataset.dims): | ||
kwarg_dict[key] = value | ||
dataset = dataset.stack(**kwarg_dict) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have not tried yet, so could be completely wrong, please check. I fear that the loop will only work for one of the ways of calling stack (first example), and not the other (second example). I would find this quite confusing. Here are the two examples:
arr = xr.DataArray(
np.arange(6).reshape(2, 3),
coords=[("x", ["a", "b"]), ("y", [0, 1, 2])]
)
example_1= arr.stack(z=("x", "y"))
example_2 = arr.stack({"z": ("x", "y")})
Note: I think idata.sel
does the same too, so we should probably decide what do want ArviZ to do automatically and if this behaviour of kwargs working automatically vs dicts not working automatically is desired or should be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you're probably right. I have done the changes for the stack. Should I also correct other methods too, or wait for the lab-meeting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd wait for lab meeting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, I don't remember what was decided in the lab-meeting. Is it discussed? What to do in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OriolAbril What about this one?
@OriolAbril multiple tests are failing for this PR, can you help? |
I don't have time to fix mpl right now so I temporally pinned the version to <3.3 until we can make ArviZ code compatible with 3.3, I think this should fix the issues and get ci to pass again. see #1305 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's ready to merge, we can polish docs in next PR.
Description
Related to #1066
Checklist