Skip to content
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

Plotting datasets with variable coordinates #1503

Open
smillerc opened this issue Aug 6, 2017 · 7 comments
Open

Plotting datasets with variable coordinates #1503

smillerc opened this issue Aug 6, 2017 · 7 comments

Comments

@smillerc
Copy link

smillerc commented Aug 6, 2017

I'm trying to plot a dataset that has variable coordinates, and am getting behavior that is unexpected, and I wonder if it is a design issue or a user issue (i.e. I don't grok xarray). I've posted the question on SO (https://stackoverflow.com/questions/45474153/plotting-xarray-datasets-with-variable-coordinates).

Is the behavior that xarray is showing by design or is it a corner case that I'm getting because I'm not using xarray in the way it was originally intended?

@fmaussion
Copy link
Member

fmaussion commented Aug 6, 2017 via email

@smillerc
Copy link
Author

I think that would work. I've just been trying to understand what the CF conventions mean for me in my use case, where I have a grid that moves over time, but keeps the same number of nodes and cells. I feel like xarray could be a big help, but I'm still trying to figure it out.

Thanks for the quick responses here and on SO.

@dcherian
Copy link
Contributor

dcherian commented Mar 5, 2018

Does this work now?

@fmaussion
Copy link
Member

No it doesn't! Your most recent PR still checks for the kwarg in dims, not in coordinates.

@dcherian
Copy link
Contributor

dcherian commented Mar 6, 2018

Shall I send in a PR to check da.variables then?

@rabernat
Copy link
Contributor

@kthyng & @hetland: this issue is related to our lunch discussion today about how to automatically use multidimensional coordinates when plotting.

@hetland
Copy link

hetland commented Jul 15, 2019

To follow up with this, plotting using 'x' and 'y' kwargs works fine for now, even when the variable coordinates do not share the same number of dimensions. (i.e., a common case of plotting a cross section with sigma- or s-coordinates where the horizontal variable is 1D, but the vertical variable is 2D). So, I think this great, and should cover most use cases.

The only approach I can think of to do this automatically would be to find variable coordinates that have matching dimensions. This would probably work in lots of cases, but unexpectedly break in others. I think I would prefer explicit over clever, unless we can think of a way to do it that won't break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants