1 | ;------------------------------------------------------------ |
---|
2 | ;------------------------------------------------------------ |
---|
3 | ;------------------------------------------------------------ |
---|
4 | ;+ |
---|
5 | ; |
---|
6 | ; @file_comments |
---|
7 | ; To color cleanly continents |
---|
8 | ; |
---|
9 | ; @categories |
---|
10 | ; Graphics |
---|
11 | ; |
---|
12 | ; @keyword _EXTRA |
---|
13 | ; Used to pass your keywords |
---|
14 | ; |
---|
15 | ; @keyword CONT_COLOR {default=(!d.n_colors - 1) < 255 => white} |
---|
16 | ; The color of the continent. |
---|
17 | ; |
---|
18 | ; @uses |
---|
19 | ; common.pro |
---|
20 | ; |
---|
21 | ; @history |
---|
22 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
23 | ; 8/8/2002 |
---|
24 | ; |
---|
25 | ; @version |
---|
26 | ; $Id$ |
---|
27 | ; |
---|
28 | ;- |
---|
29 | ;------------------------------------------------------------ |
---|
30 | ;------------------------------------------------------------ |
---|
31 | ;------------------------------------------------------------ |
---|
32 | PRO fillcornermask, xin, yin, COINMONTE = coinmonte, COINDESCEND = coindescend $ |
---|
33 | , CONT_COLOR = cont_color, INDICEZOOM = indicezoom $ |
---|
34 | , _extra = ex |
---|
35 | ; |
---|
36 | compile_opt idl2, strictarrsubs |
---|
37 | ; |
---|
38 | @common |
---|
39 | ;------------------------------------------------------------ |
---|
40 | if NOT keyword_set(coinmonte) AND NOT keyword_set(coindescend) then return |
---|
41 | ; |
---|
42 | tempsun = systime(1) ; For key_performance |
---|
43 | ; |
---|
44 | IF NOT keyword_set(cont_color) THEN cont_color = (!d.n_colors-1) < 255 |
---|
45 | ;------------------------------------------------------------ |
---|
46 | ; definition of coordinates of points numbered 1,2,3,4,5,6 (see figures below) |
---|
47 | ;------------------------------------------------------------ |
---|
48 | ; |
---|
49 | x1 = reform(xin) |
---|
50 | y1 = reform(yin) |
---|
51 | IF (size(x1))[0] EQ 2 THEN x1 = x1 [*, 0] |
---|
52 | IF (size(y1))[0] EQ 2 THEN y1 = y1 [0, *] |
---|
53 | x2 = .5*(x1+shift(x1, -1)) |
---|
54 | y2 = .5*(y1+shift(y1, -1)) |
---|
55 | nx = n_elements(x1) |
---|
56 | ny = n_elements(y1) |
---|
57 | ; |
---|
58 | ; |
---|
59 | ; |
---|
60 | ; Case land corner in ascent: |
---|
61 | ; 2 land points in diagonal ascending with 2 ocean points on the descendant diagonal. |
---|
62 | ; |
---|
63 | ; 3 |
---|
64 | ; t(i+nx)=1 u(i+nx) t(i+nx+1)=0 |
---|
65 | ; | \ |
---|
66 | ; | \ |
---|
67 | ; 1 | \ 4 |
---|
68 | ; v(i)---------f(i)------------v(i+1) |
---|
69 | ; \ | |
---|
70 | ; \ | |
---|
71 | ; \ | |
---|
72 | ; t(i)=0 2 u(i) t(i+1)=1 |
---|
73 | ; |
---|
74 | ; |
---|
75 | if keyword_set(coinmonte) then BEGIN |
---|
76 | if coinmonte[0] NE -1 then BEGIN |
---|
77 | iup = coinmonte MOD nx |
---|
78 | jup = coinmonte/nx |
---|
79 | for id = 0, n_elements(coinmonte)-1 do BEGIN |
---|
80 | i = iup[id] |
---|
81 | j = jup[id] |
---|
82 | IF i NE nx-1 AND j NE ny-1 THEN BEGIN |
---|
83 | polyfill, [x1[i], x2[i], x2[i], x1[i+1], x1[i]] $ |
---|
84 | , [y2[j], y1[j], y1[j+1], y2[j], y2[j]] $ |
---|
85 | , color = cont_color, _extra = ex |
---|
86 | ENDIF |
---|
87 | endfor |
---|
88 | endif |
---|
89 | endif |
---|
90 | ;------------------------------------------------------------ |
---|
91 | ; Case land corner in descent: |
---|
92 | ; 2 land points in diagonal descending with 2 ocean points on the ascendant diagonal. |
---|
93 | ; |
---|
94 | ; 4 |
---|
95 | ; t(i+nx)=1 u(i+nx) t(i+nx+1)=0 |
---|
96 | ; / | |
---|
97 | ; / | |
---|
98 | ; / 3 | 5 |
---|
99 | ; v(i)---------f(i)------------v(i+1) |
---|
100 | ; 1 | / |
---|
101 | ; | / |
---|
102 | ; | / |
---|
103 | ; t(i)=0 2 u(i) t(i+1)=1 |
---|
104 | ; |
---|
105 | if keyword_set(coindescend) then BEGIN |
---|
106 | if coindescend[0] NE -1 then begin |
---|
107 | idw = coindescend MOD nx |
---|
108 | jdw = coindescend/nx |
---|
109 | for id = 0, n_elements(coindescend)-1 do BEGIN |
---|
110 | i = idw[id] |
---|
111 | j = jdw[id] |
---|
112 | IF i NE nx-1 AND j NE ny-1 THEN BEGIN |
---|
113 | polyfill, [x1[i], x2[i], x2[i], x1[i+1], x1[i]] $ |
---|
114 | , [y2[j], y1[j+1], y1[j], y2[j], y2[j]] $ |
---|
115 | , color = cont_color, _extra = ex |
---|
116 | ENDIF |
---|
117 | endfor |
---|
118 | endif |
---|
119 | endif |
---|
120 | |
---|
121 | ;------------------------------------------------------------ |
---|
122 | IF keyword_set(key_performance) THEN print, 'temps fillcornermask', systime(1)-tempsun |
---|
123 | ;------------------------------------------------------------ |
---|
124 | return |
---|
125 | end |
---|