Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Ubuntu 16.04的Matplotlib错误_Python_Matplotlib_Python 3.5_Matplotlib Basemap_Ubuntu 16.04 - Fatal编程技术网

Python Ubuntu 16.04的Matplotlib错误

Python Ubuntu 16.04的Matplotlib错误,python,matplotlib,python-3.5,matplotlib-basemap,ubuntu-16.04,Python,Matplotlib,Python 3.5,Matplotlib Basemap,Ubuntu 16.04,我有一个Ubuntu 16.04 LTS实例,我正在尝试运行我在Ubuntu 14.04上用python3.5开发的旧脚本。我使用sudo apt get install安装了matplotlib和basemap。这些是我得到的错误 Traceback (most recent call last): File "contour.py", line 30, in <module> x,y = m(lons,lats) File "/usr/lib/python3/dist-packa

我有一个Ubuntu 16.04 LTS实例,我正在尝试运行我在Ubuntu 14.04上用python3.5开发的旧脚本。我使用sudo apt get install安装了matplotlib和basemap。这些是我得到的错误

Traceback (most recent call last):
File "contour.py", line 30, in <module>
x,y = m(lons,lats)
File "/usr/lib/python3/dist-packages/mpl_toolkits/basemap/__init__.py", line 1148, in __call__
 xout,yout = self.projtran(x,y,inverse=inverse)sys.exit()
 File "/usr/lib/python3/dist-packages/mpl_toolkits/basemap/proj.py", line 286, in __call__
  outx,outy = self._proj4(x, y, inverse=inverse)
  File "/usr/lib/python3/dist-packages/mpl_toolkits/basemap/pyproj.py", line 392, in __call__
 _proj.Proj._fwd(self, inx, iny, radians=radians, errcheck=errcheck)
 File "_proj.pyx", line 122, in _proj.Proj._fwd (src/_proj.c:1571)
 SystemError: <class 'RuntimeError'> returned a result with an error set
回溯(最近一次呼叫最后一次):
文件“contour.py”,第30行,在
x、 y=m(长、宽)
文件“/usr/lib/python3/dist-packages/mpl_工具包/basemap/_-init__;.py”,第1148行,在调用中__
xout,yout=self.projtran(x,y,inverse=inverse)sys.exit()
文件“/usr/lib/python3/dist packages/mpl_toolkits/basemap/proj.py”,第286行,在调用中__
outx,outy=self.\u proj4(x,y,inverse=inverse)
文件“/usr/lib/python3/dist packages/mpl_toolkit/basemap/pyproj.py”,第392行,在调用中__
_项目项目前进(自身、inx、iny、弧度=弧度、errcheck=errcheck)
文件“_proj.pyx”,第122行,在_proj.proj._fwd中(src/_proj.c:1571)
SystemError:返回了一个带有错误集的结果
这是我正在执行的代码-

 nc_f = './hgt_500_2014_12_5_00Z.nc' 
 nc_fid = Dataset(nc_f, 'r')  
                         # and create an instance of the ncCDF4 class
 lats = nc_fid.variables['lat'][:]  # extract/copy the data

 lons = nc_fid.variables['lon'][:]

 time = nc_fid.variables['time'][:]
 hgt = nc_fid.variables['hgt'][:] 


 m = Basemap(width=5000000,height=3500000,
 resolution='l',projection='stere', lat_0 = 0, lon_0 = 0, lat_ts = 40)

 lons,lats = np.meshgrid(lons, lats,copy=False)


  x,y = m(lons,lats)   <----- CODE FAILS HERE

  m.drawcoastlines()
  m.drawcountries()
nc_f='./hgt_500_2014_12_5_00Z.nc'
nc_fid=数据集(nc_f,'r')
#并创建ncCDF4类的实例
lats=nc_fid.变量['lat'][:]#提取/复制数据
lons=nc_fid.变量['lon'][:]
时间=nc_fid.variables['time'][:]
hgt=nc_fid.variables['hgt'][:]
m=底图(宽=5000000,高=3500000,
分辨率='l',投影='stere',横向0=0,纵向0=0,横向ts=40)
lons,lats=np.meshgrid(lons,lats,copy=False)

x、 y=m(lons,lats)可能相关:@edwinksl-我看到了这两个答案,我不确定这将如何适用于我的情况。我没有使用pandasCan,您提供的
nc_f
小样本再现了您看到的错误?可能与此相关:@edwinksl-我看到了这两个答案,我不确定这将如何适用于我的情况。我没有使用pandasCan,你能提供一个小样本的
nc\u f
,重现你看到的错误吗?