Re: [Matplotlib-users] Basemap plotting data on projection

2013-05-13 Thread ChaoYue
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 
>
>
> -- Forwarded message --
> From: Scott Sinclair <[hidden 
> email]>
>
> Date: 30 April 2013 13:20
> Subject: Re: [Matplotlib-users] Basemap plotting data on projection
> To: ChaoYue <[hidden 
> email]>
>
>
>
> On 29 April 2013 23:32, ChaoYue <[hidden 
> email]>
> 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] 
> 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
> .
> 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


Re: [Matplotlib-users] matplotlib FuncAnimation hanging issue

2013-05-13 Thread Tony Yu
On Mon, May 13, 2013 at 9:14 AM, Tony Yu  wrote:

>
>
>
> On Sat, May 11, 2013 at 7:08 PM, Colin McAuliffe wrote:
>
>> To add to the previous email I've tried this with a few different
>> backends with no luck. Have similar issues been found when creating videos
>> with mencoder? If the final result is the same switching away from ffmpeg
>> is fine.
>
>
> Sorry for the delayed reply. I don't have mencoder on my system, but it's
> probably worth a try. More comments below.
>
>  Quoting Colin McAuliffe :
>>
>>>
>>> The above error does not occur if I switch to agg.
>>>
>>> Also using the ffmpeg command
>>>
>>> ffmpeg -f image2 -i t%d.jpg video.avi
>>>
>>> on a few images gives the following output, where I put !! next to the
>>> lines which are suppressed by including -loglevel quiet
>>>
>>> FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers
>>>   built on May  2 2013 23:13:41 with llvm_gcc 4.2.1 (Based on Apple
>>> Inc. build 5658) (LLVM build 2336.9.00)
>>>
>>
> 
>
>  !!Output #0, avi, to 'video.avi':
>>> !!  Metadata:
>>> !!ISFT: Lavf52.93.0
>>> !!Stream #0.0: Video: mpeg4, yuv420p, 4272x2848, q=2-31, 200 kb/s,
>>> 25 tbn, 25 tbc
>>> Stream mapping:
>>>   Stream #0.0 -> #0.0
>>> Press [q] to stop encoding
>>> frame=3 fps=  2 q=4.0 Lsize= 524kB time=0.12
>>> bitrate=35781.7kbits/s
>>> video:519kB audio:0kB global headers:0kB muxing overhead 1.083673%
>>>
>>
> So the line starting with "frame=" doesn't get suppressed when you run
> with `-loglevel quiet`? I actually thought those were the problematic lines
> (since more of those get printed out for longer encoding tasks). Maybe this
> is an issue with the ffmpeg version?
>
> Unfortunately, I don't have much free time to reply in more depth.
>
> Best,
> -Tony
>
>
Oh, yeah: If you just want to try something to get this working, try
setting the verbosity level:


import matplotlib
matplotlib.verbose.set_level('debug')

Assuming this is the same issue as PR 989, redirecting stdout to the
command line will prevent the buffer issues. (You'll get a lot of debug
output printed to the command line, though).

Hope that helps,
-Tony
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] matplotlib FuncAnimation hanging issue

2013-05-13 Thread Tony Yu
On Sat, May 11, 2013 at 7:08 PM, Colin McAuliffe wrote:

> To add to the previous email I've tried this with a few different backends
> with no luck. Have similar issues been found when creating videos with
> mencoder? If the final result is the same switching away from ffmpeg is
> fine.


Sorry for the delayed reply. I don't have mencoder on my system, but it's
probably worth a try. More comments below.

 Quoting Colin McAuliffe :
>
>>
>> The above error does not occur if I switch to agg.
>>
>> Also using the ffmpeg command
>>
>> ffmpeg -f image2 -i t%d.jpg video.avi
>>
>> on a few images gives the following output, where I put !! next to the
>> lines which are suppressed by including -loglevel quiet
>>
>> FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers
>>   built on May  2 2013 23:13:41 with llvm_gcc 4.2.1 (Based on Apple
>> Inc. build 5658) (LLVM build 2336.9.00)
>>
>


 !!Output #0, avi, to 'video.avi':
>> !!  Metadata:
>> !!ISFT: Lavf52.93.0
>> !!Stream #0.0: Video: mpeg4, yuv420p, 4272x2848, q=2-31, 200 kb/s,
>> 25 tbn, 25 tbc
>> Stream mapping:
>>   Stream #0.0 -> #0.0
>> Press [q] to stop encoding
>> frame=3 fps=  2 q=4.0 Lsize= 524kB time=0.12
>> bitrate=35781.7kbits/s
>> video:519kB audio:0kB global headers:0kB muxing overhead 1.083673%
>>
>
So the line starting with "frame=" doesn't get suppressed when you run with
`-loglevel quiet`? I actually thought those were the problematic lines
(since more of those get printed out for longer encoding tasks). Maybe this
is an issue with the ffmpeg version?

Unfortunately, I don't have much free time to reply in more depth.

Best,
-Tony
--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users