Dear Scott,

I am sorry for giving no reply. Thanks for your answer. I tried it and it
works fine.

best ,

Chao

On Tue, Apr 30, 2013 at 1:21 PM, Scott Sinclair-4 [via matplotlib] <
ml-node+s1069221n40977...@n5.nabble.com> wrote:

> Forgot to send to the list <sigh>
>
>
> ---------- Forwarded message ----------
> From: Scott Sinclair <[hidden 
> email]<http://user/SendEmail.jtp?type=node&node=40977&i=0>>
>
> Date: 30 April 2013 13:20
> Subject: Re: [Matplotlib-users] Basemap plotting data on projection
> To: ChaoYue <[hidden 
> email]<http://user/SendEmail.jtp?type=node&node=40977&i=1>>
>
>
>
> On 29 April 2013 23:32, ChaoYue <[hidden 
> email]<http://user/SendEmail.jtp?type=node&node=40977&i=2>>
> wrote:
> > pdata = np.genfromtxt('pdata.txt')
> > pdata = np.ma.masked_greater(pdata,1E20)
> > lonm,latm=m.makegrid(pdata.shape[1],pdata.shape[0])
>
> The problem is here ^^^
>
> The data don't lie on an equally spaced grid in the Mercator
> projection, so it doesn't make sense to ask for the lat/lon
> coordinates of a grid that is equally spaced in this projection. You
> need to determine the *actual* lat/lon coordinates before projecting
> them onto the Mercator map and plotting...
>
> Something like this should work (If you can assume that the data are
> on an equally spaced grid in Equidistant Cyl projection having the
> boundaries specified):
>
> from mpl_toolkits.basemap import Basemap
> import matplotlib.pyplot as plt
>
> # Set up the Equidistant Cyl projection to determine data locations.
> pdata = np.genfromtxt('pdata.txt')
> pdata = np.ma.masked_greater(pdata, 1E20)
> ny, nx = pdata.shape
>
> cyl_basemap = Basemap(projection='cyl', llcrnrlat=9, urcrnrlat=54.5,
>                       llcrnrlon=74, urcrnrlon=142, lat_ts=20,
> resolution='l')
> lon, lat = cyl_basemap.makegrid(nx, ny)
>
> # Set up the Mercator projection for plotting.
> m = Basemap(projection='merc', llcrnrlat=9, urcrnrlat=54.5,\
>             llcrnrlon=74, urcrnrlon=142, lat_ts=20, resolution='l')
> m.drawcountries()
> m.drawcoastlines()
> m.drawmapboundary(fill_color='white')
> m.drawrivers()
>
> x, y = m(lon, np.flipud(lat))
> cs = m.contourf(x, y, pdata)
> m.colorbar(cs)
> plt.show()
>
> Cheers,
> Scott
>
> ------------------------------------------------------------------------------
>
> Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
> Get 100% visibility into your production application - at no cost.
> Code-level diagnostics for performance bottlenecks with <2% overhead
> Download for free and get started troubleshooting in minutes.
> http://p.sf.net/sfu/appdyn_d2d_ap1
> _______________________________________________
> Matplotlib-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=40977&i=3>
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://matplotlib.1069221.n5.nabble.com/Basemap-plotting-data-on-projection-tp40973p40977.html
>  To start a new topic under matplotlib - users, email
> ml-node+s1069221n...@n5.nabble.com
> To unsubscribe from matplotlib, click 
> here<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2&code=Y2hhb3l1ZWpveUBnbWFpbC5jb218MnwxMzg1NzAzMzQx>
> .
> NAML<http://matplotlib.1069221.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 
***********************************************************************************
Chao YUE
Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL)
UMR 1572 CEA-CNRS-UVSQ
Batiment 712 - Pe 119
91191 GIF Sur YVETTE Cedex
Tel: (33) 01 69 08 29 02; Fax:01.69.08.77.16
************************************************************************************




--
View this message in context: 
http://matplotlib.1069221.n5.nabble.com/Basemap-plotting-data-on-projection-tp40973p41044.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to