Hello matplotlib users,

I am having trouble understanding the coordinate transformations in
Basemap and pyproj.  I have gridded MODIS vegetation data, with upper
left corner and lower right corner given in projection coordinates
(meters).  I want to contour the data with Basemap.  The data are in a
sinusoidal projection, but the coordinates do not correspond to what
Basemap seems to expect.

The code below illustrates the problem.  Proj translates the upper
left to lat/lon correctly (-92.327237416031437, 30.141972433747089),
while Basemap does not.

#-------- code --------
from mpl_toolkits.basemap import Basemap
from mpl_toolkits.basemap import pyproj

ulm = [-8895604.1573329996, 3335851.5589999999]  #upper left, meters
lrm = [-7783653.6376670003, 2223901.0393329998]  #lower right, meters

sinu = pyproj.Proj(proj='sinu', lon_0=0.0, x_0=0.0, y_0=0.0)
m = Basemap(projection='sinu', resolution=None, lon_0=0.0)

print "ULM: " + str(ulm)
print "Proj: " + str(sinu(ulm[0], ulm[1], inverse=True))
print "Basemap: " + str(m(ulm[0], ulm[1], inverse=True))
#----- end code --------

This gives:
ULM: [-8895604.1573329996, 3335851.5589999999]
Proj: (-92.327237416031437, 30.141972433747089)
Basemap: (-159.99950210056144, -59.99995206181125)

I'm sure I'm missing something really simple, but I've read a lot of
documentation and I'm not sure what.

Many thanks for any help.

Best,
Tim

--

Timothy W. Hilton
PhD Candidate, Department of Meteorology
The Pennsylvania State University
503 Walker Building, University Park, PA   16802
hil...@meteo.psu.edu

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to