"Basemap中的重复地图"

2024-09-27 00:21:23 发布

您现在位置:Python中文网/ 问答频道 /正文

如何在卫星轨道的基线图中重复绘制经度图?你知道吗

Like this map

为了有一个连续的卫星轨道,我尝试了不同的llcrnrlonurcrnrlon。对于主值为180的集合llcrnrlon=-180urcrnrlon(意图重复某些子午线),basemap不生成地图

This is the current map of the satellite track


Tags: themap地图绘制this意图likebasemap
1条回答
网友
1楼 · 发布于 2024-09-27 00:21:23

您可以将最小值-360传递给llcrnrlon,将最大值720传递给urcrnrlon(在更大的范围内Basemap会抱怨)。在这种设置下,Basemap的一些函数会产生重复的图像。最好只是举个例子:

from matplotlib import pyplot as plt
from mpl_toolkits import basemap
import numpy as np
fig, ax = plt.subplots(figsize=(15,6))

lonmin = -360
lonmax = 720
latmin = -90
latmax = 90

##setting up the map
bmp = basemap.Basemap(
    ax=ax,
    llcrnrlat=latmin, llcrnrlon=lonmin,
    urcrnrlat=latmax, urcrnrlon=lonmax,
    )
bmp.drawcoastlines()
bmp.drawcountries()
bmp.drawmapboundary(fill_color='cyan')
bmp.fillcontinents(color='coral')
##bmp.arcgisimage() <  does not work
##bmp.bluemarble() <  works to some extent

##drawing a fake track
lons = np.linspace(lonmin, lonmax, 200)
rads = lons/150*np.pi
lats = np.sin(rads)*0.95*latmax
bmp.plot(lons,lats, 'r ', lw=5)
plt.show()

生成的图像如下所示:

result of the above code

如您所见,地图的最后一部分(右侧)不再绘制,因此最好将自己限制为urcrnrlon的最大值540。我还有两个背景图像函数。arcgisimage()抛出一个错误,即它无法处理跨越日边界的地图,但bluemarble()有效,即使只在较小的区域。如果您想让地图更频繁地重复,我认为您必须stitch将多个轴组合在一起,然后将数据拆分为多个部分,然后在相应的地图上绘制这些部分。你知道吗

相关问题 更多 >

    热门问题