Re: Question about CellFill

From: Fred Clare <fred_at_nyahnyahspammersnyahnyah>
Date: Thu, 8 Feb 2007 19:55:46 -0700

Ian,

I do see the effects you describe when I look
at the first image of the last example at:

   http://www.ncl.ucar.edu/Applications/orca.shtml

You say that the problem is clearly visible
in a Postscript viewer - what viewer are you using
to see that? When I use Ghostscript or Ghostview
I do not see the problem areas, but when I use
"Preview" on my Mac, I do see them ("Preview"
converts the PostScript to PDF).

After some analysis my conclusion is that these
effects are being caused by pixel aliasing in converting
the Postscript to another format. From the Orca example
I extracted a set of horizontally contiguous boxes from
one of the problem areas and put them into a separate
Postscript file (attached). In inspecting the areas
defined in this file by eye, they are correctly defined,
that is, there are no discrepancies - the rightmost edge
of box n is identical to the leftmost edge of box n+1.
This answers your question about a rounding problem
in the Postscript in the negative.

When I view this simple Postscript file using
Ghostscript the boxes are clearly delineated, but
in viewing the .png (created using "convert") I can
clearly see the aliasing effects. "convert" does
have a "-antialias" option, but that does not seem
to work for me, even when I use that option I still
see the aliasing effects in the .png output.

When I import the Orca Postscript into Photoshop and look
at the image, even at 10X magnification, I do not see
the problem - importing with anti-aliasing either
turned on or off.

As to whether these lines are going to show up when
typeset, I suspect not, if the original Postscript is
used. Otherwise, I think there is a definite possibility.

An option is to create an NCGM, convert to .xwd and
then to .png like so:

   ctrans -d xwd -res 700x700 orca.ncgm >! orca.xwd
   convert -trim -quality 100 orca.xwd orca.png

This seems to work for me in that the problems do
not occur. The text is not nearly as crisp as that
created by "convert" however - perhaps*because* of
the aliasing.

Maybe others will have suggestions.

Fred Clare

On Feb 5, 2007, at 7:54 AM, Ian Ross wrote:

> Hi there,
>
> I've been using NCL for a while now (great tool - thanks a lot to the
> developers, and thanks to UCAR for making it freely available) and I
> have a question about some maps I've been making.
>
> These are contour plots filled using CellFill, and the problem is
> essentially that there are fine white lines between the filled cells
> on many plots. You can see what I mean on the first plot of the last
> example on:
>
> http://www.ncl.ucar.edu/Applications/orca.shtml
>
> and also in the output from the test script at the bottom of this
> message.
>
> The lines between the filled cells are very fine, but they are real.
> There are two questions, I suppose:
>
> - Is it possible to make them go away? Is this some sort of rounding
> problem in the calculation of the cell boundaries, or is it
> something harder to fix?
>
> - Are the lines going to show up when these plots are typeset?
> They're clearly visible in a PostScript viewer, but not really
> visible in printed output (medium-quality monochrome laser
> printer). They also produce a moire effect in some cases (you can
> see this in the ORCA example above, in the Bight of Benin) and that
> might cause trouble with higher resolution printing.
>
> Thanks a lot,
>
> Ian Ross.
>
> ----------------------------------------------------------------------
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> begin
> pi = 4.0 * atan(1.0)
> lat = fspan(0.0, 90.0, 46)
> lon = fspan(0.0, 360.0, 181)
> tstdat = new((/ 46, 180 /), float)
> do latidx = 0, 45
> tstdat(latidx, :) = sin(3.0 * lon(0:179) / 180.0 * pi) * \
> exp(-((lat(latidx) - 30.0)^2) / (2.0 * 15.0^2))
> end do
>
> wks = gsn_open_wks("ps", "tst")
> gsn_define_colormap(wks, "rainbow")
>
> res = True
> res_at_sfXArray = lon
> res_at_sfYArray = lat
> res_at_cnFillOn = True
> res_at_cnFillMode = "CellFill"
> res_at_cnLinesOn = False
> res_at_cnLineLabelsOn = False
> res_at_gsnPolar = "NH"
> res_at_gsnSpreadColors = True
>
> map = gsn_csm_contour_map_polar(wks, tstdat, res)
> end
> ----------------------------------------------------------------------
>
> --
> Ian Ross, Geographical Sciences, University of Bristol, U.K.
> Ian.Ross_at_bristol.ac.uk
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Thu Feb 08 2007 - 19:55:46 MST

This archive was generated by hypermail 2.2.0 : Mon Feb 12 2007 - 09:02:03 MST