Python 当地球观测卫星靠近两极时,如何使用底图绘制其视野?
我试图画出卫星沿轨道的最大(理论)视场。我使用的是Basemap,我想在它上面绘制沿轨道的不同位置(带有散射),我想使用天梭方法(或等效方法)添加整个视野。 下面的代码可以正常工作,直到纬度达到大约北纬75度,在300公里的高度轨道上。超出该值,代码将输出ValueError: “ValueError:未定义的逆测地线(可能是反足点)” 需要注意的是,代码在南极(纬度低于-75)运行良好。我知道这是一个已知的bug,这个问题有已知的解决方法吗?Python 当地球观测卫星靠近两极时,如何使用底图绘制其视野?,python,matplotlib-basemap,cartopy,satellite,fieldofview,Python,Matplotlib Basemap,Cartopy,Satellite,Fieldofview,我试图画出卫星沿轨道的最大(理论)视场。我使用的是Basemap,我想在它上面绘制沿轨道的不同位置(带有散射),我想使用天梭方法(或等效方法)添加整个视野。 下面的代码可以正常工作,直到纬度达到大约北纬75度,在300公里的高度轨道上。超出该值,代码将输出ValueError: “ValueError:未定义的逆测地线(可能是反足点)” 需要注意的是,代码在南极(纬度低于-75)运行良好。我知道这是一个已知的bug,这个问题有已知的解决方法吗? 谢谢你的帮助 您发现的是Basemap的一些局限性
谢谢你的帮助 您发现的是Basemap的一些局限性。现在让我们切换到Cartopy。工作代码将有所不同,但差别不大
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import math
earth_radius = 6371000.
position = [300000., 75., 0.] # altitude (m), lat, long
radius = math.degrees(math.acos(earth_radius / (earth_radius + position[0])))
print(radius) # in subtended degrees??
fig = plt.figure(figsize=(12,8))
img_extent = [-180, 180, -90, 90]
# here, cartopy's' `PlateCarree` is equivalent with Basemap's `cyl` you use
ax = fig.add_subplot(1, 1, 1, projection = ccrs.PlateCarree(), extent = img_extent)
# for demo purposes, ...
# let's take 1 subtended degree = 112 km on earth surface (*** you set the value as needed ***)
ax.tissot(rad_km=radius*112, lons=position[2], lats=position[1], n_samples=64, \
facecolor='red', edgecolor='black', linewidth=0.15, alpha = 0.3)
ax.coastlines(linewidth=0.15)
ax.gridlines(draw_labels=False, linewidth=1, color='blue', alpha=0.3, linestyle='--')
plt.show()
使用上述代码,生成的绘图为:
现在,如果我们使用正交投影,(用这个替换相关的代码行)
你可以得到这个图:
谢谢您的回答!我相信这就是我想要的。我来试试卡托皮。Cheers我现在讨论这个问题有点晚了,但是可变半径是角度,所以alpha=math.acos(earth_radius/(earth_radius+position[0]);半径=α*地球半径;那么,绘图不应该是这样的:ax.tissot(rad_km=radius/1000。。。。。?
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import math
earth_radius = 6371000.
position = [300000., 75., 0.] # altitude (m), lat, long
radius = math.degrees(math.acos(earth_radius / (earth_radius + position[0])))
print(radius) # in subtended degrees??
fig = plt.figure(figsize=(12,8))
img_extent = [-180, 180, -90, 90]
# here, cartopy's' `PlateCarree` is equivalent with Basemap's `cyl` you use
ax = fig.add_subplot(1, 1, 1, projection = ccrs.PlateCarree(), extent = img_extent)
# for demo purposes, ...
# let's take 1 subtended degree = 112 km on earth surface (*** you set the value as needed ***)
ax.tissot(rad_km=radius*112, lons=position[2], lats=position[1], n_samples=64, \
facecolor='red', edgecolor='black', linewidth=0.15, alpha = 0.3)
ax.coastlines(linewidth=0.15)
ax.gridlines(draw_labels=False, linewidth=1, color='blue', alpha=0.3, linestyle='--')
plt.show()
ax = fig.add_subplot(1, 1, 1, projection = ccrs.Orthographic(central_longitude=0.0, central_latitude=60.0))