;+ ; NAME: cube_getwaveaxis ; PURPOSE: return which axis of a cube is the wavelength dimension ; INPUTS: ; KEYWORDS: ; OUTPUTS: ; The index for the axis of the cube that is wavelength. ; ; NOTE: this is ZERO-INDEXED. So the first axis is 0 and the second is ; 1, etc. ; ; HISTORY: ; Began 2007-07-16 17:41:43 by Marshall Perrin ;- FUNCTION cube_getwaveaxis, cubestruct if ~(keyword_set(cubestruct)) then message, "Missing argument!" if tag_exist(cubestruct, 'astr') then astr = cubestruct.astr else extast3, cubestruct.header, astr ; allowable spectral coordinate type codes. Griesen et al. 2006 Table 1 wave_axes_types = ["FREQ", "ENER", "WAVN", "VRAD", "WAVE", "VOPT", "ZOPT", $ "AWAV", "VELO", "BETA"] for i = 0,n_elements(wave_axes_types)-1 do begin axis_lambda = where( strmid(astr.ctype,0,4) eq wave_axes_types[i], lambdact) if lambdact eq 1 then break endfor ; if still nothing, then complain if lambdact eq 0 then message, "Did not find unique wavelength axis!" else axis_lambda=axis_lambda[0] return, axis_lambda end