3

cartopy を使用して海底地形データをプロットしようとしています。データの一部を切り取って、メルカトル図法上にプロットします。問題ないように見えるマップを生成しますが、次のエラーが表示されます。

IllegalArgumentException: Invalid number of points in LinearRing found 3 - must be 0 or >= 4
Shell is not a LinearRing

これについて心配する必要がありますか?私のコードは以下のとおりです。

import numpy as np
import matplotlib.pyplot as plt
import matplotlib
matplotlib.rcParams['contour.negative_linestyle'] = 'solid'


import cartopy.crs as ccrs
from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER
import cartopy.feature as cfeature

from netCDF4 import Dataset


# load data and slice out region of interest
_file = 'GEBCO_2014_2D.nc'
gebco = Dataset(_file, mode='r')
g_lons = gebco.variables['lon'][:]
g_lon_inds = np.where((g_lons>=-30) & (g_lons<=10))[0]
g_lons = g_lons[g_lon_inds]
g_lats = gebco.variables['lat'][:]
g_lat_inds = np.where((g_lats>=40) & (g_lats<=65))[0]
g_lats = g_lats[g_lat_inds]
d = gebco.variables['elevation'][g_lat_inds, g_lon_inds]
gebco.close()


# plot data
projection=ccrs.Mercator()
extent = [-30, 10, 40, 65]

fig = plt.figure(figsize=(13.3, 10))                      
ax = fig.add_subplot(111, projection=projection)


lon_labels = np.arange(-30, 20, 10)
lat_labels = np.arange(40, 75, 10)

gl = ax.gridlines(draw_labels=True, xlocs=lon_labels, ylocs=lat_labels)
gl.xlabels_top = gl.ylabels_right = False
gl.xformatter = LONGITUDE_FORMATTER
gl.yformatter = LATITUDE_FORMATTER


ax.set_extent(extent, crs=ccrs.PlateCarree())

coastline_10m = cfeature.NaturalEarthFeature('physical', 'coastline', '10m',
                                        edgecolor='k', alpha=0.6,
                                        facecolor=cfeature.COLORS['land'])
ax.add_feature(coastline_10m)


CS = plt.contour(g_lons, g_lats, d, [-1000,-150], 
                 colors='k', alpha=0.4, linewidth=0.5, zorder=1,
                 transform=ccrs.PlateCarree())
plt.clabel(CS, inline=True, fontsize=10, fmt='%i')
4

0 に答える 0