basemap/proj4 questions

Hi

I'm trying to test a new installation of matplotlib (0.86) and Basemap (0.7.2). On most of the examples I get the following error which seems to be related to proj4 libraries...

> python nytolondon.py
warning: figure.subplot.left rc value being reset to 0.1 in basemap
use rcdefaults() to get the original value back
Traceback (most recent call last):
  File "nytolondon.py", line 9, in ?
    lat_0=40.,lon_0=-20.,lat_ts=20.)
  File "/usr/lib64/python2.4/site-packages/matplotlib/toolkits/basemap/basemap.py", line 477, in __init__
    xc,yc = proj(NX.array(cntrylons,'f'),NX.array(cntrylats))
  File "/usr/lib64/python2.4/site-packages/matplotlib/toolkits/basemap/proj.py", line 167, in __call__
    outx,outy = self._proj4(x,y)
  File "proj4.pyx", line 330, in proj4.Proj.__call__
  File "proj4.pyx", line 152, in proj4.Proj._fwd
RuntimeError: Buffer lengths not the same

I'm not sure how to proceed with this. Has anyone seen anything similar? I should mention that this is a linux x86_64 machine running Fedora Core 4.

Thanks
Derrick

···

--
Derrick Snowden
PhOD/AOML/NOAA
4301 Rickenbacker Causeway
Miami, FL 33149
Office: 305.361.4322 Fax: 305.361.4392

Derrick Snowden wrote:

Hi

I'm trying to test a new installation of matplotlib (0.86) and Basemap (0.7.2). On most of the examples I get the following error which seems to be related to proj4 libraries...

> python nytolondon.py
warning: figure.subplot.left rc value being reset to 0.1 in basemap
use rcdefaults() to get the original value back
Traceback (most recent call last):
File "nytolondon.py", line 9, in ?
   lat_0=40.,lon_0=-20.,lat_ts=20.)
File "/usr/lib64/python2.4/site-packages/matplotlib/toolkits/basemap/basemap.py", line 477, in __init__
   xc,yc = proj(NX.array(cntrylons,'f'),NX.array(cntrylats))
File "/usr/lib64/python2.4/site-packages/matplotlib/toolkits/basemap/proj.py", line 167, in __call__
   outx,outy = self._proj4(x,y)
File "proj4.pyx", line 330, in proj4.Proj.__call__
File "proj4.pyx", line 152, in proj4.Proj._fwd
RuntimeError: Buffer lengths not the same

I'm not sure how to proceed with this. Has anyone seen anything similar? I should mention that this is a linux x86_64 machine running Fedora Core 4.

Thanks
Derrick

Derrick: If you are using the new scipy-core/numpy, you'll need cvs basemap (until I make a new release).

-Jeff

···

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

Jeff,

Thanks for working on this, but it seems the problem is not solved. I retrieved basemap.py from CVS and reinstalled basemap. I then received the same error further down in drawparallels. So, I made the change manually (removed the ,'f') from the NX.ones call) and the error then popped up in drawmeridians. Next I did a global search/replace and it seems that was overkill. After removing all of the ,'f' from any numerix function I tried again and received the error below.

[snowden@...949... examples]$ python nytolondon.py
warning: figure.subplot.left rc value being reset to 0.1 in basemap
use rcdefaults() to get the original value back
Traceback (most recent call last):
  File "nytolondon.py", line 28, in ?
    m.drawparallels(circles,labels=[1,1,0,1])
  File "/usr/lib64/python2.4/site-packages/matplotlib/toolkits/basemap/basemap.py", line 1319, in drawparallels
    x,y = self(lons,lats)
  File "/usr/lib64/python2.4/site-packages/matplotlib/toolkits/basemap/basemap.py", line 931, in __call__
    return self.projtran(x,y,inverse=inverse)
  File "/usr/lib64/python2.4/site-packages/matplotlib/toolkits/basemap/proj.py", line 167, in __call__
    outx,outy = self._proj4(x,y)
  File "proj4.pyx", line 330, in proj4.Proj.__call__
  File "proj4.pyx", line 152, in proj4.Proj._fwd
