
FUNCTION eis_winwvl_hdr, hdr, iwin

;+
; NAME
;
;     EIS_WINWVL_HDR()
;
; PROJECT
;
;     Hinode/EIS
;
; EXPLANATION
;
;     For the specifed wavelength window in an EIS data object, this routine
;     returns the wavelength vector for the window.
;
; INPUTS
;
;     HDR  A header structure in the format returned by eis_get_hdr_struc.
;
;     IWIN The index of the window for which the wavelength array is
;          required. The first window is IWIN=0.
;
; OUTPUTS
;
;     Returns an array of wavelengths of same size as the dimensions of the
;     specified wavelength window within the EIS data object.
;
; CALLS
;
;     EIS_PIXEL_TO_WAVELENGTH
;
; HISTORY
;
;     Ver.1, 15-Jul-2007, Peter Young
;     Ver.2, 4-Dec-2008, Peter Young
;        added TIME= keyword in call to eis_pixel_to_wavelength
;-

tdetxw=hdr.tdetxw
tdetx=hdr.tdetx
slit_ind=hdr.slit_ind

bits=str_sep(tdetxw,' ')
tdetxw=fix(bits)
tdetxw=tdetxw[iwin]

bits=str_sep(tdetx,' ')
tdetx=fix(bits)
tdetx=tdetx[iwin]

IF tdetx GE 2148 THEN BEGIN
  tdetx=tdetx-2148-50
  ccd=0
ENDIF ELSE BEGIN
  ccd=1
  tdetx=tdetx-50
ENDELSE
 ;
ll=eis_pixel_to_wavelength(tdetx+indgen(tdetxw),ccd,slit_ind,time=hdr.date_obs)

return,ll

END
