Re: a question of DataBaseVersion

From: Fred Clare <fred_at_nyahnyahspammersnyahnyah>
Date: Wed, 14 Feb 2007 18:26:53 -0700

On Feb 12, 2007, at 7:51 AM, deni boz wrote:

> hi all,
>
> when I used "res_at_mpDataBaseVersion = "MediumRes" in my script, I
> got vertical lines occured in longitude axis of the plot. How can I
> remove them? The script(grid_corr_djf.ncl) and plot (precp.eps )
> are attached.

Deniz,

The appearance of the unwanted lines is the result of several
factors. The only way I was able to reproduce the problem on my
Mac was to view the PostScript output using "open." Viewing the
PostScript output with Ghostscript, Ghostview, or Photoshop
did not replicate the lines. So, one factor in seeing the
lines depends on the application you use to view the PostScript.

A little background as to how the plot is drawn is helpful.
First, all contours are drawn covering the maximum area, then
filled areas, using the color white, are drawn over the
contours to mask out the desired areas. There are dozens
of these filled areas and they are drawn in several constrained
vertical bands. The spurious lines are actually gaps appearing
between the vertical bands, allowing the background contours to
be seen.

After several hours of studying the PostScript I was able
to construct a trivial PostScript file that illustrates the
problem (attached). This file draws a blue background rectangle
and two adjacent red rectangles. The X position of the right
edge of the left red rectangle coincides with the X position
of the left edge of the right red rectangle. The Y positions
of these edges differ by a single coordinate unit. If I make
these two edges identical (that is, not differ in the vertical
by the single coordinate unit) then the problem line (gap) between
the rectangles does not appear. So, another factor is the unique
way that the edges of the filled areas in the vertical bands abut
each other.

A third factor is rather technical and involves the internal
resolution of the coordinate system in the PostScript file.
The default coordinate system in PostScript uses 72 dots-per-inch
for its resolution. This is rather crude, so we made the default
resolution in PostScript produced by NCL be 1800 dots-per-inch,
in order to accommodate higher resolution printers. The higher
resolution of the NCL PostScript comes into play here in a way
that is not completely clear to me - it has something to do
with how the PostScript coordinates are mapped onto the actual
output device with the higher resolution allowing for finer
distinctions. But it is a factor, since setting the resolution
in the NCL PostScript file to the default PostScript resolution
results in the gaps not being seen.

The rendering of the filled masks in bands is itself a factor.
If the masks were not constrained to bands, then this problem would
not be present. The reason for dividing the masks into bands
is to avoid unnecessarily large polygons. This was more important
in earlier times when PostScript had a rather small limit on
the size of polygons that all interpreters must support. At
the low level there is a parameter that controls the number
of bands and setting this to "1" would cause the spurious lines
to go away. Unfortunately this parameter is presently not
accessible from NCL. One of our developers is looking into
this, so stay tuned.

We have seen similar problems in the past. One solution that
we tried was to allow for the option of specifically drawing
fill boundaries in addition to the filled areas - this seems
to force the drawing of certain pixels that are not drawn in
cases like you are experiencing. However, doing this causes
some filled areas to be larger than expected, particularly for
the filled fonts. Also, this essentially doubles the file sizes.
So, we had to back off of this solution.

The only workaround I can think of for you right now is to set the
internal resolution for the PostScript produced by NCL to the PostScript
default of 72 dots-per-inch. This can be done by replacing:

    wks = gsn_open_wks("eps","precp")
    setvalues wks
      "wkColorMap" : "gsltod"
      "wkForegroundColor" : (/0.,0.,0./)
       "wkBackgroundColor" : (/1.,1.,1./)
    end setvalues

with:

    wks = create "precp" psWorkstationClass defaultapp
       "wkColorMap" : "gsltod"
       "wkForegroundColor" : (/0.,0.,0./)
       "wkBackgroundColor" : (/1.,1.,1./)
       "wkPSResolution" : 75
    end create

The resultant PostScript does not look bad on a monitor, but it
may not be pleasing on a high-resolution printer.

If you are worried about the lines appearing in a journal
image, it would depend on how the journal renders its
PostScript.

Fred Clare

>
> Thanks..
>
> Deniz

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

Received on Wed Feb 14 2007 - 18:26:53 MST

This archive was generated by hypermail 2.2.0 : Thu Feb 22 2007 - 14:54:01 MST