source: trunk/SRC/ToBeReviewed/TRIANGULATION/drawsectionbottom.pro @ 325

Last change on this file since 325 was 325, checked in by pinsard, 17 years ago

modification of some headers (+some corrections) to prepare usage of the new idldoc

  • Property svn:keywords set to Id
File size: 5.5 KB
Line 
1;+
2;
3; @file_comments
4; Fill and draw the bottom continents for a real section.
5;
6; @categories
7;
8; @param maskin {in}{required}
9;
10; @param xxaxisin {in}{required}
11;
12; @param depthsin {in}{required}
13;
14; @keyword COAST_COLOR {default=0}
15; The color of the coastline.
16; Default is black (0).
17;
18; @keyword COAST_THICK {default=1}
19; The thickness of the coastline.
20;
21; @keyword CONT_COLOR {default=(!d.n_colors - 1) < 255}
22; The color of the continent. Default value is
23; Default is white (0).
24;
25; @uses
26; common.pro
27;
28; @restrictions
29; Simple way to fill continents for a section (using the
30; fact that continents are wider at the bottom than at the top).
31;
32; @history
33; Sebastien Masson (smasson\@lodyc.jussieu.fr)
34;                      June 14, 2002
35;
36; @version
37; $Id$
38;
39; @todo
40; Seb: definir params
41;
42;-
43PRO drawsectionbottom, maskin, xxaxisin, depthsin $
44                     , COAST_COLOR = coast_color, COAST_THICK = coast_thick $
45                     , CONT_COLOR = cont_color, CONT_NOFILL = cont_nofill $
46                     , OVERPLOT = overplot, _EXTRA = ex
47;
48  compile_opt idl2, strictarrsubs
49;
50@cm_general
51  IF NOT keyword_set(key_forgetold) THEN BEGIN
52@updatekwd
53  ENDIF
54;---------------------------------------------------------
55  if keyword_set(overplot) then return
56;
57; mask is from bottom to top
58;----------
59; boundaries conditions:
60  nx = (size(maskin))[1]
61  nz = (size(maskin))[2]+1
62;
63  IF size(xxaxisin, /n_dimensions) EQ 1 THEN $
64    xxaxisin = temporary(xxaxisin)#replicate(1, nz)
65  IF size(depthsin, /n_dimensions) EQ 1 THEN $
66    depthsin = replicate(1, nx)#temporary(depthsin)
67; for the mask : we add ocean at the top then it is always possible to
68; find one ocean point on each water column.
69  mask = [[maskin], [replicate(1, nx)]]
70; for x axis we also add one level
71;  xxaxis = [[xxaxisin], [xxaxisin[*, 0]]]
72; x axis must cover nx+1 points because we will draw the edge of the
73; mask.
74; if it was mot possible in decoupeterre.pro to extend the xxaxis we
75; do it now by hand
76  xxaxis = xxaxisin[*, 0]
77;  if (size(xxaxis))[1] EQ nx then begin
78  if n_elements(xxaxis) EQ nx then begin
79    deltax = abs(!x.range[1]-!x.range[0])/10.
80    xxaxis = [xxaxis[0]-deltax, xxaxis ]
81;    x0 = xxaxis[0]-deltax
82;    xxaxis = [replicate(x0, 1, nz), xxaxis ]
83  ENDIF
84; for the depth,
85  usepartial = total(depthsin, 2)
86  usepartial = total(usepartial NE usepartial[0]) GE 1
87  depths = depthsin[0:nx-1,*]
88; we add one level according to the ocean level we had to the mask.
89  deltaz = abs(!y.range[1]-!y.range[0])/10.
90  zmax = max(depthsin)+deltaz
91;   depths = [[depths], [replicate(zmax, nx+1)]]
92  depths = [[depths], [replicate(zmax, nx)]]
93; if min(depths) gt -1 then we must add one line at the bottom (this
94; appens when the bottom limit is defined between T[k] and W[k]
95; points)
96  IF min(depthsin) GT -1 OR max(total(mask, 2)) EQ nz THEN BEGIN
97    zmin = min(!y.range)-deltaz
98    depths = [[replicate(zmin, nx)], [depths]]
99    mask = [[replicate(0, nx)], [mask]]
100    nz = nz+1
101  ENDIF
102;
103;----------
104  xleft = xxaxis[0:nx-1]
105  xright = xxaxis[1:nx]
106; looking for the position of the bottom of the ocean.
107  pos = nz-1-total(mask, 2)
108  depths = depths[lindgen(nx)+nx*pos]
109;
110  xx = transpose([[xleft], [xright]])
111  xx = !x.range[0] > xx[*] < !x.range[1]
112  zz = transpose([[depths], [depths]])
113  out = where(zz GE max(depthsin) OR zz LT min(!y.range), countout)
114  zz = min(!y.range) > zz[*] < max(!y.range)
115;----------
116  xx = float(xx)
117  zz = float(zz)
118;----------
119; filling of the continents
120  IF NOT keyword_set(cont_color) THEN cont_color = (!d.n_colors - 1) < 255
121;   if NOT keyword_set(cont_nofill) then $
122;     polyfill, [min(xx,  max = maxx), xx[*], maxx] $
123;               , [min(zz,  max = mazz), zz[*], mazz] $
124;               , color = cont_color
125   if NOT keyword_set(cont_nofill) then $
126     polyfill, [min(xx, max = maxx), xx[*], maxx] $
127               , [!y.range[0], zz[*], !y.range[0]], color = cont_color
128;----------
129; drawing of the coast (bottom) line...
130; we could have plot directly xx and yy but if countout ne 0, doing
131; this will draw an non-existing bottom line along !y.range values
132; which is not so good...
133; we thus do this ugly for/if loops to make sure that we don't draw
134; these lines but we keep all vertical lines...
135   IF countout NE 0 THEN BEGIN
136     FOR i = 0, countout -1 DO BEGIN
137       CASE 1 OF
138         out[i] EQ 0:BEGIN
139; if we start with a out point
140           xxx = !values.f_nan
141           zzz = !values.f_nan
142         END
143         i EQ 0:BEGIN
144; i eq 0 but out[i] ne 0
145           xxx = [xx[0:out[i]], !values.f_nan]
146           zzz = [zz[0:out[i]], !values.f_nan]
147         END
148         ELSE:BEGIN
149; two consecutive out values at the same depth: we just keep
150; !values.f_nan values until the next change of depth
151           IF (out[i-1] EQ out[i]-1) AND (zz[out[i-1]] EQ zz[out[i]]) THEN BEGIN
152             xxx = [xxx, !values.f_nan]
153             zzz = [zzz, !values.f_nan]
154           ENDIF ELSE BEGIN
155; we keep everything inbetween the out values (including themselves
156; for the vertical lines) but we had !values.f_nan to remove the horizontal lines
157             xxx = [xxx, xx[out[i-1]:out[i]], !values.f_nan]
158             zzz = [zzz, zz[out[i-1]:out[i]], !values.f_nan]
159           ENDELSE
160         END
161       ENDCASE
162       IF i EQ countout-1 AND out[i] NE n_elements(xx)-1 THEN BEGIN
163         xxx = [xxx, xx[out[i]:*]]
164         zzz = [zzz, zz[out[i]:*]]
165       ENDIF
166     ENDFOR
167     plots, xxx, zzz, color = coast_color, thick = coast_thick, _extra = ex
168   ENDIF ELSE plots, xx, zz, color = coast_color, thick = coast_thick, _extra = ex
169;
170  return
171end
172
Note: See TracBrowser for help on using the repository browser.