;+ ; NAME: ; read_hs ; ; PURPOSE: ; to read Hinteregger Spectrum. ; ; CATEGORY: ; utility function. ; ; CALLING SEQUENCE: ; data=read_hs(solar_file,solar_activity,n_rows) ; ; INPUTS: ; solar_file: source file name of solar spectrum. ; solar_activity: 'low' for solar minimum, ; 'high' for solar maximum. ; n_rows: number of lines of data. ; ; OUTPUTS: ; data: a two dimensional array that holds spectrum data. ; It has 4 columns for solar minimum (wave length, ; solar flux, origin of solar irradiance, flux ratio). ; It has 2 columns for solar maximum (wave length, ; solar flux). ; ; COMMON BLOCKS: ; None. ; ; PROCEDURE: ; This routine modifies the original solar spectrum to include ; a line (789.36 A) in the 5 nm bins and lines' binning scheme. ; ; ROUTINES CALLED: ; None. ; ; MODIFICATION HISTORY: ; 12/12/02, Liying Qian, Initial version. ; ;+ function read_hs,solar_file,solar_activity,n_rows get_lun,lu openr,lu,solar_file temp=fltarr(4,n_rows) if solar_activity eq 'low' then begin format='$(f8.2,f8.1,a11,i1,f10.6)' endif else begin format='$(f8.2,f8.1,a11)' endelse label='' for i=0,n_rows-1 do begin if solar_activity eq 'low' then begin readf,lu,format,a,b,label,c,d temp[0,i]=a temp[1,i]=b*1.e6 ; to be in units of photons/cm2/s temp[2,i]=c temp[3,i]=d endif else begin readf,lu,format,a,b,label temp[0,i]=a temp[1,i]=b*1.e6 ; to be in units of photons/cm2/s endelse endfor free_lun,lu ; modify the original solar spectrum to include a line in GLOW at ; 789.36A ind=where((temp(0,*) eq 787.71) or (temp(0,*) eq 790.15)) temp_flux=total(temp(1,ind)) temp(1,ind)=0 temp_ratio=temp(3,ind[0]) temp(3,ind)=0 n_temp=n_elements(temp(0,*)) b=fltarr(4,n_temp+1) b(*,0:n_temp-1)=temp b(0,n_temp)=789.36 b(1,n_temp)=temp_flux b(3,n_temp)=temp_ratio b(2,n_temp)=temp(2,ind[0]) ind=sort(b(0,*)) b=b(*,ind) ; Assign data for the short wave length where data is not ; available. ; data at short wave length arr_l=[[1,1e-1,2,1e-1],[2,5e1,2,5e1],[4,1e4,2,1e4],[8,2e6,2,2e6]] arr_h=[[1,5e2,0,0],[2,3e4,0,0],[4,8e5,0,0],[8,5e7,0,0]] ; append it to the original data arr_l=transpose(arr_l) arr_h=transpose(arr_h) b=transpose(b) if solar_activity eq 'low' then b=[arr_l,b] $ else b=[arr_h,b] b=transpose(b) n_rows=n_elements(b[0,*]) ; convert scaling indices to flux to adapt the data to ; general procedures of TLSM if solar_activity eq 'low' then begin sc1=fltarr(n_rows) sc2=fltarr(n_rows) for i=0,n_rows-1 do begin if b[2,i] eq 1 then begin sc1[i]=b[3,i]*b[1,i] sc2[i]=0 endif else if b[2,i] eq 2 then begin sc2[i]=b[3,i]*b[1,i] sc1[i]=0 endif endfor b[2,*]=sc1 b[3,*]=sc2 endif ; change the format to adapt the spectrum to general ; procedure rebin data=fltarr(5,n_rows) data[0,*]=b[0,*] data[1,*]=b[0,*] data[1,0:3]=[2,4,8,16] data[2:4,*]=b[1:3,*] ; the scale2 value for the first 4 bins (1-16A) are obtained from GLOW. ; in GLOW, scale1*1.e6 would be in units of photon cm^-2 s^-1, here in ; this file, scale1 and scale2 should be in units of photon cm^-2 s^-1 data[4,0]=4.8E-6*1.e6 data[4,1]=2.9E-4*1.e6 data[4,2]=7.6E-3*1.e6 data[4,3]=0.46*1.e6 return,data end