Re: color bars + tick mark labels

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Thu Feb 24 2011 - 14:46:29 MST

Hi Peter,

We have an example showing how to create your own map labels for a gsn_csm_xxx style plot. See example 9 at:

http://www.ncl.ucar.edu/Applications/mptick.shtml#ex9

I pulled the "add_map_tickmarks" function out of this example, and got it to work with wrf_xxxx style labels.

To use this, you'll need to load the attached WRFUserARW.ncl and add_map_tickmarks.ncl, and then you'll need to
indicate yourself where you want lat/lon labels, by setting:

  mpres@tmYLValues = ispan(26,42,2) + 0.5
  mpres@tmXBValues = ispan(-84,70,2) + 0.5

You may need to change the lat/lon label sizes by setting tmYLLabelFontHeightF and tmXBLabelFontHeightF to some smallish value, like 0.01 or 0.02.

I'll attach an example code that uses all of this, but you'll have to plug in your own data and change what parameter you want to plot.

You will notice that this code runs a bit slower than when you use default tickmarks. This is because in order to overlay your own tickmarks, you have to do a conversion from NDC space to lat/lon space, and then you have to find the closest NDC coordinates that give you the lat/lon coordinates being requested for the labels.

--Mary

On Feb 24, 2011, at 12:22 PM, David Brown wrote:

> Hi Peter,
>
> You are correct that the current implementation of tickmarks for maps is not as configurable as we would like. It would be possible, though perhaps not particularly easy, to substitute your own TickMark object for the default map tickmark. Then you could set up the labels anyway you like.
>
> Regarding 2): the number of colors in the label bar attached to a contour plot is controlled by the number of colors used for the contour plot. You can increase this in various ways, although I have to say that I do not know whether the wrf_contour function takes control of the resources needed to control the number of contour levels. If the cnLevelSelectionMode resource is set to "AutomaticLevels", then the easiest way to get more levels is to set the cnMaxLevelCount to something greater than its default value of 16. Note that depending on the actual data range, the number of levels you get may be less than cnMaxLevelCount because there is an algorithm to figure out a "nice" spacing between contour levels. See the documentation for these resources for a more complete explanation.
> -dave
>
>
> On Feb 23, 2011, at 8:06 PM, Peter Q. Olsson wrote:
>
>> Hello all-
>>
>> 2 issues I am laying out here, not sure either is solvable (but we can hope!).
>>
>> 1) I would like to have lat/long tick labels on plots [using wrf_contour() &
>> wrf_map_overlays()] that are labeled in DECIMAL DEGREES instead of the default
>> DEG-MIN-SEC. Nosing around in the archives suggests that (at least as of a couple of
>> years ago) this is not an option. Maybe this has changed in the last couple of years...
>>
>> 2) Color bars. I want a color bar w/ about 20 colors (default max seems to be 16). In an
>> attempt to do this, I set the resource:
>>
>> opts_r@lbBoxCount = 20
>>
>> and get back a notification from wrf_contour():
>>
>> warning:lbBoxCount is not a valid resource in proto_contour at this time.
>>
>> I should note that I am using a bunch of other "lb" resources and they all seem to work.
>>
>> I understand that the "wrf" functions, e.g., wrf_contour() are essentially wrappers for
>> several more primitive ncl functions, making life easier for "wrfies" like myself, at
>> the cost of some of the low-level versatility. Is this the case here? Is there a
>> workaround?
>>
>> Thanx for your help,
>> PQO
>>
>>
>> ___________________________________________________________
>> |
>> | Dr. Peter Q. Olsson,
>> | Alaska State Climatologist, Alaska State Climate Center
>> | Chief Scientist, Alaska Experimental Forecast Facility
>> | University of Alaska Anchorage
>> | 2811 Merrill Field Drive
>> | Anchorage, AK 99501
>> | voice: (907) 786-7234, fax (907) 786-7237|
>>
>> _______________________________________________
>> 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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Thu Feb 24 14:46:49 2011

This archive was generated by hypermail 2.1.8 : Fri Feb 25 2011 - 08:50:46 MST