|
From: Michael R. <raw...@ya...> - 2012-09-14 02:28:10
|
________________________________ From: Jeff Whitaker <js...@fa...> To: mat...@li... Cc: raw...@ya... Sent: Thursday, September 13, 2012 9:44 PM Subject: Re: [Matplotlib-users] error installing basemap On 9/13/12 2:34 PM, Michael Rawlins wrote: > > > > >________________________________ > From: Michael Droettboom <md...@st...> >To: mat...@li... >Sent: Thursday, September 13, 2012 2:09 PM >Subject: Re: [Matplotlib-users] error installing basemap > > >You need to also install the python development package (python-dev), which contains the headers. > >Mike > > > > > > > >________________________________ > From: Michael Rawlins <raw...@ya...> >To: Michael Droettboom <md...@st...>; "mat...@li..." <mat...@li...> >Sent: Thursday, September 13, 2012 3:11 PM >Subject: Re: [Matplotlib-users] error installing basemap >ailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > >OK basemap installed. Thanks. But I'm getting an error running a script that worked with previous installation(s) of python, matplotlib, and basemap. The error: > >user@comsys:~>python map2_TempDiff_4panels.py >Traceback (most recent call last): > File "map2_TempDiff_4panels.py", line 27, in <module> > from mpl_toolkits.basemap import NetCDFFile >ImportError: cannot import name NetCDFFile > > >I installed python-mpltoolkits.basemap from package manager, before testing my script. > >MR > > >An update: My test script, which works with previously, now gets past the header initializations. Here they are: > >import sys,getopt >from mpl_toolkits.basemap import Basemap, shiftgrid, cm >#from mpl_toolkits.basemap import NetCDFFile >from Scientific.IO.NetCDF import NetCDFFile >from pylab import * >import matplotlib.pyplot as plt > > >Notr clear why the first import NetCDFFile statement does not work. Farther down the script, the code stops on this statement: > >data.missing_value=-9.99 > >There error to standard output: > >Traceback (most recent call last): > File "map2_TempDiff_4panels.py", line 266, in <module> > data.missing_value=-9.99 >IOError: netcdf: write access to read-only file > > Michael: The NetCDFFile function was deprecated a few releases back, and recently removed. If you have netcdf4-python installed you can do from netCDF4 import Dataset as NetCDFFile and the script should work as before. Regarding the second error, you must open the file for write access (mode='w') if you want to add attributes to the data variables. -Jeff Jeff, No I don't have netCDF4 installed. It's not in the package manager. Wasn't sure if there would be a conflict with python-netcdf that's installed. Guess that's the reverse interface. Now I'm having some trouble compiling netcdf4-python from sources following: http://code.google.com/p/netcdf4-python/wiki/UbuntuInstall The configure ended in error: checking whether the C compiler works... no configure: error: in `/home/rawlins/Downloads/netcdf-4.2.1.1': configure: error: C compiler cannot create executables Mike |