您好!
在运行下列代码时发生报错:
a=tbd.grid_params_optimize(gps_random, params_rec, col=['veh_id', 'lon', 'lat'],printlog=True)
报错结果:IndexError: index 4 is out of bounds for axis 0 with size 4
Optimized index centerdist: 160.49172936995848
Optimized gridding params: {'slon': 121.14150751824792, 'slat': 31.2536506891721, 'deltalon': 0.005262604989003138, 'deltalat': 0.004496605206422906, 'theta': 61.77597264308154, 'method': 'rect'}
Traceback (most recent call last):
File "E:/Project/transbigdata/transing/栅格处理.py", line 122, in
a=tbd.grid_params_optimize(gps_random, params_rec, col=['veh_id', 'lon', 'lat'],printlog=True)
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\transbigdata\grids.py", line 694, in grid_params_optimize
ax=ax)
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\geopandas\geodataframe.py", line 606, in plot
return plot_dataframe(self, *args, kwargs)
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\geopandas\plotting.py", line 502, in plot_dataframe
style_kwds
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\geopandas\plotting.py", line 341, in plotseries
ax, polys, values, facecolor=facecolor, cmap=cmap, style_kwds
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\geopandas\plotting.py", line 111, in plot_polygon_collection
kwargs[att] = np.take(kwargs[att], multiindex)
File "<__array_function__ internals>", line 6, in take
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\numpy\core\fromnumeric.py", line 190, in take
return _wrapfunc(a, 'take', indices, axis=axis, out=out, mode=mode)
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\numpy\core\fromnumeric.py", line 54, in _wrapfunc
return _wrapit(obj, method, *args, *kwds)
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\numpy\core\fromnumeric.py", line 43, in _wrapit
result = getattr(asarray(obj), method)(args, kwds)
您好! 在运行下列代码时发生报错: a=tbd.grid_params_optimize(gps_random, params_rec, col=['veh_id', 'lon', 'lat'],printlog=True) 报错结果:IndexError: index 4 is out of bounds for axis 0 with size 4
Optimized index centerdist: 160.49172936995848
Optimized gridding params: {'slon': 121.14150751824792, 'slat': 31.2536506891721, 'deltalon': 0.005262604989003138, 'deltalat': 0.004496605206422906, 'theta': 61.77597264308154, 'method': 'rect'}
Traceback (most recent call last):
File "E:/Project/transbigdata/transing/栅格处理.py", line 122, in
a=tbd.grid_params_optimize(gps_random, params_rec, col=['veh_id', 'lon', 'lat'],printlog=True)
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\transbigdata\grids.py", line 694, in grid_params_optimize
ax=ax)
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\geopandas\geodataframe.py", line 606, in plot
return plot_dataframe(self, *args, kwargs)
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\geopandas\plotting.py", line 502, in plot_dataframe
style_kwds
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\geopandas\plotting.py", line 341, in plotseries
ax, polys, values, facecolor=facecolor, cmap=cmap, style_kwds
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\geopandas\plotting.py", line 111, in plot_polygon_collection
kwargs[att] = np.take(kwargs[att], multiindex)
File "<__array_function__ internals>", line 6, in take
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\numpy\core\fromnumeric.py", line 190, in take
return _wrapfunc(a, 'take', indices, axis=axis, out=out, mode=mode)
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\numpy\core\fromnumeric.py", line 54, in _wrapfunc
return _wrapit(obj, method, *args, *kwds)
File "E:\Anaconda3\envs\Bigdata\lib\site-packages\numpy\core\fromnumeric.py", line 43, in _wrapit
result = getattr(asarray(obj), method)(args, kwds)
个人猜测: plotting中的
edgecolor``, ``facecolor
参数缘故导致。 grids.plot(lw=1, edgecolor=(0.8, 0.8, 0.8, 1), facecolor=(0, 0, 0, 0.05), ax=ax) 具体是否这个原因还有待考证,有什么方法可以解决吗? 是因为模块版本原因吗? 希望得到您的解答! 感谢!