RuntimeError: Buffer lengths not the same

It seems what I did was overkill. I am using numpy. When I switch to Numeric using my altered version of basemap.py, I am able to run nytolondon.py and ireland.py but most of the other examples fail with some variation of the following exception

Traceback (most recent call last):
  File "plotmap.py", line 26, in ?
    topodat,x,y = m.transform_scalar(topoin,lons,lats,nx,ny,returnxy=True)
  File "/usr/lib64/python2.4/site-packages/matplotlib/toolkits/basemap/basemap.py", line 1700, in transform_scalar
    datout = interp(datin,lons,lats,lonsout,latsout,checkbounds=checkbounds,order=order)
  File "/usr/lib64/python2.4/site-packages/matplotlib/toolkits/basemap/basemap.py", line 2259, in interp
    dataout = NX.reshape(dataout,xout.shape)
ValueError: total size of new array must be unchanged

Next I retrieved the basemap.py from cvs again and reinstalled it. The following scripts work when using Numeric,

fillstates.py
ireland.py
hurrtracks.py
nytolondon.py

and the following do not,

plotmap*.py
simpletest*.py
contour_demo.py
ortho_demo.py
randompoints.py
quiver_demo.py
test.py
wiki_example.py

I did not try fcstmaps.py and testgdal.py since I don't have the dependencies installed yet.

Hope that helps!
Derrick

Jeff Whitaker wrote:

···

Derrick Snowden wrote:

Hi

I'm trying to test a new installation of matplotlib (0.86) and Basemap (0.7.2). On most of the examples I get the following error which seems to be related to proj4 libraries...

> python nytolondon.py
warning: figure.subplot.left rc value being reset to 0.1 in basemap
use rcdefaults() to get the original value back
Traceback (most recent call last):
File "nytolondon.py", line 9, in ?
   lat_0=40.,lon_0=-20.,lat_ts=20.)
File "/usr/lib64/python2.4/site-packages/matplotlib/toolkits/basemap/basemap.py", line 477, in __init__
   xc,yc = proj(NX.array(cntrylons,'f'),NX.array(cntrylats))
File "/usr/lib64/python2.4/site-packages/matplotlib/toolkits/basemap/proj.py", line 167, in __call__
   outx,outy = self._proj4(x,y)
File "proj4.pyx", line 330, in proj4.Proj.__call__
File "proj4.pyx", line 152, in proj4.Proj._fwd
RuntimeError: Buffer lengths not the same

I'm not sure how to proceed with this. Has anyone seen anything similar? I should mention that this is a linux x86_64 machine running Fedora Core 4.

Thanks
Derrick

Derrick: If you are using the new scipy-core/numpy, you'll need cvs basemap (until I make a new release).

-Jeff

--
Derrick Snowden
PhOD/AOML/NOAA
4301 Rickenbacker Causeway
Miami, FL 33149
Office: 305.361.4322 Fax: 305.361.4392

Derrick: You didn't mention, are you using numpy, numeric or numarray?

-Jeff

···

On Tue, 17 Jan 2006 12:18:37 -0500, "Derrick Snowden" <Derrick.Snowden@...259...> said:

Jeff,

Thanks for working on this, but it seems the problem is not solved. I
retrieved basemap.py from CVS and reinstalled basemap. I then received
the same error further down in drawparallels. So, I made the change
manually (removed the ,'f') from the NX.ones call) and the error then
popped up in drawmeridians. Next I did a global search/replace and it
seems that was overkill. After removing all of the ,'f' from any
numerix function I tried again and received the error below.

[snowden@...949... examples]$ python nytolondon.py

-----
Jeff Whitaker
jswhit@...146...

Jeff, Actually, in the long and drawn out email describing the various steps I tried, I mentioned switching back and forth between Numeric and numpy. I haven't tried numarray yet. The version info is below...

numpy: 0.9.2
Numeric: 23.7

-Derrick

Jeff Whitaker wrote:

···

