;+
;
; @file_comments
; compute the mask and the axis for a vertical section
;
; @param MASK {in}{required}
; 3d mask
;
; @param GLAM {in}{required}
; 2d longitude
;
; @param GPHI {in}{required}
; 2d latitude
;
; @param Z {in}{required}
; 1d depth
;
; @keyword XXAXIS
; to get the xaxis we need to use in pltbase
;
; @keyword ZZAXIS
; to get the yaxis we need to use in pltbase
;
; @keyword SIN
; Activate this keyword if we want the x axis to be traced in sinus of the
; latitude when we make a drawing f(y)
;
; @keyword ZRATIO {default=2./3}
; When the drawing has a zoomed part, it is the size ratio between the zoomed
; part, hz (zoom height), and the whole drawing, ht (total height).
;
; @keyword _EXTRA
; Used to pass keywords
;
; Others: see pltz
;
; @history
; Sebastien Masson (smasson\@lodyc.jussieu.fr)
; June 24, 2002
;
; @version
; $Id$
;
;-
PRO axis4pltz, type, mask, glam, gphi, z $
, XXAXIS=xxaxis, ZZAXIS=zzaxis, SIN=sin, ZRATIO=zratio $
, ZOOM=zoom, PROFMAX=profmax, PROFMIN=profmin, _EXTRA=ex
;
compile_opt idl2, strictarrsubs
;
@cm_4mesh
IF NOT keyword_set(key_forgetold) THEN BEGIN
@updatekwd
ENDIF
;--------------------------------------------------------------------
; define the mask used for this section
;--------------------------------------------------------------------
if mask[0] NE -1 AND (size(mask))[0] NE 2 then begin
if type EQ 'xz' then mask = total(mask, 2) < 1 $
ELSE mask = total(mask, 1) < 1
endif
;--------------------------------------------------------------------
; define xxaxis and yyaxis the axis used for this section
;--------------------------------------------------------------------
nx = (size(glam))[1]
CASE (size(gphi))[0] OF
1:ny = (size(gphi))[1]
2:ny = (size(gphi))[2]
ENDCASE
CASE (size(z))[0] OF
1:nz = (size(z))[1]
2:nz = (size(z))[2]
ENDCASE
;
if type eq 'yz' then BEGIN
IF (size(gphi))[0] EQ 1 then xxaxis = gphi ELSE BEGIN
IF keyword_set(key_irregular) THEN BEGIN
cln = (where(gphi EQ max(gphi)))[0]
xxaxis = reform(gphi[cln MOD nx, *])
ENDIF ELSE xxaxis = reform(gphi[0, *])
ENDELSE
if keyword_set(sin) then xxaxis = sin(!pi/180.*xxaxis)
ENDIF ELSE BEGIN
xxaxis = glam[*, 0]
ENDELSE
zzaxis = z
;----------------------------------------------------------
; We project the z axis in [0,1]
;----------------------------------------------------------
if not keyword_set(zratio) then zratio = 2./3
if zoom ge profmax then zratio = 1.
if zoom LT profmax then begin
mp = projsegment([profmin, zoom], [0, zratio], /mp)
small = where(zzaxis LE zoom)
IF small[0] NE -1 THEN zzaxis[small] = mp[0]*zzaxis[small]+mp[1]
mp = projsegment([zoom, profmax], [zratio, 1], /mp)
big = where(zzaxis GE zoom)
IF big[0] NE -1 THEN zzaxis[big] = mp[0]*zzaxis[big]+mp[1]
ENDIF ELSE BEGIN
mp = projsegment([profmin, profmax], [0, 1], /mp)
zzaxis = mp[0]*zzaxis+mp[1]
ENDELSE
; to draw from bottom to top (avoid using cell_fill)
CASE size(zzaxis, /n_dimensions) OF
1:zzaxis = reverse(-zzaxis)
2:zzaxis = reverse(-zzaxis, 2)
ENDCASE
if mask[0] NE -1 then mask = reverse(mask, 2)
return
end