Cannot run basemap examples

I'm having trouble running some of the examples that come with basemap
- any th\at use the file etopo20.pickle fail with an error similar to:

Traceback (most recent call last):
  File "test.py", line 12, in ?
    topodict = cPickle.load(open('etopo20.pickle','rb'))
  File "/usr/lib/python2.3/site-packages/numarray/generic.py", line
159, in Cla\ssicUnpickler
    self.__setstate__(state)
  File "/usr/lib/python2.3/site-packages/numarray/numarraycore.py",
line 463, i\n __setstate__
    self._type = state["_type"]
AttributeError: ("'str' object has no attribute 'name'", <function
ClassicUnpic\kler at 0xb7b08e9c>, (<class
'numarray.numarraycore.NumArray'>, {'_type': 'Floa\t32', '_itemsize':
4, '_shape': (1081,), '_bytestride': 4, '_byteoffset': 0, '_\version':
'1.1', '_byteorder': 'big', '_data': <memory at 082f8798 with
size:43\24 held by object 082f8778 aliasing object 00000000>,
'_strides': (4,)}))

Can anyone tell me how to fix this?
I'm using python 2.3.4, matplotlib 0.80, basemap 0.3.2, proj 4.4.8 and
have the Python libraries numeric 23.1 and numarray 0.8 installed.

Thanks in advance,
Mike.

Mike Elson wrote:

I'm having trouble running some of the examples that come with basemap
- any th\at use the file etopo20.pickle fail with an error similar to:

Traceback (most recent call last):
File "test.py", line 12, in ?
   topodict = cPickle.load(open('etopo20.pickle','rb'))
File "/usr/lib/python2.3/site-packages/numarray/generic.py", line
159, in Cla\ssicUnpickler
   self.__setstate__(state)
File "/usr/lib/python2.3/site-packages/numarray/numarraycore.py",
line 463, i\n __setstate__
   self._type = state["_type"]
AttributeError: ("'str' object has no attribute 'name'", <function
ClassicUnpic\kler at 0xb7b08e9c>, (<class
'numarray.numarraycore.NumArray'>, {'_type': 'Floa\t32', '_itemsize':
4, '_shape': (1081,), '_bytestride': 4, '_byteoffset': 0, '_\version':
'1.1', '_byteorder': 'big', '_data': <memory at 082f8798 with
size:43\24 held by object 082f8778 aliasing object 00000000>,
'_strides': (4,)}))

Can anyone tell me how to fix this?
I'm using python 2.3.4, matplotlib 0.80, basemap 0.3.2, proj 4.4.8 and
have the Python libraries numeric 23.1 and numarray 0.8 installed.

Thanks in advance,
Mike.

Mike: My guess is I saved the data as a pickle Numeric (not numarray) object. You can either install Numeric, or I can re-pickle it for you with numarray.

-Jeff

···

---
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/CDC1 FAX : (303)497-6449
325 Broadway Web : http://www.cdc.noaa.gov/~jsw
Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124

Hello Jeff,

I tried loading the file etopo20.pickle by itself but got the same error:

import cPickle
a = cPickle.load(open('etopo20.pickle','rb'))

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.3/site-packages/numarray/generic.py", line
159, in Cla\ssicUnpickler
    self.__setstate__(state)
  File "/usr/lib/python2.3/site-packages/numarray/numarraycore.py",
line 463, i\n __setstate__
    self._type = state["_type"]
AttributeError: ("'str' object has no attribute 'name'", <function
ClassicUnpic\kler at 0xb71e48b4>, (<class
'numarray.numarraycore.NumArray'>, {'_type': 'Floa\t32', '_itemsize':
4, '_shape': (1081,), '_bytestride': 4, '_byteoffset': 0, '_\version':
'1.1', '_byteorder': 'big', '_data': <memory at 082ee9a0 with
size:43\24 held by object 082ee980 aliasing object 00000000>,
'_strides': (4,)}))

Looking at etopo20.pickle itself, the 4th line reads
'cnumarray.generic' - I'm guessing that means it is stored using
numarray.
Do I need a specific version of python or numarray to read it? I have
both Numeric (23.1) and numarray installed already.

Mike.

···

On 4/25/05, Jeff Whitaker <jswhit@...146...> wrote:

Mike Elson wrote:

