On 9/13/12 2:34 PM, Michael Rawlins wrote:


------------------------------------------------------------------------
*From:* Michael Droettboom <md...@stsci.edu>
*To:* matplotlib-users@lists.sourceforge.net
*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 <rawlin...@yahoo.com>
*To:* Michael Droettboom <md...@stsci.edu>; "matplotlib-users@lists.sourceforge.net" <matplotlib-users@lists.sourceforge.net>
*Sent:* Thursday, September 13, 2012 3:11 PM
*Subject:* Re: [Matplotlib-users] error installing basemap
ailing list Matplotlib-users@lists.sourceforge.net <mailto:Matplotlib-users@lists.sourceforge.net> 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 <http://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
------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to