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