对于我正在大学工作的项目的一部分,我正在尝试使用Python重建地球并使用它来绘制表面上的特定位置并绘制各种方向的圆圈,以便它们与我拥有的卫星数据一致从数据集中给出在特定时间飞机位置的表示。
我开始时只需绘制一个线框并在线框上绘制我需要的点(全部按比例缩放地球及其地理位置)。
我遇到的问题是当我在一个球体物体上绘制点时,地球的图像叠加在上面,当球体旋转超过某个点时,点会消失。所以,最初的问题:如何阻止它们消失?
其次;我似乎无法找到任何方法来绘制以球体为中心的圆圈 - 例如,围绕赤道的圆圈然后操纵相同的想法在圆球表面上绘制圆圈以给出如下图像:
我知道这是来自Google地图,但我很好奇是否可以在Python中完成(我假设是这样)。
我目前的代码是:
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from itertools import product, combinations
import PIL
#Plot the Earth
f = plt.figure(1, figsize=(13,13))
ax = f.add_subplot(111, projection='3d')
u, v = np.mgrid[0:2*np.pi:30j, 0:np.pi:20j]
x=6371*np.cos(u)*np.sin(v)
y=6371*np.sin(u)*np.sin(v)
z=6371*np.cos(v)
ax.plot_wireframe(x, y, z, color="b")
#GES ground station @ Perth & AES @ KLIA
ax.scatter([-2368.8],[4881.1],[-3342.0],color="r",s=100)
ax.scatter([-1293.0],[6238.3],[303.5],color="k",s=100)
#Load earthmap with PIL
bm = PIL.Image.open('earthmap.jpg')
#It's big, so I'll rescale it, convert to array, and divide by 256 to get RGB values that matplotlib accept
bm = np.array(bm.resize([d/3 for d in bm.size]))/256.
#d/1 is normal size, anything else is smaller - faster loading time on Uni HPC
#Coordinates of the image - don't know if this is entirely accurate, but probably close
lons = np.linspace(-180, 180, bm.shape[1]) * np.pi/180
lats = np.linspace(-90, 90, bm.shape[0])[::-1] * np.pi/180
#Repeat code specifying face colours
x = np.outer(6371*np.cos(lons), np.cos(lats)).T
y = np.outer(6371*np.sin(lons), np.cos(lats)).T
z = np.outer(6371*np.ones(np.size(lons)), np.sin(lats)).T
ax.plot_surface(x, y, z, rstride=4, cstride=4, facecolors = bm)
plt.show()
如果有任何方法我可以得到它,所以积分停止消失,甚至只在赤道上绘制一个圆圈,这将是伟大的!
谢谢!