;+ ; NAME: ; get_boundary ; ; PURPOSE: ; To calculate short boundary and long boundary ; wave length for a centered wave length input spectra. ; Caution: for a non-uniformly spaced spectrum, it can cause ; inconsistent result during the process of rebin. ; ; CATEGORY: ; utility function. ; ; CALLING SEQUENCE: ; data_out=get_boundary(data_in) ; ; INPUTS: ; data_in: two dimensional array that holds the input ; array. It has at least two columns: ; (wave length, solar flux, scaling ; fluxes/additional fluxes if any) ; ; OUTPUTS: ; data_out: two dimensional array that holds output ; array. It has at least three columns: ; (short boundary,long boundary, solar flux, ; scaling fluxes/additional fluxes if any) ; ; COMMON BLOCKS: ; None. ; ; PROCEDURE: ; ; ROUTINES CALLED: ; None. ; ; MODIFICATION HISTORY: ; 12/12/02, Liying Qian, Initial Version ; ;+ function get_boundary,data_in wave=data_in(0,*) n_rows=n_elements(wave) result=size(data_in) n_columns=result[1] data_out=fltarr(n_columns+1,n_rows) del=fltarr(n_rows-1) waves=fltarr(n_rows) wavel=fltarr(n_rows) for i=0,n_rows-2 do begin del[i]=(wave[i+1]-wave[i])/2 wavel[i]=wave[i]+del[i] waves[i+1]=wavel[i] endfor waves[0]=wave[0]-del[0] wavel[n_rows-1]=wave[n_rows-1]+del[n_rows-2] data_out[0,*]=waves data_out[1,*]=wavel data_out[2:n_columns,*]=data_in[1:n_columns-1,*] ;format='$(i4,3(2x,f7.2),2(2x,e10.3))' ;for i=0,n_rows-1 do begin ; print,format,i,waves[i],wave[i],wavel[i],data_out[2,i] ;endfor return,data_out end