On Tue, 17 Jan 2006 12:18:37 -0500, "Derrick Snowden" ><Derrick.Snowden@...259...> said:

Jeff,

Thanks for working on this, but it seems the problem is not solved. I retrieved basemap.py from CVS and reinstalled basemap. I then received the same error further down in drawparallels. So, I made the change manually (removed the ,'f') from the NX.ones call) and the error then popped up in drawmeridians. Next I did a global search/replace and it seems that was overkill. After removing all of the ,'f' from any numerix function I tried again and received the error below.

[snowden@...949... examples]$ python nytolondon.py

Derrick: You didn't mention, are you using numpy, numeric or numarray?

-Jeff
-----
Jeff Whitaker
jswhit@...146...

-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Derrick Snowden
PhOD/AOML/NOAA
4301 Rickenbacker Causeway
Miami, FL 33149
Office: 305.361.4322 Fax: 305.361.4392

Derrick: Sorry, I missed that. I'm at a loss then, since I can't
reproduce that error on any of the systems I have access too (Macos x,
linux 32 bit, and ia64). I wonder if anyone else out there with x86_64
would be willing to try the latest basemap from CVS?

-Jeff

···

On Wed, 18 Jan 2006 11:32:51 -0500, "Derrick Snowden" <Derrick.Snowden@...259...> said:

Jeff, Actually, in the long and drawn out email describing the various
steps I tried, I mentioned switching back and forth between Numeric and
numpy. I haven't tried numarray yet. The version info is below...

numpy: 0.9.2
Numeric: 23.7

-Derrick

-----
Jeff Whitaker
jswhit@...146...

Derrick: Sorry, I missed that. I'm at a loss then, since I can't
reproduce that error on any of the systems I have access too (Macos x,
linux 32 bit, and ia64). I wonder if anyone else out there with x86_64
would be willing to try the latest basemap from CVS?

Jeff,
I installed the cvs snapshot of basemap that you set up for me from ftp://ftp.cdc.noaa.gov/Public/jsw/basemap-0.8cvs.tar.gz. Thanks for setting this up.

I installed Saturday's (21 jan) CVS version of matplotlib [ BTW-- what is the comment for finding the version number?]

numerix is set as numpy in ~/.matplotlib/matplotlibrc

numerix : numpy # Numeric or numarray

python2.3, Opteron AMD64, Red Hat Linux.

Running
python simpletest.py
warning: figure.subplot.left rc value being reset to 0.1 in basemap
use rcdefaults() to get the original value back
Traceback (most recent call last):
   File "simpletest.py", line 13, in ?
     cs = m.contourf(x,y,etopo,30,cmap=cm.jet)
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/matplotlib/toolkits/basemap/basemap.py", line 2067, in contourf
     CS = ax.contourf(x,y,data,*args,**kwargs)
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/matplotlib/axes.py", line 1271, in contourf
     return ContourSet(self, *args, **kwargs)
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/matplotlib/contour.py", line 436, in __init__
     for level, level_upper, color in zip(lowers, uppers, self.tcolors):
ValueError: Invalid type for array
  -- this looks like a a matplotlib error

I get the same error as Derrick had with test.py (though the cylindrical projection works fine):

Running python test.py:
warning: figure.subplot.left rc value being reset to 0.1 in basemap
use rcdefaults() to get the original value back
min/max etopo20 data:
-9026.625 6228.8125
plotting Cylindrical Equidistant example, close plot window to proceed ...
Traceback (most recent call last):
   File "test.py", line 63, in ?
     m.drawparallels(circles,labels=[1,1,1,1])
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/matplotlib/toolkits/basemap/basemap.py", line 1379, in drawparallels
     lons,lats = self(self.llcrnrx*NX.ones(yy.shape,'f'),yy,inverse=True)
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/matplotlib/toolkits/basemap/basemap.py", line 931, in __call__
     return self.projtran(x,y,inverse=inverse)
   File "/data/jrd/mod1/agn/ext/Linux/lib64/python/matplotlib/toolkits/basemap/proj.py", line 151, in __call__
     outx,outy = self._proj4(x,y,inverse=True)
   File "proj4.pyx", line 342, in proj4.Proj.__call__
   File "proj4.pyx", line 230, in proj4.Proj._inv
