source: trunk/SRC/ToBeReviewed/TRIANGULATION/completecointerre.pro @ 157

Last change on this file since 157 was 157, checked in by navarro, 18 years ago

header improvements + xxx doc

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.0 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
6; @file_comments
7;
8;
9; @categories
10; Graphics
11;
12; @param LONS
13;
14;
15; @param LATS
16;
17;
18; @param SEUIL
19;
20;
21; @keyword _EXTRA
22; Used to pass your keywords
23;
24; @keyword CONT_COLOR
25; The color of the continent. defaut value is
26; (!d.n_colors - 1) < 255 => white
27;
28; @uses
29; common.pro
30;
31; @history
32; Sebastien Masson (smasson\@lodyc.jussieu.fr)
33;                      01/10/1999
34;
35; @version
36; $Id$
37;
38;-
39;------------------------------------------------------------
40;------------------------------------------------------------
41;------------------------------------------------------------
42PRO draw_corner_triangle, lons, lats, seuil, CONT_COLOR = cont_color, _extra = ex
43;
44  compile_opt idl2, strictarrsubs
45;
46@cm_4mesh
47; the triangle must not be out of the domain
48  IF min(lons, max = maxlon) GE lon1 AND maxlon LE lon2 $
49    AND min(lats, max = maxlat) GE lat1 AND maxlat LE lat2 then BEGIN
50; the triangle must not be too big
51    z = convert_coord(lons, lats, /data, /to_normal)
52    alldist = [(z[0, 2]-z[0, 0])^2 + (z[1, 2]-z[1, 0])^2 $
53               , (z[0, 0]-z[0, 1])^2 + (z[1, 0]-z[1, 1])^2 $
54               , (z[0, 1]-z[0, 2])^2 + (z[1, 1]-z[1, 2])^2]
55    IF max(alldist) LT seuil^2 THEN polyfill, lons, lats $
56      , color = cont_color, _extra = ex
57    return
58  ENDIF
59end
60;------------------------------------------------------------
61;------------------------------------------------------------
62;------------------------------------------------------------
63;+
64;
65; @file_comments
66; To color cleanly continents
67;
68; @categories
69; Graphics
70;
71; @keyword _EXTRA
72; Used to pass your keywords
73;
74; @keyword CONT_COLOR
75; The color of the continent. defaut value is
76; (!d.n_colors - 1) < 255 => white
77;
78; @keyword COINMONTE
79; It is an array. To obtain the array of "ascending land corner"
80; to be treated with completecointerre.pro in the variable array
81; instead of make it pass by the global variable twin_corners_up.
82;
83; @keyword COINDESCEND
84; It is an array. See COINMONTE
85;
86; @keyword INDICEZOOM
87; The zoom's index
88;
89; @uses
90; common.pro
91;
92; @history
93; Sebastien Masson (smasson\@lodyc.jussieu.fr)
94;                      01/10/1999
95;
96; @version
97; $Id$
98;
99;-
100;------------------------------------------------------------
101;------------------------------------------------------------
102;------------------------------------------------------------
103PRO completecointerre, COINMONTE = coinmonte, COINDESCEND = coindescend $
104                       , CONT_COLOR = cont_color, INDICEZOOM = indicezoom $
105                       , _extra = ex
106;
107  compile_opt idl2, strictarrsubs
108;
109@common
110;------------------------------------------------------------
111;   if NOT keyword_set(coinmonte) then return
112;   if NOT keyword_set(coindescend) then return
113;   if NOT keyword_set(indicezoom) then return
114  tempsun = systime(1)          ; For key_performance
115;------------------------------------------------------------
116; definitions of vectors coinmont and coindesc
117;------------------------------------------------------------
118  if keyword_set(coinmonte) then coinmont = coinmonte $
119  ELSE coinmont = twin_corners_up
120  if keyword_set(coindescend) then coindesc = coindescend $
121  ELSE coindesc = twin_corners_dn
122  IF NOT keyword_set(cont_color) THEN cont_color = (!d.n_colors-1) <  255
123;------------------------------------------------------------
124; definition of coordinates of points numbered 1,2,3,4,5,6 (see figures below)
125;------------------------------------------------------------
126  tempdeux = systime(1)         ; For key_performance =2
127  if coinmont[0] NE -1 OR coindesc[0] NE -1 then BEGIN
128    if keyword_set(indicezoom) then BEGIN
129; if we use key_stide, the t, u, v and f points are no more related to
130; the same cell because glamf and gphif has be recomputed to be in the
131; middle of two t points
132      IF total(key_stride) EQ 3 AND finite(glamv[0]*gphiv[0]) NE 0 THEN BEGIN
133        long1 = glamv[indicezoom] & lati1 = gphiv[indicezoom]
134      ENDIF ELSE BEGIN
135        long1 = glamt[indicezoom] & lati1 = gphif[indicezoom]
136      ENDELSE
137      IF total(key_stride) EQ 3 AND finite(glamu[0]*gphiu[0]) NE 0 THEN BEGIN
138        long2 = glamu[indicezoom] & lati2 = gphiu[indicezoom]
139      ENDIF ELSE BEGIN
140        long2 = glamf[indicezoom] & lati2 = gphit[indicezoom]
141      ENDELSE
142      long3 = glamf[indicezoom] & lati3 = gphif[indicezoom]
143    ENDIF ELSE BEGIN
144      IF total(key_stride) EQ 3 AND finite(glamv[0]*gphiv[0]) NE 0 THEN BEGIN
145        long1 = glamv & lati1 = gphiv
146      ENDIF ELSE BEGIN
147        long1 = glamt & lati1 = gphif
148      ENDELSE
149      IF total(key_stride) EQ 3 AND finite(glamu[0]*gphiu[0]) NE 0 THEN BEGIN
150        long2 = glamu & lati2 = gphiu
151      ENDIF ELSE BEGIN
152        long2 = glamf & lati2 = gphit
153      ENDELSE
154      long3 = glamf & lati3 = gphif
155    ENDELSE
156;
157    nx = (size(long1, /dimensions))[0]
158    ny = (size(long1, /dimensions))[1]
159    seuil = 5 < (min([nx, ny])-2)
160    seuil = min([(!p.position[2]-!p.position[0])/seuil $
161                 , (!p.position[3]-!p.position[1])/seuil])
162;
163  ENDIF
164;
165  IF testvar(var = key_performance) EQ 2 THEN $
166    print, 'temps completecointerre: positions des points', systime(1)-tempdeux
167;
168;
169; Case land corner in ascent:
170;      2 land points in diagonal ascending with 2 ocean points on the descendant diagonal.
171;
172;                     4   
173;     t(i+nx)=1    u(i+nx)       t(i+nx+1)=0
174;                     |    \
175;                     |        \
176;         1         3 |            \   5
177;       v(i)---------f(i)------------v(i+1)
178;           \         |
179;              \      |
180;                 \   |
181;      t(i)=0       2 u(i)          t(i+1)=1
182;
183;
184  if coinmont[0] NE -1 then BEGIN
185    tempdeux = systime(1)       ; For key_performance =2
186    for id = 0, n_elements(coinmont)-1 do BEGIN
187      i = coinmont[id]
188      ii = i MOD nx
189      ij = i/nx
190; bottom triangle
191      lons = [long1[i], long2[i], long3[i]]
192      lats = [lati1[i], lati2[i], lati3[i]]
193      draw_corner_triangle, lons, lats, seuil, CONT_COLOR = cont_color, _extra = ex
194; upper triangle
195      IF ii NE nx-1 AND ij NE ny-1 THEN BEGIN
196        lons = [long3[i], long1[i+1], long2[i+nx]]
197        lats = [lati3[i], lati1[i+1], lati2[i+nx]]
198        draw_corner_triangle, lons, lats, seuil, CONT_COLOR = cont_color, _extra = ex
199      ENDIF
200    ENDFOR
201    IF testvar(var = key_performance) EQ 2 THEN $
202      print, 'temps completecointerre: trace de cointerremonte', systime(1)-tempdeux
203  ENDIF
204;------------------------------------------------------------
205; Case land corner in descent:
206;      2 land points in diagonal descending with 2 ocean points on the ascendant diagonal.
207;
208;                     4
209;     t(i+nx)=1    u(i+nx)       t(i+nx+1)=0
210;                /    |       
211;             /       |         
212;          /        3 |                5
213;       v(i)---------f(i)------------v(i+1)
214;         1           |            /
215;                     |         /
216;                     |      /
217;      t(i)=0      2 u(i)          t(i+1)=1
218;
219  if coindesc[0] NE -1 then begin
220    tempdeux = systime(1)       ; For key_performance =2
221    for id = 0, n_elements(coindesc)-1 do BEGIN
222      i = coindesc[id]
223      ii = i MOD nx
224      ij = i/nx
225      IF ii NE nx-1 AND ij NE ny-1 THEN BEGIN
226; left triangle
227        lons = [long1[i], long3[i], long2[i+nx]]
228        lats = [lati1[i], lati3[i], lati2[i+nx]]
229        draw_corner_triangle, lons, lats, seuil, CONT_COLOR = cont_color, _extra = ex
230; right triangle
231        lons = [long3[i], long2[i], long1[i+1]]
232        lats = [lati3[i], lati2[i], lati1[i+1]]
233        draw_corner_triangle, lons, lats, seuil, CONT_COLOR = cont_color, _extra = ex
234      ENDIF
235    ENDFOR
236    IF testvar(var = key_performance) EQ 2 THEN $
237      print, 'temps completecointerre: trace de cointerredescend', systime(1)-tempdeux
238  ENDIF
239
240;------------------------------------------------------------
241  IF keyword_set(key_performance) THEN print, 'temps completecointerre', systime(1)-tempsun
242;------------------------------------------------------------
243  return
244end
Note: See TracBrowser for help on using the repository browser.