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

default expected coordinates used for plotting should be the dimension coordinates #468

Closed
cpelley opened this issue Apr 19, 2013 · 6 comments

Comments

@cpelley
Copy link

cpelley commented Apr 19, 2013

Currently iris can override the dimension coordinates for plotting if a multidimensional auxiliary coordinate exists:
plot.py: _get_plot_defn

This has unexpected behaviour if for example we have dimension coordinates (1D coordinates) of grid_latitude and grid_longitude and the multidimensional auxiliary longitude and latitude are plotted in their stead. This is unexpected behaviour.

see gist:
https://gist.github.com/cpelley/90e14b4333d2a893e3ad

REQUIRES MERGING OF PR #463 BEFORE THIS CAN BE DONE

@rhattersley
Copy link
Member

the multidimensional auxiliary longitude and latitude are plotted in their stead

Perhaps I'm missing the point here ... but your gist asks for a plot of grid_lat vs grid_lon and that's exactly what I see.
i.e. I see nothing wrong.

REQUIRES MERGING OF PR #465 BEFORE THIS CAN BE DONE

PR #465 just concerns changing the str() representation of a Cube....!?

@cpelley
Copy link
Author

cpelley commented Apr 19, 2013

I am referring to the coordinates chosen if not specified i.e. not providing the coords keyword.
I have updated my gist to avoid further confusion.

Since we can read data in where there will be no grid mapping on the auxiliary coordinates (as it is currently with CF compliant NetCDF files), we should not choose the auxiliary coordinates when the dimension coordinates are present. To add to this argument, the data will likely to have been created on a grid defined by the dimension coordinates, therefore this is the safest default option in any case.

I meant #463, I have updated the description - thanks @rhattersley

@rhattersley
Copy link
Member

I have updated my gist to avoid further confusion.

Thank you. (FWIW, it would be even clearer without the trailing #coords=['grid_latitude', 'grid_longitude']).

REQUIRES MERGING OF PR #463 BEFORE THIS CAN BE DONE

OK, so I tried to re-create this using upstream/master and the problem doesn't occur, so I guess what you're trying to say is that the problem only occurs if you're using the code from #463. But #463 introduces the problem and isn't finished yet .. so it should be resolved there, no? I don't see why it needs a separate issue.

@cpelley
Copy link
Author

cpelley commented Apr 19, 2013

Current behaviour does not allow plotting where more than one coordinate is mapped to a dimension (due to the coords keyword not being passed through) so I'm not sure what you mean by the problem not occuring?

If these coordinates were passed through (as @esc24 has fixed under #465), the coordinates plotted would be the latitude and longitude coordinates even though they are the auxiliary coordinates due to the current logic within the code, see:
plot.py#L154 i.e. not due to the changes made by @esc24

Since I propose changing the behaviour of plotting and it being outside the scope the #463 PR, I have created this issue.

@rhattersley
Copy link
Member

I'm not sure what you mean by the problem not occuring?

On upstream/master your gist results in an error and no plot:

iris.exceptions.CoordinateNotFoundError: u'Expected to find exactly 1 coordinate, but found 2. They were: grid_longitude, longitude.'

So by definition upstream/master cannot be using the wrong coordinates ... it's using neither! ;-)

#463 may not have changed the specific routine you reference, but the mapping code didn't call that code before.

Anyway ... what really matters is: @esc24 - are you happy to sort out the mapping so the default map coordinates are the dimension coordinates where possible?

@esc24
Copy link
Member

esc24 commented Apr 19, 2013

@esc24 - are you happy to sort out the mapping so the default map coordinates are the dimension coordinates where possible

That's fine. Both @cpelley and I hoped the default no specified coords behaviour could be modified in a separate PR. It seems that the use of _get_plot_defn_coords() to simplify #463 means the two are now linked. I'll fix it in #463.

rhattersley added a commit that referenced this issue May 31, 2013
Plotting still uses map where possible even when 2D lat/lon are present.
Allows `coords` argument to select map coordinates when multiple options exist.
Fixes #448 and #468.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants