1 | ;------------------------------------------------------------ |
---|
2 | ;------------------------------------------------------------ |
---|
3 | ;------------------------------------------------------------ |
---|
4 | ;+ |
---|
5 | ; |
---|
6 | ; @file_comments |
---|
7 | ; Draw coasts in plt. |
---|
8 | ; |
---|
9 | ; @categories |
---|
10 | ; Graphics |
---|
11 | ; |
---|
12 | ; @keyword SURFACE_COASTLINE |
---|
13 | ; To draw the surface coast line instead of |
---|
14 | ; the coast line at level firstz[tw]. Useful only for deep |
---|
15 | ; plots! |
---|
16 | ; |
---|
17 | ; @keyword _EXTRA |
---|
18 | ; used to pass your keywords |
---|
19 | ; |
---|
20 | ; @uses |
---|
21 | ; common.pro |
---|
22 | ; |
---|
23 | ; @history |
---|
24 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
25 | ; 30/9/1999 |
---|
26 | ; |
---|
27 | ; @version |
---|
28 | ; $Id$ |
---|
29 | ; |
---|
30 | ;- |
---|
31 | ;------------------------------------------------------------ |
---|
32 | ;------------------------------------------------------------ |
---|
33 | ;------------------------------------------------------------ |
---|
34 | PRO tracecote, SURFACE_COASTLINE = surface_coastline, _EXTRA = ex |
---|
35 | ;-------------------------------------------------------------- |
---|
36 | ; include commons |
---|
37 | ; |
---|
38 | compile_opt idl2, strictarrsubs |
---|
39 | ; |
---|
40 | @cm_4data |
---|
41 | @cm_4mesh |
---|
42 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
43 | @updatenew |
---|
44 | ENDIF |
---|
45 | ;-------------------------------------------------------------- |
---|
46 | tempsun = systime(1) ; For key_performance |
---|
47 | if n_elements(key_gridtype) EQ 0 then key_gridtype = 'c' |
---|
48 | ; |
---|
49 | ; We enlarge a bit the frame defined by firsts..., lasts... in order to |
---|
50 | ; recuperate edges of the coast which are in the edging of the domain. |
---|
51 | ; |
---|
52 | tempdeux = systime(1) ; For key_performance =2 |
---|
53 | firstx = 0 > (min([firstxt, firstxf])-1) |
---|
54 | lastx = (max([lastxt, lastxf])+1) < (jpi-1) |
---|
55 | firsty = 0 > (min([firstyt, firstyf])-1) |
---|
56 | lasty = (max([lastyt, lastyf])+1) < (jpj-1) |
---|
57 | nx = lastx-firstx+1 |
---|
58 | ny = lasty-firsty+1 |
---|
59 | ; Which vertical level choose? |
---|
60 | IF keyword_set(surface_coastline) THEN firstz = 0 ELSE $ |
---|
61 | IF strupcase(vargrid) eq 'W' THEN firstz = firstzw ELSE firstz = firstzt |
---|
62 | ; Attribution of the mask and of coordinates delimiting limits of the land (coordinates f). |
---|
63 | mask = tmask[firstx:lastx, firsty:lasty, firstz] |
---|
64 | xf = glamf[firstx:lastx, firsty:lasty] |
---|
65 | yf = gphif[firstx:lastx, firsty:lasty] ; |
---|
66 | IF testvar(var = key_performance) EQ 2 THEN $ |
---|
67 | print, 'temps tracecote: determiner mask xf yf', systime(1)-tempdeux |
---|
68 | ; |
---|
69 | if key_gridtype EQ 'e' then onemore = xf[0, 0] gT xf[0, 1] |
---|
70 | ; We pass in normalized coordinates to be able to become independant from the projection's |
---|
71 | ; type choosen and from the support on which we do the drawing (screen or postscript) |
---|
72 | z = convert_coord(xf[*],yf[*],/data,/to_normal) |
---|
73 | xf = reform(z[0, *], nx, ny) |
---|
74 | yf = reform(z[1, *], nx, ny) |
---|
75 | tempvar = SIZE(TEMPORARY(z)) |
---|
76 | ; |
---|
77 | ; Beware, following the projection, some points x or y can become NaN (see point |
---|
78 | ; behind the earth in an orthographic projection). |
---|
79 | ; |
---|
80 | ; We put points to be eliminated at a very big value so that they will not pass the |
---|
81 | ; test with distanceseuil (see further). |
---|
82 | ; |
---|
83 | if (!map.projection LE 7 AND !map.projection NE 0) $ |
---|
84 | OR !map.projection EQ 14 OR !map.projection EQ 15 OR !map.projection EQ 18 then begin |
---|
85 | ind = where(finite(xf*yf) EQ 0) |
---|
86 | IF ind[0] NE -1 THEN BEGIN |
---|
87 | xf[ind] = 1e5 |
---|
88 | yf[ind] = 1e5 |
---|
89 | ENDIF |
---|
90 | ENDIF |
---|
91 | ind = where(xf LT !p.position[0] OR xf GT !p.position[2]) |
---|
92 | IF ind[0] NE -1 THEN xf[ind] = 1e5 |
---|
93 | ind = where(yf LT !p.position[1] OR yf GT !p.position[3]) |
---|
94 | IF ind[0] NE -1 THEN yf[ind] = 1e5 |
---|
95 | tempvar = SIZE(TEMPORARY(ind)) ; we delete ind |
---|
96 | ; |
---|
97 | case strmid(key_gridtype, 0, 1) of |
---|
98 | 'c':drawcoast_c, mask, xf, yf, nx, ny, _extra = ex |
---|
99 | 'e':drawcoast_e, mask, xf, yf, nx, ny, onemore = onemore, _extra = ex |
---|
100 | endcase |
---|
101 | if keyword_set(key_performance) THEN print, 'temps tracecote', systime(1)-tempsun |
---|
102 | return |
---|
103 | end |
---|