>I'm having trouble running some of the examples that come with basemap
>- any th\at use the file etopo20.pickle fail with an error similar to:
>
>Traceback (most recent call last):
> File "test.py", line 12, in ?
> topodict = cPickle.load(open('etopo20.pickle','rb'))
> File "/usr/lib/python2.3/site-packages/numarray/generic.py", line
>159, in Cla\ssicUnpickler
> self.__setstate__(state)
> File "/usr/lib/python2.3/site-packages/numarray/numarraycore.py",
>line 463, i\n __setstate__
> self._type = state["_type"]
>AttributeError: ("'str' object has no attribute 'name'", <function
>ClassicUnpic\kler at 0xb7b08e9c>, (<class
>'numarray.numarraycore.NumArray'>, {'_type': 'Floa\t32', '_itemsize':
>4, '_shape': (1081,), '_bytestride': 4, '_byteoffset': 0, '_\version':
>'1.1', '_byteorder': 'big', '_data': <memory at 082f8798 with
>size:43\24 held by object 082f8778 aliasing object 00000000>,
>'_strides': (4,)}))
>
>Can anyone tell me how to fix this?
>I'm using python 2.3.4, matplotlib 0.80, basemap 0.3.2, proj 4.4.8 and
>have the Python libraries numeric 23.1 and numarray 0.8 installed.
>
>Thanks in advance,
>Mike.
>
>
>
Mike: My guess is I saved the data as a pickle Numeric (not numarray) object. You can either install Numeric, or I can re-pickle it for you with numarray.

-Jeff

---
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/CDC1 FAX : (303)497-6449
325 Broadway Web : http://www.cdc.noaa.gov/~jsw
Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Mike Elson wrote:

Hello Jeff,

I tried loading the file etopo20.pickle by itself but got the same error:

import cPickle
a = cPickle.load(open('etopo20.pickle','rb'))

Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.3/site-packages/numarray/generic.py", line
159, in Cla\ssicUnpickler
   self.__setstate__(state)
File "/usr/lib/python2.3/site-packages/numarray/numarraycore.py",
line 463, i\n __setstate__
   self._type = state["_type"]
AttributeError: ("'str' object has no attribute 'name'", <function
ClassicUnpic\kler at 0xb71e48b4>, (<class
'numarray.numarraycore.NumArray'>, {'_type': 'Floa\t32', '_itemsize':
4, '_shape': (1081,), '_bytestride': 4, '_byteoffset': 0, '_\version':
'1.1', '_byteorder': 'big', '_data': <memory at 082ee9a0 with
size:43\24 held by object 082ee980 aliasing object 00000000>,
'_strides': (4,)}))

Looking at etopo20.pickle itself, the 4th line reads
'cnumarray.generic' - I'm guessing that means it is stored using
numarray.
Do I need a specific version of python or numarray to read it? I have
both Numeric (23.1) and numarray installed already.

Mike.

Mike: Not that I know of. I'm puzzled by this one. You said in your first message that you are using numarray 0.8 - I think that might be too old. It's up to 1.3.1 now, and I'm sure I created that pickle with at least 1.1.

-Jeff

···

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/CDC R/CDC1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg

Bingo! One upgrade to the latest numarray and everything works fine.
Many thanks for your help.

Mike.

···

On 4/25/05, Jeff Whitaker <jswhit@...146...> wrote:

Mike Elson wrote:

>Hello Jeff,
>
>I tried loading the file etopo20.pickle by itself but got the same error:
>
>import cPickle
>a = cPickle.load(open('etopo20.pickle','rb'))
>
>Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "/usr/lib/python2.3/site-packages/numarray/generic.py", line
>159, in Cla\ssicUnpickler
> self.__setstate__(state)
> File "/usr/lib/python2.3/site-packages/numarray/numarraycore.py",
>line 463, i\n __setstate__
> self._type = state["_type"]
>AttributeError: ("'str' object has no attribute 'name'", <function
>ClassicUnpic\kler at 0xb71e48b4>, (<class
>'numarray.numarraycore.NumArray'>, {'_type': 'Floa\t32', '_itemsize':
>4, '_shape': (1081,), '_bytestride': 4, '_byteoffset': 0, '_\version':
>'1.1', '_byteorder': 'big', '_data': <memory at 082ee9a0 with
>size:43\24 held by object 082ee980 aliasing object 00000000>,
>'_strides': (4,)}))
>
>Looking at etopo20.pickle itself, the 4th line reads
>'cnumarray.generic' - I'm guessing that means it is stored using
>numarray.
>Do I need a specific version of python or numarray to read it? I have
>both Numeric (23.1) and numarray installed already.
>
>Mike.
>
>
>
Mike: Not that I know of. I'm puzzled by this one. You said in your
first message that you are using numarray 0.8 - I think that might be
too old. It's up to 1.3.1 now, and I'm sure I created that pickle with
at least 1.1.

-Jeff

--
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/CDC R/CDC1 Email : Jeffrey.S.Whitaker@...259...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg