[67] | 1 | ;------------------------------------------------------------ |
---|
| 2 | ;------------------------------------------------------------ |
---|
| 3 | ;------------------------------------------------------------ |
---|
| 4 | ;+ |
---|
| 5 | ; |
---|
[150] | 6 | ; @file_comments |
---|
| 7 | ; Fill and draw the bottom continents for a real section. |
---|
[67] | 8 | ; |
---|
[150] | 9 | ; @categories |
---|
[67] | 10 | ; |
---|
[163] | 11 | ; @param MASKIN {in}{required} |
---|
[67] | 12 | ; |
---|
[163] | 13 | ; @param XXAXISIN {in}{required} |
---|
[67] | 14 | ; |
---|
[163] | 15 | ; @param DEPTHSIN {in}{required} |
---|
[67] | 16 | ; |
---|
[163] | 17 | ; @keyword COAST_COLOR {default=0} |
---|
[150] | 18 | ; The color of the coastline. |
---|
[163] | 19 | ; Default is black (0). |
---|
[67] | 20 | ; |
---|
[163] | 21 | ; @keyword COAST_THICK {default=1} |
---|
[150] | 22 | ; The thickness of the coastline. |
---|
[67] | 23 | ; |
---|
[163] | 24 | ; @keyword CONT_COLOR {default=(!d.n_colors - 1) < 255} |
---|
| 25 | ; The color of the continent. Default value is |
---|
| 26 | ; Default is white (0). |
---|
[67] | 27 | ; |
---|
[150] | 28 | ; @uses |
---|
| 29 | ; common.pro |
---|
[67] | 30 | ; |
---|
[150] | 31 | ; @restrictions |
---|
| 32 | ; Simple way to fill continents for a section (using the |
---|
[67] | 33 | ; fact that continents are wider at the bottom than at the top). |
---|
| 34 | ; |
---|
[150] | 35 | ; @history |
---|
[157] | 36 | ; Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
[150] | 37 | ; June 14, 2002 |
---|
[67] | 38 | ; |
---|
[150] | 39 | ; @version |
---|
| 40 | ; $Id$ |
---|
| 41 | ; |
---|
| 42 | ; @todo |
---|
| 43 | ; Seb: definir params |
---|
[67] | 44 | ;- |
---|
| 45 | ;------------------------------------------------------------ |
---|
| 46 | ;------------------------------------------------------------ |
---|
| 47 | ;------------------------------------------------------------ |
---|
| 48 | PRO drawsectionbottom, maskin, xxaxisin, depthsin $ |
---|
| 49 | , COAST_COLOR = coast_color, COAST_THICK = coast_thick $ |
---|
| 50 | , CONT_COLOR = cont_color, CONT_NOFILL = cont_nofill $ |
---|
| 51 | , OVERPLOT = overplot, _extra = ex |
---|
| 52 | ;--------------------------------------------------------- |
---|
[114] | 53 | ; |
---|
| 54 | compile_opt idl2, strictarrsubs |
---|
| 55 | ; |
---|
[67] | 56 | @cm_general |
---|
| 57 | IF NOT keyword_set(key_forgetold) THEN BEGIN |
---|
| 58 | @updatekwd |
---|
| 59 | ENDIF |
---|
| 60 | ;--------------------------------------------------------- |
---|
| 61 | if keyword_set(overplot) then return |
---|
| 62 | ; |
---|
| 63 | ; mask is from bottom to top |
---|
| 64 | ;---------- |
---|
| 65 | ; boundaries conditions: |
---|
| 66 | nx = (size(maskin))[1] |
---|
| 67 | nz = (size(maskin))[2]+1 |
---|
| 68 | ; |
---|
| 69 | IF size(xxaxisin, /n_dimensions) EQ 1 THEN $ |
---|
| 70 | xxaxisin = temporary(xxaxisin)#replicate(1, nz) |
---|
| 71 | IF size(depthsin, /n_dimensions) EQ 1 THEN $ |
---|
| 72 | depthsin = replicate(1, nx)#temporary(depthsin) |
---|
| 73 | ; for the mask : we add ocean at the top then it is always possible to |
---|
| 74 | ; find one ocean point on each water column. |
---|
| 75 | mask = [[maskin], [replicate(1, nx)]] |
---|
| 76 | ; for x axis we also add one level |
---|
| 77 | ; xxaxis = [[xxaxisin], [xxaxisin[*, 0]]] |
---|
| 78 | ; x axis must cover nx+1 points because we will draw the edge of the |
---|
| 79 | ; mask. |
---|
| 80 | ; if it was mot possible in decoupeterre.pro to extend the xxaxis we |
---|
| 81 | ; do it now by hand |
---|
| 82 | xxaxis = xxaxisin[*, 0] |
---|
| 83 | ; if (size(xxaxis))[1] EQ nx then begin |
---|
| 84 | if n_elements(xxaxis) EQ nx then begin |
---|
| 85 | deltax = abs(!x.range[1]-!x.range[0])/10. |
---|
| 86 | xxaxis = [xxaxis[0]-deltax, xxaxis ] |
---|
| 87 | ; x0 = xxaxis[0]-deltax |
---|
| 88 | ; xxaxis = [replicate(x0, 1, nz), xxaxis ] |
---|
| 89 | ENDIF |
---|
| 90 | ; for the depth, |
---|
| 91 | usepartial = total(depthsin, 2) |
---|
| 92 | usepartial = total(usepartial NE usepartial[0]) GE 1 |
---|
| 93 | depths = depthsin[0:nx-1,*] |
---|
| 94 | ; we add one level according to the ocean level we had to the mask. |
---|
| 95 | deltaz = abs(!y.range[1]-!y.range[0])/10. |
---|
| 96 | zmax = max(depthsin)+deltaz |
---|
| 97 | ; depths = [[depths], [replicate(zmax, nx+1)]] |
---|
| 98 | depths = [[depths], [replicate(zmax, nx)]] |
---|
| 99 | ; if min(depths) gt -1 then we must add one line at the bottom (this |
---|
| 100 | ; appens when the bottom limit is defined between T[k] and W[k] |
---|
| 101 | ; points) |
---|
[114] | 102 | IF min(depthsin) GT -1 OR max(total(mask, 2)) EQ nz THEN BEGIN |
---|
[67] | 103 | zmin = min(!y.range)-deltaz |
---|
| 104 | depths = [[replicate(zmin, nx)], [depths]] |
---|
| 105 | mask = [[replicate(0, nx)], [mask]] |
---|
| 106 | nz = nz+1 |
---|
| 107 | ENDIF |
---|
| 108 | ; |
---|
| 109 | ;---------- |
---|
| 110 | xleft = xxaxis[0:nx-1] |
---|
| 111 | xright = xxaxis[1:nx] |
---|
| 112 | ; looking for the position of the bottom of the ocean. |
---|
| 113 | pos = nz-1-total(mask, 2) |
---|
| 114 | depths = depths[lindgen(nx)+nx*pos] |
---|
| 115 | ; |
---|
| 116 | xx = transpose([[xleft], [xright]]) |
---|
| 117 | xx = !x.range[0] > xx[*] < !x.range[1] |
---|
| 118 | zz = transpose([[depths], [depths]]) |
---|
| 119 | out = where(zz GE max(depthsin) OR zz LT min(!y.range), countout) |
---|
| 120 | zz = min(!y.range) > zz[*] < max(!y.range) |
---|
| 121 | ;---------- |
---|
| 122 | xx = float(xx) |
---|
| 123 | zz = float(zz) |
---|
| 124 | ;---------- |
---|
| 125 | ; filling of the continents |
---|
| 126 | IF NOT keyword_set(cont_color) THEN cont_color = (!d.n_colors - 1) < 255 |
---|
| 127 | ; if NOT keyword_set(cont_nofill) then $ |
---|
| 128 | ; polyfill, [min(xx, max = maxx), xx[*], maxx] $ |
---|
| 129 | ; , [min(zz, max = mazz), zz[*], mazz] $ |
---|
| 130 | ; , color = cont_color |
---|
| 131 | if NOT keyword_set(cont_nofill) then $ |
---|
| 132 | polyfill, [min(xx, max = maxx), xx[*], maxx] $ |
---|
| 133 | , [!y.range[0], zz[*], !y.range[0]], color = cont_color |
---|
| 134 | ;---------- |
---|
| 135 | ; drawing of the coast (bottom) line... |
---|
| 136 | ; we could have plot directly xx and yy but if countout ne 0, doing |
---|
| 137 | ; this will draw an non-existing bottom line along !y.range values |
---|
| 138 | ; which is not so good... |
---|
| 139 | ; we thus do this ugly for/if loops to make sure that we don't draw |
---|
| 140 | ; these lines but we keep all vertical lines... |
---|
| 141 | IF countout NE 0 THEN BEGIN |
---|
| 142 | FOR i = 0, countout -1 DO BEGIN |
---|
| 143 | CASE 1 OF |
---|
| 144 | out[i] EQ 0:BEGIN |
---|
| 145 | ; if we start with a out point |
---|
| 146 | xxx = !values.f_nan |
---|
| 147 | zzz = !values.f_nan |
---|
| 148 | END |
---|
| 149 | i EQ 0:BEGIN |
---|
| 150 | ; i eq 0 but out[i] ne 0 |
---|
| 151 | xxx = [xx[0:out[i]], !values.f_nan] |
---|
| 152 | zzz = [zz[0:out[i]], !values.f_nan] |
---|
| 153 | END |
---|
| 154 | ELSE:BEGIN |
---|
| 155 | ; two consecutive out values at the same depth: we just keep |
---|
| 156 | ; !values.f_nan values until the next change of depth |
---|
| 157 | IF (out[i-1] EQ out[i]-1) AND (zz[out[i-1]] EQ zz[out[i]]) THEN BEGIN |
---|
| 158 | xxx = [xxx, !values.f_nan] |
---|
| 159 | zzz = [zzz, !values.f_nan] |
---|
| 160 | ENDIF ELSE BEGIN |
---|
| 161 | ; we keep everything inbetween the out values (including themselves |
---|
| 162 | ; for the vertical lines) but we had !values.f_nan to remove the horizontal lines |
---|
| 163 | xxx = [xxx, xx[out[i-1]:out[i]], !values.f_nan] |
---|
| 164 | zzz = [zzz, zz[out[i-1]:out[i]], !values.f_nan] |
---|
| 165 | ENDELSE |
---|
| 166 | END |
---|
| 167 | ENDCASE |
---|
| 168 | IF i EQ countout-1 AND out[i] NE n_elements(xx)-1 THEN BEGIN |
---|
| 169 | xxx = [xxx, xx[out[i]:*]] |
---|
| 170 | zzz = [zzz, zz[out[i]:*]] |
---|
| 171 | ENDIF |
---|
| 172 | ENDFOR |
---|
| 173 | plots, xxx, zzz, color = coast_color, thick = coast_thick, _extra = ex |
---|
| 174 | ENDIF ELSE plots, xx, zz, color = coast_color, thick = coast_thick, _extra = ex |
---|
| 175 | ; |
---|
| 176 | return |
---|
| 177 | end |
---|
| 178 | |
---|