;+ ; NAME: ; tlsm ; ; PURPOSE: ; To read solar spectra from different sources ; (Solar Proxy Models, High-Resolution Measurements, ; Low_Resolution Measurements), output solar spectra ; on different binning schemes (1 nm Bins for 1D modeling, ; 5 nm Bins and Lines, Low Resolution Bins for GCMs) in ; production mode, or output both spectra and corresponding ; cross section and branching ratio in development mode. ; ; CATEGORY: ; Main program. ; ; PROCEDURE: ; There are three types of input spectra:Solar Proxy Models, ; High Resolution Measurements,Low Resolution Measurements. ; For programming purpose, spectra are divided into three ; groups: First group is a reference spectrum. Currently, it is ; Hinteregger reference spectrum; Second group is for spectra ; that have relostion of 1nm or higher, the spectra will be ; first mapped to 1 nm bins, then refined to Hinteregger ; spectrum resolution for wave length 100A-1000A and added ; desired lines in FUV using Hinteregger solar minimum reference ; spectrum, the mapping and refining processes are energy ; conserved; The third group is for spectra that have resolution ; lower than 1nm, the spectra will be refined to 1nm resolution ; using Woods solar minimum reference spectrum, and then be ; treated the same as Group 2. ; ; The reason for such grouping method is as follows: ; The low resolution scheme has logical bins that are grouped ; based on N2 absorption cross section. Since major species' ; cross sections have lots of structures in the wave length ; range of the logical bins (650 A - 975 A), it is required ; that input spectra have resolutions that closely matches ; cross section data for the grouping of logical bins to ; make sense. Hinteregger spectrum has resolution that closely ; matches cross section data, therefore, all input spectra ; are finally refined to Hinteregger spectrum resolution for ; wave length 100 A - 1000 A. Since the refining is energy ; conserved, it does not affect 1 nm bins and 5 nm bins and ; lines. ; ; Units of all input specta are converted to the same when ; read in: Angstrom for wave length, photon cm^-2 s^-1 for ; solar flux. ; ; for model spectra that have solar activity scaling indices, ; indices are converted to corresponding fluxes when read in. ; Then carried along implicitly as fluxes. ; ; ROUTINES CALLED: ; get_spectra, hi_to_nm, nm_to_hs, rebin ; ; MODIFICATION HISTORY: ; 12/12/02, Liying Qian, initial version ; ;+ ; ; Usage: ; choose run mode, w/wo scaling, desired binning scheme, and ; input spectra. ; ; to choose run mode: ; set variable mode='dev' to run the program in development mode, ; which means to get both rebinned solar spectra and cross ; section and branching ratio. ; set variable mode='prod' to run the program in production mode ; which means only calculate rebinned spectra. ; to choose to scale a reference(model) spectrum or not ; set variable 'iscale' to 1 if scaling is desired, and give ; f107 (f10.7 index),f107a(81-day centered average f10.7 index) ; set variable 'iscale' to 0 if scaling is not desired ; ignore this choice for measurement spectra. ; to choose binning scheme: ; assign a correct value for variable 'bin_file', ; low_bins.txt: low resolution bins ; nm_bins.txt: 1 nm bins ; glow_bins.txt: 5 nm bins & lines ; ; to choose input spectra: ; if the input spectra is one of the spectra already listed here, ; simply assign a correct value for variable 'group', then ; pick desired spectra in that group. If you want to use new ; spectra not listed here, first put the spectra in the right ; group, and make sure the value of variable 'group' is correct, ; then modify function get_spectra to make sure that the new ; spectra are read correctly in terms of its format, units, ; flux from per nm to per actual interval that might be less ; than 1nm, etc. ; ; List of input solar spectra: ; sc21refw.dat: Hinteregger solar minimum reference spectrum ; f79050n.dat: Hinteregger solar maximum reference spectrum ; ref_min_27day_11yr.dat: Woods reference spectrum ; see.dat: SEE data in ASCII format ; L3_merged_2002343_006.ncdf: SEE data in NetCDF format ; ;--------------------------------------------------------------- ; ; select run mode ;mode='dev' ; development mode mode='prod' ; production mode ; ; select if scaling of a reference spectrum is desired ; iscale=0 f107=192 f107a=208 ; ; select binning scheme ; bin_file='./input/low_bins.txt' ;bin_file='./input/glow_bins.txt' ;bin_file='./input/nm_bins.txt' ; ; Select input solar spectrum ; group=2 case group of 1: begin solar_file='./input/sc21refw.dat' ;solar_file='./input/f79050n.dat' end 2: begin ;solar_file='./input/see.dat' ;solar_file='./input/ref_min_27day_11yr.dat' ;solar_file='./input/woods.dat' ;solar_file='./input/L3_merged_2002343_006.ncdf' ;solar_file='./input/see__L3_merged_2003062_006.ncdf' ;solar_file='./input/EGS_1nm_Rocket_8Feb2002_v5.dat' ;solar_file='./input/rocket_1nm_8Feb2002_v5.dat' ;solar_file='./input/see_flare_2002111_v7b.dat' ;solar_file='/hao/ada1/lqian/timed/see/l3/input/see__L3_merged_2003269_006.ncdf' ;solar_file='/hao/ada1/lqian/timed/see/l3/input/see__L3_merged_2003308_007.ncdf' ;solar_file='/hao/ada1/lqian/timed/see/l3/input/see__L3A_merged_007_2003308.ncdf' ;solar_file='/hao/ada1/lqian/timed/see/l3/input/see__L3_merged_2003320_007.ncdf' ;solar_file='/hao/ada1/lqian/timed/see/l3/input/see__L3A_merged_007_2003320.ncdf' ;solar_file='/hao/ada1/lqian/timed/see/l3/input/see__L3A_merged_007_2004047.ncdf' ;solar_file='/hao/ada1/lqian/timed/see/l3/input/see__L3_merged_2004040_007.ncdf' ;solar_file='/hao/ada1/lqian/timed/see/l3/see__L3_merged_2005007_007.ncdf' ;solar_file='/hao/ada1/lqian/timed/see/l3/see__L3_merged_2005184_008.ncdf' ;solar_file='/hao/ada1/lqian/timed/see/l3/see__L3_merged_2005286_008.ncdf' ;solar_file='/hao/ada1/lqian/timed/see/l3/see__L3_merged_2006187_008.ncdf' ;solar_file='/hao/ada1/lqian/timed/see/l3/see__L3A_merged_2005286_008.ncdf' ;solar_file='/hao/ada1/lqian/timed/see/l3/see__L3A_merged_2006187_008.ncdf' ;solar_file='/hao/ada1/lqian/timed/see/l3/see__L3_merged_2007019_008.ncdf' ;solar_file='/hao/ada1/lqian/timed/see/l3/see__L3_merged_2007120_009.ncdf' ;solar_file='/hao/ada1/lqian/timed/see/l3/see__L3_merged_2008180_009.ncdf.prepared' ;solar_file='/hao/ada1/lqian/timed/see/l3/see__L3_merged_2009003_009.ncdf.prepared' ;solar_file='/hao/ada1/lqian/timed/see/l3/see__L3_merged_2009316_010.ncdf.prepared' ;solar_file='/hao/ada1/lqian/timed/see/l3/see__L3_merged_2007238_009.ncdf.repaired' ;solar_file='/hao/ada1/lqian/2005fall_agu/spectra/2003301/2003301.dat' ;solar_file='/hao/ada1/lqian/2005fall_agu/spectra/2003308/2003308.dat' ;solar_file='/hao/ada1/lqian/2005fall_agu/2003301_spectra_1nm.dat' ;solar_file='/hao/ada1/lqian/2008cedar_flare/kent/2006339flare_kent_orig.dat' ;solar_file='/hao/ada1/lqian/2008cedar_flare/phil/2006339flare_fism_orig.dat' ;solar_file='/hao/ada1/lqian/2008cedar_flare/phil/2003301flare_fism_orig.dat' ;solar_file='/hao/ada1/lqian/2008cedar_flare/phil/2004198flare_fism_orig.dat' ;solar_file='/hao/ada1/lqian/2008cedar_flare/phil/2005251flare_fism_orig.dat' ;solar_file='/hao/ada1/lqian/2008cedar_flare/phil/2003storm_fism_orig.dat' ;solar_file='//hao/ada1/lqian/2009LWS_project/prepare_fism_data/X17_position/fism_X17_cent_orig.dat' ;solar_file='//hao/ada1/lqian/2011_GIP/eve_rocket/fism_20100503_orig.dat' ;solar_file='//hao/ada1/lqian/2011_GIP/eve_rocket/eve_20100503_orig.dat' ;solar_file='/hao/ada1/lqian/2009LWS_project/fism_X17_limb_orig.dat' ;solar_file='/hao/ada1/lqian/2009LWS_project/prepare_fism_data/X17_position/fism_X17_noflare.dat' ;solar_file='/hao/ada1/lqian/2010LWS_project/prepare_fism_data/fism_year2_preflare_orig.dat' ;solar_file='/hao/ada1/lqian/2010LWS_project/prepare_fism_data/fism_year2_control_orig.dat' ;2010LWS ;solar_file='/hao/ada1/lqian/2010LWS_project/prepare_fism_data/fism_X10_preflare_orig.dat' ;solar_file='/hao/ada1/lqian/2010LWS_project/prepare_fism_data/fism_X10_long_gp_orig.dat' ;solar_file='/hao/ada1/lqian/2010LWS_project/prepare_fism_data/fism_X10_orig.dat' ;solar_file='/hao/ada1/lqian/2010LWS_project/prepare_fism_data/fism_X10_afterflare_orig.dat' ;solar_file='/hao/ada1/lqian/2010LWS_project/prepare_fism_data/fism_X10_quick_ip_orig.dat' ;solar_file='/net/venus/i/lqian/2009LWS_project/prepare_fism_data/X17_2flares/2003301-305_orig.dat' ;solar_file='/net/venus/i/lqian/2009LWS_project/prepare_fism_data/X17_2flares/2003300-305_orig.dat' ;solar_file='/hao/ada1/lqian/2011LWS_project/prepare_fism_data/2003300-305_noflare_orig.dat' ;solar_file='/hao/ada1/lqian/fism/2012LWS_proposal/lisird_FISM_daily_data.2001001.2001365/2001_fism_daily_orig.dat' ;solar_file='/hao/ada1/lqian/fism/2012LWS_proposal/lisird_FISM_flare_data.2001104.2001106/2001104-106_fism_flare_orig.dat' ;solar_file='/hao/ada1/lqian/fism/2012LWS_proposal/lisird_FISM_noflare_data.2001104.2001106/2001104-106_fism_noflare_orig.dat' ;solar_file='/hao/ada1/lqian/fism/2012LWS_team_meeting/lisird_FISM_daily_data.2005001.2005365/2005_fism_daily_orig.dat' ;solar_file='/hao/ada1/lqian/fism/2012LWS_team_meeting/lisird_FISM_flare_data.2005248.2005254/2005_0906-0910_fism_flare_orig.dat' ;solar_file='/hao/ada1/lqian/fism/2012LWS_team_meeting/lisird_FISM_noflare_data.2005248.2005254/2005_0906-0910_fism_noflare_orig.dat' ;solar_file='/hao/ada1/lqian/fism/2012LWS_team_meeting/lisird_FISM_daily_data.2011001.2011365/2011_fism_daily_orig.dat' ;solar_file='/hao/ada1/lqian/fism/2012LWS_team_meeting/lisird_FISM_flare_data.2011044.2011046/2011_0212-0215_eve_flare_orig.dat' ;solar_file='/hao/ada1/lqian/fism/2012LWS_team_meeting/lisird_FISM_noflare_data.2011044.2011046/2011_0212-0215_eve_noflare_orig.dat' ;solar_file='/hao/ada1/lqian/fism/2012flare_phil/lisird_FISM_flare_data.2012022.2012024/2012_0122-0124_fism_flare_orig.dat' ;solar_file='/hao/ada1/lqian/fism/2012flare_phil/lisird_FISM_noflare_data.2012022.2012024/2012_0122-0124_fism_noflare_orig.dat' ;solar_file='/hao/ada1/lqian/fism/2012flare_phil/lisird_FISM_daily_data.2012001.2012070/2012_fism_daily_orig.dat' ;solar_file='/net/venus/i/lqian/2009LWS_project/prepare_fism_data/X17_2flares/2005250-254_orig.dat' ;solar_file='/net/venus/i/lqian/2009AGU/phil/fism2008_min.dat' ;solar_file='/net/venus/i/lqian/2009AGU/stan/Woods2008_min.dat' ;solar_file='/net/venus/i/lqian/2009AGU/stan/Woods1996_min.dat' ;solar_file='/net/venus/i/lqian/solarmin_paper/woods_run/Woods2008_min_ver2.dat' ;solar_file='/net/venus/i/lqian/solarmin_paper/woods_run/Woods1996_min_ver2.dat' ;solar_file='/net/venus/i/lqian/2009AGU/phil/eve2008_min.dat' ;solar_file='/net/venus/i/lqian/fism/FISM_60sec_2005017_v00_00.nc' ;solar_file='/net/venus/i/lqian/fism/gang/FISM_01/FISM_60sec_2003_APR.nc' ;solar_file='/net/venus/i/lqian/fism/gang/FISM_01/FISM_60sec_2003_OCT.nc' ;solar_file='/net/venus/i/lqian/fism/gang/FISM_01/FISM_60sec_2005_JAN.nc' ;solar_file='/net/venus/i/lqian/fism/gang/FISM_01/FISM_60sec_2005_SEP.nc' ;solar_file='/net/venus/i/lqian/fism/gang/FISM_60sec_2005_SEP.nc' ;solar_file='./2012_0122-0124_fism_flare_orig.dat' solar_file='./2011001_365_fism_0_195nm_orig.dat' end 3: begin ;solar_file='./input/euvac.dat' solar_file='/hao/ada1/lqian/SPRM_Juan/HaoBinsEUV0Fmt.txt' ;solar_file='./input/euvac_spec.dat' ;solar_file='./input/ssflux.dat' end endcase ; ; read input solar spectra. ; in_spectra=get_spectra(solar_file,group) ; this part of code is used for flare study for the 2008 CEDAR workshop if (group eq 2) then begin close,12 openw,12,'check.txt' ;fmt='$(2f9.2,5e12.2)' ; Kent's flare spectra fmt='$(f9.2,4e12.2)' ; Phil's flare spectra printf,12,'after get_spectra' for i=0,194 do printf,12,fmt,in_spectra[0:4,i] endif ; end flare study ; ; prepare input spectra for rebin ; if group eq 2 then begin ; from 1 nm or higher resolution to 1 nm bins ; modified on 05/23/2008, LQIAN ; some input spectrum have high resolution, for example, Kent's ; tobiska's SOLARFLARE model give 0.1-nm resolution, with wave ; length at 0.5A, 1A, 2A...in this case,the input data ; should include appropriate short and long bin boundary (i.e. ; the first and second column of in_spectra are bin boundary) ; igb=0, hi_to_nm will assume in_spectra already has first and second ; columns as bin boundary ; igb=1, hi_to_nm will call get_bounday() to get bin boundary assuming ; that the first column of in_spectra are center wavelength for bins ;igb=0 ; for Kent's flare spectra and all other spectra that has high ; resolution especially in XUV such as SDO/EVE igb=1 ; for Phil's flare spectra that has 1 nm resolution and all other spectra ; that has one column for wavelength ;end modification, 05/23/2008 in_spectra=hi_to_nm(in_spectra,igb) ; used for flare study ; print,size(in_spectra) if (group eq 2) then begin printf,12,'after hi_to_nm' fmt='$(2f9.2,3e12.2)' for i=0,122 do printf,12,fmt,in_spectra[0:4,i] endif ;end flare study ; refine 1 nm binning to Hinteregger spectrum for wave length ; 100A-1000A and includ desired lines in FUV in_spectra=nm_to_hs(in_spectra) ; used for flare study ;if (group eq 2) then begin ; print,size(in_spectra) ; printf,12,'after nm_to_hs' ; for i=0,873 do printf,12,fmt,in_spectra[0:4,i] ; close,12 ;endif ;end flare study endif else if group eq 3 then begin ; from low resolution to Hinteregger resolution in_spectra=low_to_hs(in_spectra) endif ; ; rebin based on selected binning scheme. ; print,[in_spectra[0,*],in_spectra[1,*],in_spectra[2,*]] rebin, mode, bin_file,in_spectra, out_spectra, $ sigma_o,sigma_o2, sigma_n, sigma_n2 print,[out_spectra[0,*],out_spectra[1,*],out_spectra[2,*]] ; ; output ; put_spectra, mode, iscale, f107, f107a, solar_file, out_spectra, $ sigma_o,sigma_o2,sigma_n, sigma_n2 end