Python底图立体图
我想在立体地图上显示一些值(在本例中为南极(spstere))。如果我将它们显示在圆柱形地图(cyl)上,一切都很好:
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')
现在我想在南极立体图上使用相同的值,但我无法让它工作:
m = Basemap(projection='spstere',boundinglat=-10,lon_0=180,resolution='c')
CS = m.scatter(lon2,lat2,c=BT2,edgecolors='none',s=sz,cmap='gray')
无论我做什么,我都只得到绘制了大陆,但没有数据。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
所以我想我自己已经找到了答案。您需要做的是将圆柱投影的纬度/经度坐标转换为属于球极投影的 x/y 坐标。这非常简单,在像这样定义底图之后:
只需进行这样的转换:
最后用 x/y 坐标绘制地图,例如:
这对我有用:)
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:
just do the conversion like this:
and finally draw the map with the x/y coordinates e.g.:
This works for me :)
正如您似乎已经弄清楚的那样,您需要将 x 和 y 坐标转换为“地图”坐标(可以在 http://matplotlib.github.com/basemap/users/mapcoords.html):
As you seem to have already figured out, you need to transform your x and y coordinates into "map" coordinates (the appropriate documentation can be found at http://matplotlib.github.com/basemap/users/mapcoords.html):
latlon 关键字即可
只需添加文档中的
Just add the latlon keyword
from the documentation: