Re: Contour labels

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Tue, 14 Feb 2006 09:32:06 -0700

Hi Muhtarjan,

The default spacing of line labels in NCL is pretty large. There are a
few ways that you can increase the density of the labels.
Take a look at http://www.ncl.ucar.edu/Applications/contourLab.shtml

I honestly don't see why this line of yours:
res3_at_cnLineLabelDensityF = 1.5
isn't working, as that would be the first thing I would try. Try setting
it to a very high value, like 15. If that doesn't work, try setting:
res3_at_cnLineLabelPlacementMode = "constant"
res3_at_cnLineDashSegLenF = 0.10
and comment out cnLineLabelDensityF...

As far as your error messages go, when you are using
gsn_csm_contour_map_overlay, the second set of resources you pass in
(res3 in your case) should always be as minimal as possible, and cannot
have any mp or gsn resources in it. You should set all mp resources
(like mpFillOn) in your first resource list (res4)...

As you can't use gsnContourNegLineDashPattern or
gsnContourZeroLineThicknessF, you will have to dash your negative
contour lines and set the line thicknesses manually:

res3_at_cnMinLevelValF = -5.0
res3_at_cnMaxLevelValF = 5.0
res3_at_cnMonoLineDashPattern = False
nlines = ((res3cnMaxLevelValF - res3_at_cnMinLevelValF) /
res3_at_cnLevelSpacingF)+1 ; = 101 contour lines

cnarray = new(nlines,integer)
cnarray(:nlines/2-1) = 1 ; set neg contours to dash pattern 1
cnarray(nlines/2:) = 0 ; set pos contours to solid line
res3_at_cnLineDashPatterns = cnarray

cnarray2 = cnarray*1. ; preallocate space for float array
cnarray2 = 1.5 ; all line thicknesses = 1.5 (or 1.)
cnarray2(nlines/2) = 0 ; except for the 0 contour, set to 0
                                ; thickness
res3_at_cnMonoLineThickness = False
res3_at_cnLineThicknesses = cnarray2

Make sure cnMinLevelValF and cnMaxLevelValF are set to be the same
distance from zero for the coding above to work. I have used this coding
many times prior to the invention of gsnContourNegLineDashPattern /
gsnContourZeroLineThicknessF...

Good luck,
Adam

MUHTARJAN osman wrote:
> Hello-
>
> I want to put contour lable to every single line. I tried by setting
> "res3_at_cnLineLabelInterval = 1", it seems not working. Also, the
> NCL gave me some warning messeges like these:
>
> "warning:mpFillOn is not a valid resource in
> FS20-101slpda_olrda_Kiladias0dLag_contour at this time
> warning:gsnContourZeroLineThicknessF is not a valid resource in
> FS20-101slpda_olrda_Kiladias0dLag_contour at this time
> warning:gsnContourNegLineDashPattern is not a valid resource in
> FS20-101slpda_olrda_Kiladias0dLag_contour at this time"
>
>
> Here is a portion of me program:
>
> res3 = True
> res3_at_cnLevelSelectionMode = "ManualLevels"
> res3_at_cnLevelSpacingF = 0.1
> res3_at_mpFillOn = False
> res3_at_gsnDraw = False ; Do not draw plot
> res3_at_gsnFrame = False ; Do not advance frome
> ; res3_at_cnLineLabelPlacementMode = "constant"
> res3_at_cnLineLabelInterval = 1
> res3_at_gsnContourZeroLineThicknessF = 0
> res3_at_gsnContourNegLineDashPattern = 1
> res3_at_cnInfoLabelOrthogonalPosF = -0.07
> res3_at_cnLabelMasking = True
> res3_at_cnLineLabelDensityF = 1.5
>
> res4 = True
> res4_at_mpCenterLonF = 180.
> res4_at_gsnDraw = False
> res4_at_gsnFrame = False
> res4_at_mpFillOn = False
> res4_at_lbLabelBarOn = False
> res4_at_cnFillOn = True
> res4_at_cnLinesOn = False
> res4_at_cnLineLabelsOn = False
> res4_at_cnInfoLabelOn = False ; turn off info label
> res4_at_cnFillColors = (/"sky blue","transparent","pink"/)
> res4_at_cnLevelSelectionMode= "ExplicitLevels"
> res4_at_cnLevels = (/-0.99,0.99/)
> res4_at_tiMainString = "Regressed OLRda(norm.)"+lag+"days Lag"
> res4_at_gsnCenterString = "JJA 1% Sign.Lvl"
> res4_at_gsnLeftString = " "
> res4_at_cnFillDrawOrder = "Predraw" ; areas before map gets
>
> ......
>
> plot = gsn_csm_contour_map_overlay(wks,prob,\
> yReg,res4,res3)
>
>
> Any comment will be appreciated. Thanks a lot!
>
>
> Regards,
>
> Muhtarjan Osman
> ASGG
> LAWR
> UC Davis
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> 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
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Feb 14 2006 - 09:32:06 MST

This archive was generated by hypermail 2.2.0 : Wed Feb 15 2006 - 21:20:26 MST