Re: Problem with common label bar and gsn_csm_vector_scalar_map_polar panel plot

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Jul 19 2010 - 09:00:27 MDT

Hi Eowyn,

If you are using V5.2.0 (which I believe you need to be in order to see this error), then
either edit $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl directly (if you have permissions)
and change:

       if( (vc_glyphstyle.eq.0.and..not.vc_monolinearrowcolor) .or.\
           (vc_glyphstyle.eq.1.and..not.vc_monofillarrowcolor) .or. \
           (vc_glyphstyle.eq.2.and..not.vc_monowindbarbcolor) .or. \
           (vc_glyphstyle.eq.3.and..not.vc_monolinearrowcolor)) then

to:

       if( (vc_glyphstyle.eq.0.and.vc_monolinearrowcolor) .or.\
           (vc_glyphstyle.eq.1.and.vc_monofillarrowcolor) .or. \
           (vc_glyphstyle.eq.2.and.vc_monowindbarbcolor) .or. \
           (vc_glyphstyle.eq.3.and.vc_monolinearrowcolor)) then

or take the attached "gsn_code.ncl" and load this instead of the one in $NCARG_ROOT/lib/ncarg/nclscripts/csm.

I *hope* this bug fix can make it into V5.2.1. I have to see how many binaries I have to redo...

--Mary

On Jul 15, 2010, at 3:44 PM, Adam Phillips wrote:

> Hi Eowyn,
> I believe you've found a bug. I copied your resource list and used some
> data I have here, and I see the same thing you are seeing: the panel
> label bar drawing is just weird. There is no way to get it without
> drawing a label bar for at least one of the panels.
>
> Here's the work around:
> Before you create plot(3), add the following 2 lines:
> res@lbLabelBarOn = True
> res@pmLabelBarOrthogonalPosF = 0.30
>
> This effectively pushed the label bar created for the 4th plot off of
> the page, and you're left with the panel label bar. I'll send an example
> of this to the ncl developers...
> Adam
>
>
> On 07/15/2010 11:07 AM, Eowyn Connolly-Brown wrote:
>> Hello all,
>>
>> I've searched the archives & examples and haven't found an example of a
>> common label bar for a panel plot composed of vectors overlaid on a
>> field, where the label bar matches the field. If you know of such an
>> example, please send it my way! Otherwise here is my question:
>>
>>
>> I am creating plots of a field overlaid with wind vectors via:
>>
>> plot= gsn_csm_vector_scalar_map_polar(wks,u,v,var,res)
>>
>> These are arranged in a panel plot, one panel for each season, eg:
>>
>>
>> res = True
>> res@gsnDraw = False ; don't draw
>> res@gsnFrame = False ; don't advance frame
>> res@gsnPolar = "NH" ; specify the hemisphere
>> gsn_define_colormap(wks,"wgne15")
>> res@mpMinLatF = 30
>> res@mpFillOn = False
>>
>> res@cnFillOn = True ; color fill
>> res@cnLevelSpacingF = 3. ; interval spacing
>> res@cnLinesOn = False ; no contour lines
>>
>> res@gsnScalarContour = True ; vectors over scalars
>> res@vcRefMagnitudeF = 20.0 ; vec magnitude
>> res@vcRefLengthF = 0.04 ; size of ref vector
>> res@vcLineArrowColor = "white" ; white vectors
>> res@vcMinDistanceF = 0.02 ; thins arrows near pole
>> res@vcGlyphStyle = "CurlyVector" ; turns on curley vectors
>>
>> res@vcRefAnnoArrowLineColor = "black" ; black ref vector
>> res@vcRefAnnoArrowUseVecColor = False
>>
>> res@gsnSpreadColors = True ; use full colormap
>> res@gsnSpreadColorStart = 2
>> res@gsnSpreadColorEnd = -3
>>
>> res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
>> res@cnMinLevelValF = 0 ; set min contour level
>> res@cnMaxLevelValF = 20 ; set max contour level
>> res@cnLevelSpacingF = 2. ; set contour spacing
>> res@lbLabelBarOn = False
>>
>>
>> plot(0)= gsn_csm_vector_scalar_map_polar(wks,u,v,varDJF,res)
>> plot(1)= gsn_csm_vector_scalar_map_polar(wks,u,v,varMAM,res)
>> plot(2)= gsn_csm_vector_scalar_map_polar(wks,u,v,varJJA,res)
>> plot(3)= gsn_csm_vector_scalar_map_polar(wks,u,v,varSON,res)
>>
>> resP = True ; modify the panel plot
>> resP@gsnPanelLabelBar = True ; add common colorbar
>> resP@lbTitleString ="kg/m2/s"
>> resP@lbTitlePosition="Bottom"
>> resP@lbAutoManage = False
>> resP@lbTitleFontHeightF= 0.010
>> resP@lbLabelFontHeightF= 0.01
>> resP@txString = VAR+" NAO+ composite"
>> gsn_panel(wks,plot,(/2,2/),resP) ; now draw as one plot
>>
>>
>>
>> Here is the problem: If res@lbLabelBarOn = False then there will be no
>> common label bar, even though resP@gsnPanelLabelBar = True . Yet if
>> res@lbLabelBarOn = True and resP@gsnPanelLabelBar = True , each
>> individual plot has its own label bar (expected) and suddenly there is a
>> common label bar, too! What's going on here? I suspect the
>> gsnPanelLabelBar resource doesn't know whether to make a label bar for
>> the vectors or the colored contours (since this problem only appears
>> when the overlaid vectors are included). Interestingly, even if only one
>> of the 4 plots has vectors, the problem appears. Please see attached
>> images to see what I'm talking about.
>>
>> Has anyone else encountered this problem before? Any ideas how to fix it?
>>
>> Thanks in advance. I'm a summer student, new to NCL, and I really
>> appreciate the help.
>>
>> Cheers,
>> Eowyn
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> --
> __________________________________________________
> Adam Phillips
> asphilli@ucar.edu
> National Center for Atmospheric Research tel: (303) 497-1726
> Climate and Global Dynamics Division 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

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

Received on Mon Jul 19 09:00:48 2010

This archive was generated by hypermail 2.1.8 : Mon Jul 19 2010 - 09:39:01 MDT