-
Notifications
You must be signed in to change notification settings - Fork 33
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
to_linecollection issues with projection and global grid wrapping w/ mpl and cartopy #984
Comments
Hi @zarzycki
By default, the values along the date line are being excluded, since they require additional processing to split when we convert our data into geometries. This is indicated by the Here's a reference. # split periodic elements (i.e. those along the dateline)
lc_original = uxds.uxgrid.to_linecollection(periodic_elements='split') This works with your work around. There appears to be a bug in the projection code. I'll get this fixed as part of #922 |
Thanks @philipc2! The user API doesn't mention periodic_elements: https://uxarray.readthedocs.io/en/v2024.02.0/user_api/generated/uxarray.Grid.to_linecollection.html Although I thought I tried it and got an error. Maybe I messed something up... FWIW, while that plot looks better, there does appear to be a weird collection of line segments right at the pole. Any idea if that's the mesh or the plotting? I can look later when I have some free time, too. |
That appears to be an older release. here's our latest documentation: https://uxarray.readthedocs.io/en/v2024.08.2/user_api/generated/uxarray.Grid.to_linecollection.html
That's most likely a slight artifact of the split polygons. I can look into it further. |
Gah, I blame Google but I should have checked that. |
Version
v2023.08.4
How did you install UXarray?
Conda
What happened?
I am probably doing something unintelligent, but say I want to print the polylines assocated with a uxarray grid. In theory, this should work with mpl + cartopy...
It gives me the projection but a blank graph:
I can sneak around this by creating the LineCollection with uxarray and then unpacking it and redefining it with a PC projection. The below now gives me grid lines, but it doesn't appear to wrap accurately along the date line (-180/180).
So TL;DR two problems.
If it's just something silly on my end (50/50 chance!), maybe we could add some additional lines to the mpl.ipynb notebook to help.
This may be tied to the periodic_elements option in to_polycollection() although the artifacts here aren't as pervasive.
What did you expect to happen?
Expected to use to_linecollection() to create a grid skeleton I could then draw with different projections using mpl + cartopy.
Can you provide a MCVE to repoduce the bug?
The text was updated successfully, but these errors were encountered: