Re: NCL question -- overlays

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Thu, 27 Nov 2008 14:00:04 -0700

Dave S,

Overlays in NCL are tricky. In addition to the examples shown by
Debasish, I recommend this strategy:

1. Get a working script for just the base plot of shaded contours
on the native projection. Examples narr_1 and narr_2 on the
indicated NARR page are very simple and should be close to what you
need.

2. Add one overlay to the working NCL script, and get that working.
  I think it would be better to start with the dashed contours.
Borrow from one of the simpler examples from conOncon.shtml, perhaps
conOncon_3.

3. Add the other overlay, and get that working.

Here are some general tips about NCL overlays. My apologies if I am
being too pedantic.

1. Understand the paradigm in NCL. A complete overlay plot
consists of a base plot plus one or more overlays. The first plot
is special because it also defines the map projection. So in your
case, you are making one base plot plus two overlays.

2. Use unique resource variables for the base plot and each
overlay, e.g. res1, res2, res3.

3. Include the following two special resources on *every* plot,
including the base plot:

   res?@gsnDraw = False ; do not draw
   res?@gsnFrame = False ; do not advance frame

   (replace ? by plot number 1, 2, 3 etc.)

4. Include map projection resources *only* on the base plot.

5. Each layer is first created independently as an NCL "graphics
object" in memory. Each is made with a gsn function, e.g.
(borrowing from example conOncon_3.ncl):

   [set up resources] ...
   plot1 = gsn_csm_contour_map_polar(wks,data1,res1)

   [set up resources] ...
   plot2 = gsn_csm_contour(wks,data2,res2)

   [set up resources] ...
   plot3 = gsn_csm_??????(wks,data3,res3)

6. Here is the actual overlay step. Overlay each extra plot on top
of the base plot "graphics object" in memory.

   overlay(plot1,plot2)
   overlay(plot1,plot3)

7. Use the following two special output commands to render the
final plot in an output file or screen window:

   draw(plot1)
   frame(wks)

Dave Allured
CU/CIRES Climate Diagnostics Center (CDC)
http://cires.colorado.edu/science/centers/cdc/
NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
http://www.cdc.noaa.gov/

Debasish Pai Mazumder wrote:
> Dear Dave,
>
> To plot the NARR data please check the examples in the webpage
>
> http://www.ncl.ucar.edu/Applications/narr.shtml
>
> To plot the dashed contour lines over filled contour please check the
> examples in the webpage
>
> http://www.ncl.ucar.edu/Applications/conOncon.shtml
>
> To add the wind top of that plot, check the examples in the webpage
>
> http://www.ncl.ucar.edu/Applications/vector.shtml
>
> Thanks
>
> Debasish
>
> ------------------------------------------------------------------------
>
> *From:* ncl-talk-bounces_at_ucar.edu [mailto:ncl-talk-bounces_at_ucar.edu]
> *On Behalf Of *David Small
> *Sent:* Wednesday, November 26, 2008 6:03 PM
> *Subject:* [ncl-talk] NCL question
>
> Hello,
>
> I am having trouble with NCL and need some help. I’m trying to plot
> contours over contours for the NARR dataset. The programs designed to
> do this won’t accept the NARR data and return errors. How do I plot
> dashed contour lines over filled contours in the native lambert
> conformal projection? Then, is it possible to add the winds on top?
> Thank you.
>
> Dave Small
> --
> David Small
> Graduate Research Assistant
> Department of Atmospheric and Oceanic Sciences
> McGill University
> Montreal, Quebec, Canada
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Nov 27 2008 - 14:00:04 MST

This archive was generated by hypermail 2.2.0 : Sun Nov 30 2008 - 08:25:42 MST