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

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

modification of headers : mainly blanks around = sign for keywords in declaration of function and pro

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