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