[ncl-talk] cnConstFEnableFill usage?

David Brown dbrown at ucar.edu
Thu Sep 11 18:07:43 MDT 2014


Hi Liz,
In spite of the error message you were getting (which does need to be
fixed), the signal/noise data is being plotted. There are several reasons
it is not visible to you: 1) you are using the same color table as for the
underlying data so it is very hard to distinguish; 2) the default dot size
is very small -- you need to make the dots bigger;  and 3) the AreaFill
draw method requires continuous regions of non-missing data in order to
draw -- it will not draw isolated points of good data in a sea of missing
values. Also note that the second and third plots have no valid s/n data.

I have modified your script to set a single fill color (red -- so it is
visible against both the predominately blue underlying plot and also
against the black map outlines). I also made the dots bigger and set them
closer together. And I turned off the  constant fill message.  Of course,
these are all things you can tweak.

Further, my test script draws each panel member separately after the panel
plot, so that you can see how more of the s/n data is visible if you make
the plot bigger. Also I have a commented out a setting to change the
FillMode to "cellfill". If you try that you will see the isolated points
that have been eliminated when you use "areafill". Hope this helps give
some perspective on the trade-offs involved in choosing how to plot your
data.

I will create a JIRA ticket concerning the error message. I am attaching
the modified version of your script.

 -dave



On Thu, Sep 11, 2014 at 4:22 PM, Elizabeth Burakowski <burakows at ucar.edu>
wrote:

> Thanks David.
>
> Liz.
>
>
> On Thu, Sep 11, 2014 at 2:12 PM, David Brown <dbrown at ucar.edu> wrote:
>
>> Hi Liz,
>> I am looking into this now. I will let you know what I find.
>>  -dave
>>
>> On Wed, Sep 10, 2014 at 4:09 PM, Elizabeth Burakowski <burakows at ucar.edu>
>> wrote:
>>
>>> Hi NCL-Talk,
>>>
>>> I am trying to use cnConstFEnableFill to stiple regions in a constant
>>> fill color/pattern where signal/noise ratios are greater than two.
>>>  However, I keep getting an error that says:
>>>
>>> warning:ContourPlotInitialize: scalar field is constant; no contour
>>> lines will appear; use cnConstFEnableFill to enable fill
>>>
>>> The plotting resources for my contour plot (res) and my signal:noise
>>> ratio plot (snres) using cnConstFEnableFill is below.  The plot turns out
>>> perfectly fine, minus the desired stipling.
>>>
>>> Is there a specific order I must put cnConstFEnableFill in my script
>>> that I am missing?  The full script is pretty long, so I've snipped out the
>>> bulk of it and copied the plot resources information below.  If the full
>>> script is desired, it is available here:
>>>
>>>
>>> /glade/p/work/burakows/plot/NCL/LC_Diff/biascorr_diff_PD_DF_mult_mean_panel.ncl
>>>
>>> Thanks,
>>>
>>> Liz.
>>>
>>>
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"
>>>
>>> ;==========================================================
>>> ;                         The main code
>>> ;==========================================================
>>>
>>> begin
>>>
>>> <snip>
>>>
>>>
>>> ;----------------------------------------------------------------------
>>> ; Plotting options section
>>> ;----------------------------------------------------------------------
>>>
>>>  pltType = "ps"                                 ; plot type
>>>        pltDir = "./"                            ; plot directory
>>>        pltName = "Panel_biascorr_"+varw+"PD-DF_2011"   ; plot name (ps
>>> file)
>>>        pltPath = pltDir+pltName                 ; plot path
>>>
>>>    wks = gsn_open_wks(pltType,pltPath)              ; create workstation
>>> for ps file
>>>
>>>         gsn_define_colormap(wks,"temp_diff_18lev")
>>>
>>> res = True
>>>
>>> res at gsnDraw = False
>>> res at gsnFrame = False
>>>
>>> res at cnFillOn             = True              ; color plot desired
>>>     res at cnLinesOn            = False             ; turn off contour
>>> lines
>>>     res at cnLineLabelsOn       = False             ; turn off contour
>>> labels
>>>     res at cnInfoLabelOn = False     ; turn off info label (top labels of
>>> indvid. plots)
>>> res at cnFillMode           = "RasterFill"      ; turn raster on
>>> res at cnLevelSelectionMode = "ManualLevels"  ; Set contour levels manually
>>> res at cnMinLevelValF       = -4                ; minimum contour (degrees
>>> C, or mm)
>>>         res at cnMaxLevelValF       = 4                 ; maximum contour
>>> (degrees C, or mm)
>>>         res at cnLevelSpacingF      = 0.5               ; contour interval
>>>
>>>     res at lbLabelBarOn         = False             ; Will turn on in
>>> panel later
>>> res at lbOrientation = "Horizontal"     ; Horizontal label bar
>>>
>>>     res at mpFillOn             = False
>>>     res at mpOutlineOn           = True
>>>     res at mpOutlineBoundarySets = "AllBoundaries"
>>>     res at mpProjection          = "CylindricalEquidistant"
>>>
>>>     res at mpLimitMode           = "LatLon"           ; required
>>>     res at mpMinLatF             = minlat-bndadd
>>>     res at mpMaxLatF             = maxlat+bndadd
>>>     res at mpMinLonF             = minlon-bndadd
>>>     res at mpMaxLonF             = maxlon+bndadd
>>>     res at mpCenterLonF          = (minlon + maxlon)*0.5
>>>     res at mpCenterLatF          = (minlat + maxlat)*0.5
>>>  res at gsnLeftString         = ""                ; Turn off left subtitle
>>>         res at gsnRightString        = ""                ; Turn off right
>>> subtitle
>>>     res at gsnMajorLatSpacing    = 2
>>>     ;res at gsnMajorLonSpacing   = 2
>>>     res at gsnMinorLonSpacing    = 2
>>>
>>> res at gsnAddCyclic = False ; regional grid (changes central meridian)/xwo
>>>     ;----Resources for stipling of significant signal/noise (>2)
>>>         snres = True
>>> snres at gsnDraw = False
>>> snres at gsnFrame = False
>>>  snres at lbLabelBarOn = False ; turn off label bar
>>> snres at cnInfoLabelOn = False ; turn off info label
>>> snres at cnLineLabelsOn = False ; turn off contour labels
>>> snres at cnLinesOn = False ; no contour lines
>>> snres at cnConstFEnableFill= True ; allow constant values (1=sig) to fill
>>> snres at cnFillOn = True ; turn on fill
>>> snres at cnMonoFillPattern = True ; single fill pattern
>>> snres at cnFillColor = "black" ;
>>> snres at cnFillPattern = 17 ; stipling
>>> <snip>
>>>  plot_diff = gsn_csm_contour_map(wks,Wrfdiff_mean,res)
>>> plot_sn   = gsn_csm_contour(wks,Wrfdiff_sn2,snres)
>>>  overlay(plot_diff,plot_sn)
>>>
>>>
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140911/2ce11c0e/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: biascorr_diff_PD_DF_mult_mean_panel-mod.ncl
Type: application/octet-stream
Size: 12541 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140911/2ce11c0e/attachment.obj 


More information about the ncl-talk mailing list