Dear Daniel, 

to give the corners of an array, some "matplotlib" plotting functions have the 
"extent" keyword, e.g. "contour" and "imshow". You can use this to put your 
data on the map. However, the functions of the "Basemap" class do not support 
this functionality. "Basemap.imshow" overwrites the "extent" keyword (see 
docstring). A workaround is to call "matplotlib.pyplot.imshow" instead, to draw 
on your "Basemap" map:
>>> map = Basemap(projection='...', ...)
>>> map.drawcoastlines()
>>> extent = reduce(lambda x,y: x+y, map([lon0,lon1],[lat0,lat1])
>>> matplotlib.pyplot.imshow(data, extent=extent)
You can also create an axes instance first, to have more control over your plot.

To your second question: Since the real globe is a 3d sphere with longitude and 
latitude and your image is a 2d map with x,y coordinates, you need some rule 
how to transform longitude and latitude to your x,y system. This rules are the 
different projections. The main idea of "basemap" is to help you with this 
projection by calling "x,y = map(lons, lats)". So, I guess your are using 
"basemap" wrong, if you have to change the coordinates *by hand*. If you need 
more help, you should give a small example where your problem occurs.


Best Regards,
Gerrit



----- Original Message -----
From: Daniel Fulger <daniel.ful...@web.de>
Date: Friday, October 15, 2010 6:20 pm
Subject: [Matplotlib-users] basemap toolkit: project graphics file given in 
lon-lat
To: matplotlib-users@lists.sourceforge.net


> Dear all,
> 
> I would like to project a graphics file of some colour coded geo data  
> 
> that is already given in lat-lon with corners
> specified in lat-lon onto a map. The projection of the result should  
> 
> be flexible. In the end the resulting
> plot shows a section of the earth, either from a satallite  
> perspective (ortho) or some convenient projection.
> 
> All examples I found seem to be doing different things or special  
> cases that I have trouble to generalize or modify.
> These examples transform the data from some (often unpecified) system  
> 
> to a coordinate system that
> suites the chosen projection.
> But the fact that the geo data file is given in lat-lon with corners  
> 
> must simplify everything and should make the chosen
> projection arbitrary. The resolution of the data file must also be  
> arbitrary and should not appear in the code.
> I do not see why the final projection should require beforehand a  
> change of the geo-data coordinate
> system *by hand* i.e. typing in the transform formulas and extracting  
> 
> pixel sizes.
> I would have thought that to avoid this is the whole point of using  
> map toolkits.
> 
> I imagine a function that takes the parameters
> - datafile, alternatively an array with a colour value or RGB for  
> each lon-lat coordinate
> - its lon-lat corners,
> - a basemap map-object i want the data projected onto
> - and the projection specifier (possibly with desired corners if  
> different from the maps corners)
>    that determines how i want to see the the resulting piece of the  
> globe.
> 
> 
> Could someone explain to me (a python newbie)  what the sequence of  
> steps/functions would have to be or which
> predefined methods are doing this.
> 
> Regards
> Daniel
> 
> 
> 
> ------------------------------------------------------------------------------
> Download new Adobe(R) Flash(R) Builder(TM) 4
> The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
> Flex(R) Builder(TM)) enable the development of rich applications that 
> run
> across multiple browsers and platforms. Download your free trials today!
> http://p.sf.net/sfu/adobe-dev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users

------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to