You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TypeError Traceback (most recent call last)
Cell In[8], line 19
13 cs = ax.contourf(lons, lats, data,
14 cmap=plt.cm.terrain,
15 levels=np.linspace(-2800, data.max(), 10),
16 transform=ccrs.PlateCarree())
18 clip_contours_by_map(cs, map_polygon)
---> 19 draw_maps(map_polygon, color='black', linewidth=1)
21 plt.show()
File D:\anaconda3\envs\grib\Lib\site-packages\cnmaps\drawing.py:312, in draw_maps(maps, ax, **kwargs)
290 """
291 绘制多个地图边界
292
(...)
309 2 中华人民共和国 北京市 北京市 朝阳区 区县 高德 陆地 MULTIPOLYGON (((116.55172 40.05812, 116.55132 ...
310 """
311 if isinstance(maps, list):
--> 312 geometries = [m["geometry"] for m in maps]
313 elif isinstance(maps, GeoDataFrame):
314 geometries = [m["geometry"] for _, m in maps.iterrows()]
File D:\anaconda3\envs\grib\Lib\site-packages\cnmaps\drawing.py:312, in <listcomp>(.0)
290 """
291 绘制多个地图边界
292
(...)
309 2 中华人民共和国 北京市 北京市 朝阳区 区县 高德 陆地 MULTIPOLYGON (((116.55172 40.05812, 116.55132 ...
310 """
311 if isinstance(maps, list):
--> 312 geometries = [m["geometry"] for m in maps]
313 elif isinstance(maps, GeoDataFrame):
314 geometries = [m["geometry"] for _, m in maps.iterrows()]
File D:\anaconda3\envs\grib\Lib\site-packages\shapely\geometry\base.py:1011, in BaseMultipartGeometry.__getitem__(self, index)
1006 warn(
1007 "__getitem__ for multi-part geometries is deprecated and will be removed in "
1008 "Shapely 2.0. Use the `geoms` property to access the constituent parts of "
1009 "a multi-part geometry.", ShapelyDeprecationWarning, stacklevel=2)
1010 if not self.is_empty:
-> 1011 return self.geoms[index]
1012 else:
1013 return ()[index]
File D:\anaconda3\envs\grib\Lib\site-packages\shapely\geometry\base.py:1113, in GeometrySequence.__getitem__(self, key)
1111 return type(self.__p__)(res or None)
1112 else:
-> 1113 raise TypeError("key must be an index or slice")
TypeError: key must be an index or slice
The text was updated successfully, but these errors were encountered:
python版本3.11.5
代码:
报错如下:
The text was updated successfully, but these errors were encountered: