Re: Want to plot precip over terrain

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri, 03 Aug 2007 11:03:48 -0600

Hi Don,

Coincidentally, the graphic on the second site you pointed to was
created via NCL...

And yes, it is possible, with these caveats:

1) If it raining over a certain grid point, you will not be able to see
the terrain color underneath the color-filled precip field, but you will
be able to see the contours of the terrain.

2) You will have to draw things in a specific order: 1-terrain color
fill, 2-precipitation field, and 3-terrain contour field. Note that you
will have to separate out the terrain color fill and terrain contour
field so that you can still see the terrain contour field over the
precipitation color fill. You can use gsn_csm_contour_map_overlay and
the overlay functions to accomplish this..

3) The precipitation color fill field will have to color all areas where
it is not raining transparent, not white. As you will have to use
transparent, you cannot set cnFillMode = "RasterFill"... This may turn
out to be a problem for you, as I would think you would want to use
RasterFill for a radar image... If you didn't want the terrain to be
color-filled this wouldn't be a problem...

> I've played around with this with overlays, but one of the problems
> seems to be that I'm unable to use different colormaps for the two
> different plots. It appears that a colormap is assigned to a
workspace > rather than a plot?

Correct, a colormap is assigned to a workspace. There are ways to get
around that. You can merge different colormaps via the
gsn_merge_colormaps function:

http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_merge_colormaps.shtml
(Note though that there is a 256 color limit on the number of colors you
can use. )

You can also switch colormaps once a plot is drawn on the frame. For
instance you can do the following:

    a = ispan(1,15,1)
    wks = gsn_open_wks("ps","test")
    gsn_define_colormap(wks,"gsdtol")
    res = True
    res_at_gsnFrame = False
    plot = gsn_csm_xy(wks,ispan(1,15,1),a,res)

    gsn_define_colormap(wks,"BlWhRe")
    res_at_xyLineColor = "blue"
    b = a*.5
    plot = gsn_csm_xy(wks,ispan(1,15,1),bq,res)
    frame(wks)

A blue line and a black line are drawn, even though blue was not in the
colormap that was originally defined...

> Related to this - is there an example out there that might illustrate
> a painless
> way of plotting majour cities on a map (ideally on top of terrain, and
> underneath
> precip :))? I vaguely recall somewhere reading about the ability to
> bring in a database of "place names" but can't recall where I saw
> that.

This is possible as well, although we don't have an example that
specifically highlights this. Let's say you have a ascii file with the
latitude, longitude, and name for a bunch of cities:

61.12 211.52 Anchorage
64.5 212.52 Fairbanks

You can use asciiread to read in the information, and then use
gsn_polymarker and gsn_text to add the dot and city name to a map..

http://www.ncl.ucar.edu/Document/Functions/Built-in/asciiread.shtml
http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_polymarker.shtml
http://www.ncl.ucar.edu/Document/Graphics/Interfaces/gsn_text.shtml

Hopefully all of that made sense.. Good luck..
Adam

Don Morton wrote:
> Hi, I haven't seen a specific example on this,
> but I wouldn't be surprised if it's possible -
> I'd like to be able to plot precip (with colour-filled
> contours, so it looks like a radar image) over
> terrain height (again with colour-filled contours).
> Here's a picture of the precip without the terrain
>
> http://www.cs.umt.edu/~morton/WX/MSOCWA6/3hrPrecip-d03.gif
>
> Right now, the above server doesn't seem to be working, so another
> place to go is http://weather.arsc.edu/ and look at the leftmost
> animated GIF.
>
> What's missing in those pictures is terrain, for geographic reference.
>
> I've played around with this with overlays, but one of the problems seems
> to be that I'm unable to use different colormaps for the two different plots.
> It appears that a colormap is assigned to a workspace rather than a plot?
>
> I realize I "could" use contour lines rather than filled contours for one of
> the fields, but that wouldn't be my first choice.
>
> Related to this - is there an example out there that might illustrate a painless
> way of plotting majour cities on a map (ideally on top of terrain, and
> underneath
> precip :))? I vaguely recall somewhere reading about the ability to bring in
> a database of "place names" but can't recall where I saw that.
>
> Thanks for any help,
>
> Don Morton

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Aug 03 2007 - 11:03:48 MDT

This archive was generated by hypermail 2.2.0 : Mon Aug 06 2007 - 08:08:45 MDT