Re: Change start-point of longitude for a map

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Thu Mar 31 2011 - 09:46:16 MDT

Hi Mark,
If I may offer an additional option beyond Rick's:

Use a do loop and go through the plotting section twice. A simplified
example:

outf = (/"ps","x11"/)
do gg = 0,1
    wks = gsn_open_wks(outf(gg),get_script_prefix_name())
    plot = gsn_csm_contour_map(wks,arr,res)
end do

Hope that helps!
Adam

On 03/31/2011 08:48 AM, Mark Chan wrote:
> Hi Rick,
>
> Thanks to you and Dennis for answering my questions, and I really appreciate it.
> It is a bit too many stuff to add for output several plot formats, so I prefer
> to just change format name each time. However, your second suggestion by using
> "function" is quite interesting. Do you have any simple example that I can
> follow?
>
> With my best regards,
> Mark
>
>
>
> ----- Original Message ----
> From: "brownrig@ucar.edu"<brownrig@ucar.edu>
> To: Mark Chan<cym263@yahoo.com>; ncl-talk@ucar.edu
> Sent: Wed, March 30, 2011 10:28:27 PM
> Subject: Re: Change start-point of longitude for a map
>
> Hi Mark,
>
> To accomplish the second part of your question, you essentially have to do
> everything involving a "wks" variable twice; something like:
>
> wksX11 = gsn_open_wks("x11", "output")
> wksPS = gsn_open_wks("ps", "output")
> ...
> plotX11 = gsn_contour_map(wksX11, ...)
> plotPS = gsn_contour_map(wksPS, ...)
> ...
> polyX11 = gsn_add_polygon(wksX11, plotX11, ...)
> polyPS = gsn_add_polygon(wksPS, plotPS, ...)
> ...
> frame(wksX11)
> frame(wksPS)
>
> See what I'm getting at? It's perhaps a bit awkward, but one way to manage it
> *might* be to separate concerns, where all the file reading and analysis takes
> place in the main body of the script, and all the resource management and
> drawing is performed in a parametrized function that takes as an argument, among
> other things, the workstation-type you want to draw to:
>
> ; read files...
> ...
> ; extract variables, perform analysis, etc...
> ...
> generatePlot("x11", ...)
> generatePlot("ps", ...)
> generatePlot("png", ...)
> ...
>
> Hope that helps,
> Rick
>
> On Wed, 30 Mar 2011 19:52:07 -0700 (PDT)
> Mark Chan<cym263@yahoo.com> wrote:
>> NCL users,
>>
>> There is a global map with longitude from -180 to 180. Are there any easy way
>> to change the map with longitude from 0 to 360?
>> I was trying to use "data=lonFlip(data)" but the map didn't change. Can anyone
>> help?
>>
>>
>> Besides, we often use "wks = gsn_open_wks ("x11", "output")" for output, how
>> is it possible to output both "x11" and "ps" at the same run?
>>
>> Thanks a lot in advance!
>> Mark
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
__________________________________________________
Adam Phillips 
asphilli@ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
Climate and Global Dynamics Division         fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Mar 31 09:46:23 2011

This archive was generated by hypermail 2.1.8 : Tue Apr 05 2011 - 09:01:21 MDT