在一个3D球体在Python绘制圆筒地图数据 [英] Plotting cylindrical map data over a 3D sphere in Python

查看:4754
本文介绍了在一个3D球体在Python绘制圆筒地图数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个星球的圆柱形地图的图像,说其中的一个:

Suppose I have an image with a cylindrical map of a planet, say one of these:

http://www.johnstonsarchive.net/spaceart/cylmaps.html

和我想绘制它通过一个3D球体来恢复地球的原始数字。

And I want to plot it over a 3D sphere to recover the original figure of the planet.

有没有办法使用Python包像matplotlib,Mayavi中,底图或类似办呢?

Is there a way to do it using a Python package like matplotlib, mayavi, basemap or similar?

推荐答案

由于拉斐尔·罗斯的答案我终于找到了我一直在寻找:函数的 warpimage

Thanks to Raphael Roth answer I finally found what I was looking for: the function warpimage.

下面是一个很小的例子。使用金​​星的这种圆柱形地图,以及基于所述的简单的食谱的例子:

Here is a very minimal example. Using this cylindrical map of Venus, and based on the simple example of the cookbook:

from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
# set up orthographic map projection with
# perspective of satellite looking down at 50N, 100W.
# use low resolution coastlines.
# don't plot features that are smaller than 1000 square km.
map = Basemap(projection='ortho', lat_0 = 50, lon_0 = -100,
              resolution = 'l', area_thresh = 1000.)
# plot surface
map.warpimage(image='venuscyl4.jpg')
# draw the edge of the map projection region (the projection limb)
map.drawmapboundary()
# draw lat/lon grid lines every 30 degrees.
map.drawmeridians(np.arange(0, 360, 30))
map.drawparallels(np.arange(-90, 90, 30))
plt.show()

产生以下输出:

produces the following output:

这篇关于在一个3D球体在Python绘制圆筒地图数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