[ncl-talk] Smoothing artifacts after applying mask

Adam Phillips asphilli at ucar.edu
Wed Jul 29 10:52:39 MDT 2015


Hi Patrick,
By masking and array you are creating regions with missing data. The
default fill mode (AreaFill) will do its best at color filling the input
data array, but you will likely not see every grid cell that is significant
as AreaFill needs most of the surrounding grid cells to have data to fill.

To see what I mean, try setting: cnFIllMode = "RasterFill", which tells NCL
to color each individual (significant) grid cell. When plotting data with
some missing areas, RasterFill usually results in more areas being plotted.
The downside to RasterFill is the blocky nature of these types of plots.

Your other idea, to overlay the full contour field on the color filled sig
array, would work and is relatively easy to try:

res at gsnDraw = False     ; do not draw the plot
res at gsnFrame = False    ; do not advance the frame
res at cnFillOn = True
res at cnLinesOn = False
res at cnLineLabelsOn = False
res at cnFillMode = "RasterFill"    ; optional
plot = gsn_csm_contour_map(wks,sig,res)
res at cnFillOn = False
res at cnLinesOn = True
res at cnLineLabelsOn = True
plot2 = gsn_csm_contour(wks,X,res)
overlay(plot,plot2)
draw(plot)
frame(wks)

Another option: You can overlay a AreaFill plot on the same field
RasterFilled; I've done this with mixed success aesthetically. The
procedure is similar to what is done above.

Many people overlay a stippled field to show significance. For an example
of this see my response to Ipshita from last week:
http://mailman.ucar.edu/pipermail/ncl-talk/2015-July/003380.html

Hope the above helps. If not, or if you have further questions please
respond to ncl-talk.
Adam



On Tue, Jul 28, 2015 at 9:10 PM, Patrick Kelly <pkelly at rsmas.miami.edu>
wrote:

> Hello NCL community,
>
> I am fairly new to working with graphics in NCL.
> I am trying to mask global data (for a significance threshold).
>
> I am using the “mask” feature to accomplish this and contouring the
> results with “gsn_csm_contour_map”
> This works fairly well, but as you can seem the masking feature create
> some jagged artifacts at the boundary which results in breaks in the thick
> black contour lines.
>
> Is there a better to somehow smooth these edges, or could I perhaps
> overlay another set of contour lines (unfilled) to at least get continuous
> lines?
> I’ve tried the “smth9_Wrap” function without much success.
>
> Thanks,
> Patrick
>
>
>
> relevant lines of code look like this:
>
>
> sig = mask(X,abs(X) .lt. 0.37,False) ;; only show values whose abs() gt
> 0.37
> plot = gsn_csm_contour_map(wks,sig,res)
>
>
>
>
>
>
>
> Patrick
>
> Sent from my iPhone
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150729/11d60c03/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-1.png
Type: image/png
Size: 391355 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150729/11d60c03/attachment-0001.png 


More information about the ncl-talk mailing list