Re: About how to control the map show

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Wed, 16 Sep 2009 10:16:59 -0600

My replies are below..

Xuguang Sun wrote:
> Dear Adam,
>
> Thanks for your reply.
>
> Let me to explain the questions by a simple example.
>
> Suppose we have 500hPa geopotential height reanalysis data (whatever ECMWF or NCEP), and it is two dimentional, like h500(nlat,nlon), where, nlat=73, nlat=144.
>
> after loading the necessary ncl scripts (gsn_code.ncl, gsn_csm.ncl, contributed.ncl and shea_util.ncl),
>
> STEP 1.
>
> I can do the following operations,
>
> wks=gsn_open_wks("X11","exam")
> res=True
> res_at_mpCenterLonF = 180.0
> plot=gsn_csm_contour_map(wks,h500,res)
>
> then, we will have a contour display with land filled by "LightGray". But actually, I'm not very clear why the land is filled by "LightGray", because the default value for mpFillOn = False. This is the question 1.
>

The default value is False, but for some gsn_csm_contour_* functions it
is True, as it is for gsn_csm_contour_map. The documentation notes that
here: http://www.ncl.ucar.edu/Document/Graphics/Resources/mp.shtml#mpFillOn

> STEP 2.
>
> On the other hand, if I redefine the colormap by
>
> gsn_define_colormap(wks,"rainbow")
> and
> plot=gsn_csm_contour_map(wks,h500,res)
>
> the is no map under the contour display, why? This is the question 2.

Assuming that you are not setting any other resources beyond the
mpCenterLonF one you set in question #1, then the likely answer is that
as the rainbow colormap does not have a gray in it, then NCL is trying
to grab the closest color to light gray, and is choosing white.

If you specify a named color (or in this case, light gray is the default
land fill color) that is not in your defined colormap, NCL will try its
best to choose the closest color in the colormap to your specified
color. For instance, if you define BlWhRe as your colormap, and ask to
use a green color, NCL might give you a lighter blue.

Try reading in the rainbow+gray colormap instead of the rainbow colormap.

>
> STEP 3.
>
> And then, as you said, I added the mpOutlineDrawOrder resources,
>
> res_at_mpOutlineDrawOrder="PostDraw"
> and
> plot=gsn_csm_contour_map(wks,h500,res)
>
> there is no difference from STEP 2. That means the resource mpOutlineDrawOrder doesn't work for this matter. Why? This is question 3.
>

I think I misunderstood what you referred to as the map wasn't showing
up, thinking you were referring to the map outline when you were
referring to the color filled continents. By default, the continental
outlines are turned off. (mpOutlineOn = False) To turn them on, you need
to set mpOutlineOn = True. I don't think this is what you were after.
See my suggestion in Step 2), and remove the mpOutlineDrawOrder resource.

> STEP 4.
>
> Furthermore, if I changed res_at_cnFillOn = True, like the followings,
>
> res_at_cnFillOn = True
> res_at_gsnSpreadColors = True
> plot=gsn_csm_contour_map(wks,h500(0,:,:),res)
>
> I got a shaded contour with map outline underneath. Why? This is question 4.

If you do that, and change your colormap to rainbow+gray, by default the
continents will be filled gray, and then would be overdrawn by the
color-filled contour field (assuming your data is global). If you are
simply drawing unfilled contour lines, try this:

gsn_define_colormap(wks,"rainbow+gray")
res = True
res_at_mpCenterLonF = 180.0
plot=gsn_csm_contour_map(wks,h500,res)

The continents should be colored gray, a contour field should be drawn
over it, and the continental outlines are off.

Now try this:

gsn_define_colormap(wks,"rainbow+gray")
res = True
res_at_mpCenterLonF = 180.0
res_at_mpOutlineOn = True
res_at_cnFillOn = True
res_at_mpFillOn = False ; do not color-fill the map
res_at_gsnSpreadColors = True
plot=gsn_csm_contour_map(wks,h500,res)

There should be a color filled contour field and the continental
outlines (in black) should be drawn over the contour.

Hopefully this answered all your questions..
Adam

>
> In summary, I'm just confused about how to control the map by some settings. Hope to get your answer. Thanks.
>
> Xuguang
>
> ===================================================================
> Message: 1
> Date: Tue, 15 Sep 2009 12:59:15 -0600
> From: Adam Phillips <asphilli_at_ucar.edu>
> Subject: Re: [ncl-talk] how can I remove "Reference Vector" in the
> vector label?
> To: Rick Brownrigg <brownrig_at_ucar.edu>
> Cc: ncl forum <ncl-talk_at_ucar.edu>
> Message-ID: <4AAFE403.3090006_at_ucar.edu>
> Content-Type: text/plain; charset=GB2312
>
> Hi Xuguang,
> As far as the cnFillOn question goes, I am not sure that I am totally
> understanding what you are saying. Regardless, there are a slew of
> "DrawOrder" resources that can be used to tell NCL when to draw things.
>
> For instance, mpOutlineDrawOrder can be set to "PostDraw", to tell NCL
> to draw the map outlines last, and therefore over, the contour field.
>
> http://www.ncl.ucar.edu/Document/Graphics/Resources/mp.shtml#mpOutlineDrawOrder
>
> there's also cnFillDrawOrder:
> http://www.ncl.ucar.edu/Document/Graphics/Resources/cn.shtml#cnFillDrawOrder
>
> as well as cnLineDrawOrder, cnLineLabelDrawOrder, etc...
> Let us know if this doesn't help..
> Adam
>
>
> Rick Brownrigg wrote:
>> Hi,
>>
>> Setting the resource "vcRefAnnoString2On" to "False" may solve the
>> first issue. In general, there a lot of control over the labeling of
>> reference vectors via the various vcRefAnno.... resources.
>>
>> I don't know about the behavior of "cnFillOn".
>>
>> Rick
>>
>>
>> On Sep 15, 2009, at 10:27 AM, Xuguang Sun wrote:
>>
>>> Dear everyone,
>>>
>>> I used gsn_csm_contour_map_ce() to draw the significant area first,
>>> and then gsn_csm_vector to draw the vector, finally, by using
>>> overlay (plotvc1,plotvc) and draw(plotvc1) to get the final plot.
>>> However, the reference arrow label always has "Reference Vector" in
>>> the vector label, how can I remove it? Thanks.
>>>
>>> Question 2:
>>>
>>> If I set cnFillOn = False, and then plot the two dimensional data by
>>> gsn_csm_contour_map(), and get no map under the contour, why? but if
>>> I set cnFillOn = True, the map comes out again.
>>>
>>> Xuguang
>
>
> ___________________________________________________________
> 好玩贺卡等你发,邮箱贺卡全新上线!
> http://card.mail.cn.yahoo.com/
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
--------------------------------------------------------------
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
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Sep 16 2009 - 10:16:59 MDT

This archive was generated by hypermail 2.2.0 : Wed Sep 16 2009 - 12:58:13 MDT