I want to display some values on a stereographic map (in this case southpole (spstere)). If I display them on a cylindric map (cyl) everything is fine:
m = Basemap(projection='cyl',llcrnrlon=-180,llcrnrlat=-90,urcrnrlon=180,urcrnrlat=90,resolution='i')
CS = m.scatter(lon2,lat2,c=BT2,edgecolors='none',s=sz,cmap='gray')
Now I want the same values on the southpole stereographic map, but I cant get it to work:
m = Basemap(projection='spstere',boundinglat=-10,lon_0=180,resolution='c')
CS = m.scatter(lon2,lat2,c=BT2,edgecolors='none',s=sz,cmap='gray')
What ever I do I only get the continents drawn, but no data.
So I think I have found the answer myself. What you need to do is to convert the lat/lon coordinates from the cylindrical projection into x/y coordinates belonging to the stereographic projection. This is quite simple, after defining the Basemap like this:
m = Basemap(projection='spstere',boundinglat=-10,lon_0=180,resolution='c')
just do the conversion like this:
x,y = m(lon2,lat2)
and finally draw the map with the x/y coordinates e.g.:
CS = m.scatter(x,y,c=BT2,edgecolors='none',s=sz,cmap='gray')
This works for me :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With