Re: cnHighLabelCount resource for control number of High label ?

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Aug 03 2011 - 09:26:07 MDT

John,

[I'm responding back to ncl-talk so others can benefit from the answer.]

After playing around with your script a bit, I decided that NCL really doesn't allow much control over the high labels, and decided to create my own.

I used the function "local_max" (you can use the similar "local_min" for minima) to calculate the local maxima, then gsn_add_text to attach the text.
This function returns the x/y (lat/lon) locations where it found local maxima, and the max values at those locations. Since you don't want every
high value labeled, I selected every other value with "::2".

Using the script you gave me, I turned off the high labels for plot2, and then added this code after plot2 was created (I'll send you the full script offline):

        plot2 = gsn_csm_contour_map(wks,GPH,res)
. . .

;---Draw our own high labels. Draw only every other one.
        lmax = local_max(GPH,False,0.)

;---Format the high values to have no values after the decimal.
        tstrs = sprintf("%5.0f",lmax@maxval(::2))

        txres = True
        txres@txFont = 26
        txres@txFontHeightF = 0.015
        txres@txJust = "BottomCenter"
        txid1 = gsn_add_text(wks,plot2,"H",GPH&lon(lmax@xi(::2)),GPH&lat(lmax@yi(::2)),txres)

        txres@txJust = "TopCenter"
        txid2 = gsn_add_text(wks,plot2,tstrs,GPH&lon(lmax@xi(::2)),GPH&lat(lmax@yi(::2)),txres)

;---Drawing the plot draws the attached text strings.
        draw(plot2)
        frame(wks)

--Mary

On Jul 26, 2011, at 11:08 PM, John Hyun wrote:

> Dear all,
>
> According to web manual, cnHighLabelCount resource is readonly resource, if this is true, is there any way to control number of High Label in contour drawing ?
>
> Actually I had set cnHighLabelCount resource in my ncl script, and got the following message.
>
> warning:_NhlSetValues:cnHighLabelCount does not have "S" access
>
> if this is just read only resource, what purpose do you have ? ( I hope somebody can give me how to use this resource . )
>
> Best regards,
>
> John Hyun
> _______________________________________________
> 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 Wed Aug 3 09:26:13 2011

This archive was generated by hypermail 2.1.8 : Fri Aug 05 2011 - 14:53:55 MDT