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

add quiver-cartopy #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

add quiver-cartopy #33

wants to merge 1 commit into from

Conversation

HoWol76
Copy link
Contributor

@HoWol76 HoWol76 commented Mar 31, 2021

Adding a new blog post about quiver and cartopy

Copy link
Member

@aidanheerdegen aidanheerdegen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're converting to xarray it is best to use the xarray plot methods, which will fix the issue in cell 7.

So this works:

ds.plot.quiver(x='lon', y='lat', u='wind_u', v='wind_v', 
               pivot='mid', transform=ccrs.PlateCarree())

In general the xarray plot methods add so much that their use should be encouraged.

I know there are many many ways to do the same action in matplotlib, but personally I think it is confusing calling plt.subplots when there is only one plot.

fig, ax = plt.subplots(figsize=(16, 8), 
          subplot_kw={'projection': ccrs.PlateCarree(central_longitude=180)}
)

This is the formulation I typically see used and think it is clearer what is being done:

plt.figure(figsize=(16, 8))
ax = plt.axes(projection=ccrs.PlateCarree(central_longitude=180))

but that is up to your discretion clearly.

With the last example I think you should note in the text that arrows are automatically scaled, but in this case you have manually altered the scale, and how that works (counterintuitively it seems). Also you've set the width, might be worth mentioning why you did this, and what the default value is (maybe that is installation dependent?, not sure).

@HoWol76
Copy link
Contributor Author

HoWol76 commented Mar 31, 2021

ds.plot.quiver has only been added to xarray in February 2021. It makes most of what this blog post is talking about obsolete.

@aidanheerdegen
Copy link
Member

Still worth putting it up IMO, highlighting the new functionality.

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

Successfully merging this pull request may close these issues.

2 participants