我正在使用Basemap绘制地图,如下所示:
lat_0 = 49
lat_1 = 60.16
lon_1 = -109.8
lon_0 = -120.2
m1 = Basemap(projection='ortho', lon_0=lon_0, lat_0=lat_0, resolution=None)
map = Basemap(projection='ortho',lon_0=lon_0,lat_0=lat_0,resolution='f',\
llcrnrx=0.,llcrnry=0.,urcrnrx=m1.urcrnrx/15.,urcrnry=m1.urcrnry/10.)
现在,如果我将分辨率设置为c
或l
,则运行正常,如果我将分辨率提高到i
,h
或f
- 它抛出以下Traceback异常:
Traceback (most recent call last):
File ".\WindDataAnalyze.py", line 277, in <module>
DrawFig()
File ".\WindDataAnalyze.py", line 188, in DrawFig
llcrnrx=0.,llcrnry=0.,urcrnrx=m1.urcrnrx/15.,urcrnry=m1.urcrnry/10.)
File "C:\Users\User\Anaconda3\lib\site- packages\mpl_toolkits\basemap\__init__.py", line 1112, in __init__
self._readboundarydata('gshhs',as_polygons=True)
File "C:\Users\User\Anaconda3\lib\site- packages\mpl_toolkits\basemap\__init__.py", line 1456, in _readboundarydata
if not poly.is_valid(): poly=poly.fix()
File "_geoslib.pyx", line 242, in _geoslib.BaseGeometry.fix (src/_geoslib.c:2279)
File "_geoslib.pyx", line 346, in _geoslib.Polygon.__init__ (src/_geoslib.c:3609)
IndexError: index -1 is out of bounds for axis 0 with size 0
我认为,它与投影ortho
有关,因为投影lcc
适用于全分辨率。
我无能为力。非常感谢任何帮助。
谢谢!