Re: Overlay plot with filled contours not completely opaque

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Tue Nov 06 2012 - 11:28:15 MST

Hi Oli,
I think this effect (thin green lines separating each grey-scale fill area) is a result of the anti-aliasing feature that is part of the new cairo workstation drivers. On my mac, using the Preview application, I can make the effect come and go by setting or unsetting the check box labelled "Smooth text and line art" in the preferences menu. I think this enables or disables anti-aliasing within Preview.

We have noticed other cases where anti-aliasing can cause unwanted effects (particularly with the "CellFill" contouring method), and we intend to have an option for disabling it in the next release. We want to be able to turn it off just for the plot objects that cause problems. We became aware of it too late in the release cycle to fix it for this release.
One workaround, if you do not need the transparency and greater color flexibility of the cairo drivers, is to revert to the old PostScript and/or PDF drivers. That worked for me with your script.
Just specify "oldps" or "oldpdf" as the workstation name in gks_open_wks.
-dave

On Nov 6, 2012, at 10:28 AM, <Oliver.Fuhrer@meteoswiss.ch> wrote:

> Hi NCL-team,
>
> While trying to overlay some white/grey clouds over another contour plot we've stumbled over a strange feature. It seems that the overlay is not fully opaque and that the background is actually visible at the contour borders of the overlay. When overlaying light & bright colors over a dark background, this can look pretty annoying.
>
> Are you aware of this feature? Is there any way to avoid it?
>
> Cheers,
> Oli
>
> PS. Here an example script which produces the attached image...
>
> 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"
>
> ni = 101
> nj = 101
>
> data = new((/nj,ni/),float)
> do j=0,nj-1
> do i=0,ni-1
> data(j,i) = sqrt(int2flt(i-ni/2)^2 + int2flt(j-nj/2)^2)
> end do
> end do
> data = data/max(data)*3.0
> data@_FillValue = -999.0
>
> wks = gsn_open_wks("ps","test")
> gsn_merge_colormaps(wks,"topo_15lev","gsdtol")
>
> r = True
> r@gsnFrame = False
> r@gsnDraw = False
> r@cnFillOn = True
> r@cnLinesOn = False
> r@gsnSpreadColors = True
> r@gsnMaximize = True
> r@cnLineLabelsOn = False
> r@cnLevelSelectionMode= "ManualLevels"
> r@cnMinLevelValF = 0.0
> r@cnMaxLevelValF = 3.0
> r@cnLevelSpacingF = 0.1
>
> pl1 = gsn_contour(wks,data/10.0,r)
>
> data = where(data .gt. 2.0, data@_FillValue, data)
> pl2 = gsn_contour(wks,data/2.0+2.0,r)
>
> overlay(pl1,pl2)
> draw(pl1)
> frame(wks)
>
> delete(wks)
>
> ________________________________________
>
> Oliver Fuhrer
> Numerical Prediction
>
> Federal Departement of Home Affairs FDHA
> Federal Office of Meteorology and Climatology MeteoSwiss
>
> Kraehbuehlstrasse 58, P.O. Box 514, CH-8044 Zurich, Switzerland
>
> Tel. +41 44 256 93 59
> Fax +41 44 256 92 78
> oliver.fuhrer@meteoswiss.ch
> www.meteoswiss.ch - First-hand information
>
>
>
> <test.png>_______________________________________________
> 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 Tue Nov 6 11:28:32 2012

This archive was generated by hypermail 2.1.8 : Tue Nov 06 2012 - 15:05:49 MST