comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » filled contour workaround
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
filled contour workaround [message #3711] Wed, 01 March 1995 14:49 Go to next message
caron is currently offline  caron
Messages: 16
Registered: May 1994
Junior Member
After putting up with filled contours not working correctly,
I finally stumbled upon a work-around. I am plotting global data
with a world map in /cylindrical projection. So what I used to
do was:
1) call map_set to establish coord.system
2) call contour to draw filled contours, using /overplot
3) call map_continents to put world map on top
only trouble is, often but not always some of the contours would not fill in.
RSI fixed some of the problem in a release, but it has never worked right.

Here's the workaround:
1) call map_set to establish coord. system
2) call contour to draw filled contours, without /overplot: now the
contours are filled correctly, apparently because you let contour routine
establish its own coord. system
3) call map_set again, guessing at the values that make its coord
system the same as the one mysteriously selected by contour
4) call map_continents to put world map on top

Heres the workaround code. the last three lines to contour are new:

; establish projection
map_set, /cylindrical, /noerase, color = 1, limit = limits, /noborder

if cc_contour_filled then begin
contour, arr, cc_lon(cc_lon0:cc_lon1), cc_lat(cc_lat0:cc_lat1), $
levels = cc_contour_levels, $
c_colors = cc_contour_colors, color = 1, $
max_value = imd_missing_data, $
; /overplot, /fill, /follow, /closed, /noerase
xmargin = [0,0], ymargin = [0,0], $
xstyle =4, ystyle = 4, $
/fill, /follow, /closed, /noerase

; draw the continents on top of contours
; some funny bug: must "guess" at contour parameters
map_set, /cylindrical, title = plot_title(level_name(cc_pv_lev_idx)), /noerase, $
color = 1, limit = limits, $
xmargin = [4,4], ymargin = [3,3]
map_continents, color = cc_map_color_idx, mlinethick=1


Maybe someone can improve on this workaround. The problem is that the coord system
is only approximately the same (within a charactor!!). I tried manipulating !x.s and
!y.s but it didnt seem to work.
Re: filled contour workaround [message #3723 is a reply to message #3711] Wed, 01 March 1995 16:17 Go to previous message
afl is currently offline  afl
Messages: 51
Registered: December 1994
Member
In article <3j2tmn$h1m@ncar.ucar.edu>, caron@acd.ucar.edu (John Caron) writes:
|>
|> After putting up with filled contours not working correctly,
|> I finally stumbled upon a work-around. I am plotting global data
|> with a world map in /cylindrical projection. So what I used to
|> do was:
|> 1) call map_set to establish coord.system
|> 2) call contour to draw filled contours, using /overplot
|> 3) call map_continents to put world map on top
|> only trouble is, often but not always some of the contours would not fill in.
|> RSI fixed some of the problem in a release, but it has never worked right.
|>
|> Here's the workaround:
|> 1) call map_set to establish coord. system
|> 2) call contour to draw filled contours, without /overplot: now the
|> contours are filled correctly, apparently because you let contour routine
|> establish its own coord. system
|> 3) call map_set again, guessing at the values that make its coord
|> system the same as the one mysteriously selected by contour
|> 4) call map_continents to put world map on top
|>
|> Heres the workaround code. the last three lines to contour are new:
|>
|> ; establish projection
|> map_set, /cylindrical, /noerase, color = 1, limit = limits, /noborder
|>
|> if cc_contour_filled then begin
|> contour, arr, cc_lon(cc_lon0:cc_lon1), cc_lat(cc_lat0:cc_lat1), $
|> levels = cc_contour_levels, $
|> c_colors = cc_contour_colors, color = 1, $
|> max_value = imd_missing_data, $
|> ; /overplot, /fill, /follow, /closed, /noerase
|> xmargin = [0,0], ymargin = [0,0], $
|> xstyle =4, ystyle = 4, $
|> /fill, /follow, /closed, /noerase
|>
|> ; draw the continents on top of contours
|> ; some funny bug: must "guess" at contour parameters
|> map_set, /cylindrical, title = plot_title(level_name(cc_pv_lev_idx)),
|> /noerase, $
|> color = 1, limit = limits, $
|> xmargin = [4,4], ymargin = [3,3]
|> map_continents, color = cc_map_color_idx, mlinethick=1
|>
|>
|> Maybe someone can improve on this workaround. The problem is that the coord
|> system
|> is only approximately the same (within a charactor!!). I tried manipulating
|> !x.s and
|> !y.s but it didnt seem to work.


I would simply use the /cell_fill option with contour.
This seems to solve many of the problems previously encountered with /fill.
NOTE: Don't use /follow with /cell_fill!

Here is a simple example, but cell_fill should handle even tougher cases than this.

data = dist(91)
x = indgen(91)*4 - 180.
y = indgen(91)*2 - 90.

c_colors = indgen(12)+82 ; Choose your own colors!!
levels = indgen(12)*6

map_set, /cyl, /cont, /grid
contour, data, x, y, levels=levels, c_colors=c_colors, /cell_fill, /over
map_continents
map_grid

--

Andrew F. Loughe email: afl@cdc.noaa.gov
University of Colorado, CIRES voice: (303) 492-0707
Campus Box 449 fax: (303) 497-7013
Boulder, CO 80309-0449 USA
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: encapsulated postsrcipt with preview
Next Topic: MAPs

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:14:42 PDT 2025

Total time taken to generate the page: 0.00645 seconds