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