RuntimeError: Buffer lengths not the same

Could there be some conflict between the default 64-bit integer arrays in numpy with 32-bit integers in the proj library?

George.

George Nurser wrote:

Derrick: Sorry, I missed that. I'm at a loss then, since I can't
reproduce that error on any of the systems I have access too (Macos x,
linux 32 bit, and ia64). I wonder if anyone else out there with x86_64
would be willing to try the latest basemap from CVS?

Jeff,
I installed the cvs snapshot of basemap that you set up for me from ftp://ftp.cdc.noaa.gov/Public/jsw/basemap-0.8cvs.tar.gz. Thanks for setting this up.

I installed Saturday's (21 jan) CVS version of matplotlib [ BTW-- what is the comment for finding the version number?]

numerix is set as numpy in ~/.matplotlib/matplotlibrc

numerix : numpy # Numeric or numarray

python2.3, Opteron AMD64, Red Hat Linux.

Running
python simpletest.py
warning: figure.subplot.left rc value being reset to 0.1 in basemap
use rcdefaults() to get the original value back
Traceback (most recent call last):
  File "simpletest.py", line 13, in ?
    cs = m.contourf(x,y,etopo,30,cmap=cm.jet)
  File "/data/jrd/mod1/agn/ext/Linux/lib64/python/matplotlib/ toolkits/basemap/basemap.py", line 2067, in contourf
    CS = ax.contourf(x,y,data,*args,**kwargs)
  File "/data/jrd/mod1/agn/ext/Linux/lib64/python/matplotlib/ axes.py", line 1271, in contourf
    return ContourSet(self, *args, **kwargs)
  File "/data/jrd/mod1/agn/ext/Linux/lib64/python/matplotlib/ contour.py", line 436, in __init__
    for level, level_upper, color in zip(lowers, uppers, self.tcolors):
ValueError: Invalid type for array
-- this looks like a a matplotlib error

I get the same error as Derrick had with test.py (though the cylindrical projection works fine):

Running python test.py:
warning: figure.subplot.left rc value being reset to 0.1 in basemap
use rcdefaults() to get the original value back
min/max etopo20 data:
-9026.625 6228.8125
plotting Cylindrical Equidistant example, close plot window to proceed ...
Traceback (most recent call last):
  File "test.py", line 63, in ?
    m.drawparallels(circles,labels=[1,1,1,1])
  File "/data/jrd/mod1/agn/ext/Linux/lib64/python/matplotlib/ toolkits/basemap/basemap.py", line 1379, in drawparallels
    lons,lats = self(self.llcrnrx*NX.ones (yy.shape,'f'),yy,inverse=True)
  File "/data/jrd/mod1/agn/ext/Linux/lib64/python/matplotlib/ toolkits/basemap/basemap.py", line 931, in __call__
    return self.projtran(x,y,inverse=inverse)
  File "/data/jrd/mod1/agn/ext/Linux/lib64/python/matplotlib/ toolkits/basemap/proj.py", line 151, in __call__
    outx,outy = self._proj4(x,y,inverse=True)
  File "proj4.pyx", line 342, in proj4.Proj.__call__
  File "proj4.pyx", line 230, in proj4.Proj._inv
RuntimeError: Buffer lengths not the same

Could there be some conflict between the default 64-bit integer arrays in numpy with 32-bit integers in the proj library?

George.

George: Thanks. numpy is a bit of a moving target right now - so I don't expect to have all the compatibility issues ironed out for a little while. Can you test with Numeric and/or numarray? They should work - if they don't I'd like to hear about it.

BTW:

import matplotlib
print matplotlib.__version__
import matplotlib.toolkits.basemap as basemap
print basemap.__version__

to get version numbers.

I think Numeric, numarray and numpy work the same way.

-Jeff

···

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