Re: contour filled problem

From: David Brown (dbrown AT ucar.edu)
Date: Fri Aug 20 2004 - 13:43:57 MDT


Chia-chi,

The problem involves the PostScript workstation. Basically when you
plot with the high resolution data you are
generating a polygons with more points than can be drawn as a single
fill area given the default settings
of the PostScript workstation. In this situation, the PS Workstation
switches to "soft fill", which means it
simulates a fill area with a series of closely spaced horizontal lines.
Usually in the past, with typical output
devices you would not be able to tell the difference between the two
filling methods. Now, however, there
are monitors and printers with high enough resolution that you can see
the space between the lines, making
the color look lighter than it should. See
http://ngwww.ucar.edu/ngdoc/ng/gks/ps.html#MaximumPathSize

There are two possible adjustments that can be made: 1) increase the
maximum number of points for
a single polygon or 2) increase the number of lines drawn. It is
possible that increasing the maximum number of points might exceed the
capabilities of older PostScript printers or interpreters, so the
second option is considered the most portable. However, I have to say
that when I tried on my Mac OS X display it did not work -- the
line-filled areas still looked lighter (and the plot took longer to
load).

Currently there are no NCL workstation resources for adjusting these
low-level parameters but fortunately there is an NCL procedure called
'ngsetp" that does allow you to set them directly. I reproduced your
problem and managed to fix it with the following line of code placed
after the gsn_open_wks call.

ngsetp("PA",3000)

This increases the maximum number of points in a polygon from the
default of 1300 to 3000.

If you want to experiment with increasing the number of lines the call
would be something like:

ngsetp("FI",0.00025)

I should note that this use for the "ngsetp" routine is not currently
documented.
  -Dave Brown

On Aug 18, 2004, at 4:08 PM, Chia-chi Wang wrote:

> Hi,
>
> I got a problem for filled contour. Some areas are filled by light
> blue which should be blue (see 1.ps).
> I tried to plot it in lower resolution (every three points, see 2.ps)
> and the problem is gone.
> Does anyone have the same problem or know how to fix it?
> Thanks a lot.
>
> Chia-chi
>
> Here is my script.
> ;*************************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ;************************************************
> begin
>
> dir = "/home/ccwang/stan/"
> fig_name = "test"
> nlat = 720
> nlon = 1440
> lon = new((/nlon/),float)
> lat = new((/nlat/),float)
> do ilon=0,nlon-1
> lon(ilon)=0.25*(ilon+1)-0.125
> end do
> lon!0="lon"
> lon&lon=lon
> lon@units = "degrees_east"
> do ilat=0,nlat-1
> lat(ilat)=0.25*(ilat-1)-90.125
> end do
> lat!0="lat"
> lat&lat=lat
> lat@units = "degrees_north"
> ;------------
> ; read the background cloud liquid water
> ;------------
> slab = new((/nlat,nlon/),float)
> slab = fbinrecread(dir+"12Jun00.clw.bin",0,(/nlat,nlon/),"float")
> slab!0 = "lat"
> slab&lat = lat
> slab!1 = "lon"
> slab&lon = lon
> ;------------
> ; read the ship points
> ;------------
> pnt = new((/24,2/),float)
> pnt = asciiread(dir+"12Jun00.ascii",(/24,2/),"float")
> do i = 0,23
> if (-pnt(i,1) .lt. 0) then
> pnt(i,1) = 360-pnt(i,1)
> else
> pnt(i,1) = -pnt(i,1)
> end if
> end do
> ;------------
>
> colors = (/"white","black","white", "blue","green", \
> "yellow","orange", "orange red","red",\
> "brown","red4","gray"/)
> gsn_define_colormap(wks,colors)
>
> res = True
> res@gsnDraw = False
> res@gsnFrame = False
> res@mpMinLatF = -40
> res@mpMaxLatF = 40
> res@mpMinLonF = 160
> res@mpMaxLonF = 260
> res@mpCenterLonF = 180
> res@cnFillOn = True
> res@cnLinesOn = False
> res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
> res@cnMinLevelValF = 0.1
> res@cnLevelSpacingF = .1
> res@cnMaxLevelValF = 0.9
>
> res@gsnMajorLatSpacing = 10 ; change maj lat tm spacing
> res@gsnMajorLonSpacing = 20 ; change maj lon tm spacing
>
> res@tiMainString = "06-20 Jun 2000 cloud liquid water content"
>
> plot=gsn_csm_contour_map(wks,slab(::2,::2),res)
>
> resm = True
> resm@gsMarkerIndex = 16 ; marker style (circle)
> resm@gsMarkerSizeF = 8.0 ; marker size
> resm@gsMarkerColor = "black" ; maker color
> dum1=gsn_add_polymarker(wks,plot,pnt(:,1),pnt(:,0),resm)
>
> resm@gsLineThicknessF = 2.0
> resm@gsLineColor = "black"
> dum2=gsn_add_polyline(wks,plot,pnt(:,1),pnt(:,0),resm) ; draw
> the traj
> draw(wks)
> frame(wks)
> ;====================================================================
> end
>
> --
> Chia-chi Wang chiachw@uci.edu (O)949-824-2997, (Fax)949-824-3256
> Department of Earth System Science
> University of California, Irvine
> Irvine, CA 92697-3100
> http://essgrad.ps.uci.edu/~ccwang/
>
> <1.ps><2.ps>_______________________________________________
> ncl-talk mailing list
> ncl-talk@ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

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



This archive was generated by hypermail 2b29 : Mon Aug 23 2004 - 14:42:08 MDT