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

use of cartopy #13

Open
aymeric-spiga opened this issue Oct 11, 2018 · 5 comments
Open

use of cartopy #13

aymeric-spiga opened this issue Oct 11, 2018 · 5 comments

Comments

@aymeric-spiga
Copy link
Owner

replace basemap by cartopy proposed by @jbmadeleine

@aymeric-spiga
Copy link
Owner Author

standalone example

#! /usr/bin/env python

#import ppplot
import numpy as np



b = np.arange(2048).reshape(32,64)
lon = np.linspace(-180,180,64)
lat = np.linspace(-90,90,32)

print(b.shape)
print(lon.shape)
print(lat.shape)

#ppplot.quickplot(b)


import cartopy.crs as ccrs
import matplotlib.pyplot as plt

prj = ccrs.Mollweide()
prj = ccrs.Orthographic(-10, 45)
#prj = ccrs.NorthPolarStereo()

ax = plt.axes(projection=prj)
#ax.set_xticks(range(-180,180,10), crs=ccrs.NorthPolarStereo())
#ax.set_yticks(range(-90,90,10), crs=ccrs.NorthPolarStereo())

ax.set_global()
#ax.gridlines() 
ax.gridlines(draw_labels=True)
ax.contourf(lon,lat,b,transform=ccrs.PlateCarree())
plt.show()

@aymeric-spiga
Copy link
Owner Author

Traceback (most recent call last):
File "./test.py", line 32, in
ax.gridlines(draw_labels=True)
File "/home/aspiga/soft/conda/miniconda2/envs/cartopy/lib/python2.7/site-packages/cartopy/mpl/geoaxes.py", line 1215, in gridlines
ylocator=ylocs, collection_kwargs=kwargs)
File "/home/aspiga/soft/conda/miniconda2/envs/cartopy/lib/python2.7/site-packages/cartopy/mpl/gridliner.py", line 185, in init
self._assert_can_draw_ticks()
File "/home/aspiga/soft/conda/miniconda2/envs/cartopy/lib/python2.7/site-packages/cartopy/mpl/gridliner.py", line 399, in _assert_can_draw_ticks
'supported.'.format(prj=self.axes.projection))
TypeError: Cannot label gridlines on a Orthographic plot. Only PlateCarree and Mercator plots are currently supported.

@aymeric-spiga
Copy link
Owner Author

This might be solved soon?
SciTools/cartopy#881
SciTools/cartopy#1089

@aymeric-spiga
Copy link
Owner Author

The question is whether it is useful to do so, or if replacing planetoplot by something based on xarray is not a better solution see #8

@aymeric-spiga
Copy link
Owner Author

Looks like some progress is made in cartopy getting the labels like in matplotlib
SciTools/cartopy#1117

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

1 participant