pro makeHDFdata, gas, year, site close,/all ; 2012 new gather does not reverse altitudes - edit covariances here ;you need to enter the percentage errors as determined by error calcncar and listed in Error_summary for your gas ;these will be multiplied by the total column to get the error in molecules/cm2 if site eq 'TAB' then begin srandcolper=0.0 sspectcolper=0.0 if gas eq 'hno3' then begin srandcolper=0.7233 ;random error percentages calculated by errorcalcncar, listed in Error_summary sspectcolper=6.0234; spectral error endif if gas eq 'hcl' then begin srandcolper=2.0036 ;random error percentages calculated by errorcalcncar, listed in Error_summary sspectcolper=7.8468; spectral error endif if gas eq 'hf' then begin srandcolper=1.07434 ;random error percentages calculated by errorcalcncar, listed in Error_summary sspectcolper=2.0513; spectral error endif if gas eq 'clono2' then begin srandcolper=24.8 ;random error percentages calculated by errorcalcncar, listed in Error_summary sspectcolper=3.7; spectral error endif if gas eq 'o3' then begin srandcolper=0.5121;random error percentages calculated by errorcalcncar, listed in Error_summary sspectcolper=1.8144; spectral error endif if gas eq 'c2h6' then begin srandcolper=1.2078;random error percentages calculated by errorcalcncar, listed in Error_summary sspectcolper=10.7629; spectral error endif if gas eq 'n2o' then begin srandcolper=0.4842;random error percentages calculated by errorcalcncar, listed in Error_summary sspectcolper=3.5734; spectral error endif if gas eq 'co' then begin srandcolper=0.6280;random error percentages calculated by errorcalcncar, listed in Error_summary sspectcolper=1.1707; spectral error endif if srandcolper eq 0 then begin print, 'random and systematic error percentages not yet entered in makeHDFdata for this gas. Using fill value' stop endif endif ;close TAB if site eq 'MLO' then begin srandcolper=0.0 sspectcolper=0.0 if gas eq 'hno3' then begin srandcolper=1.7993 ;random error percentages calculated by errorcalcncar, listed in Error_summary sspectcolper=6.1783; spectral error endif if gas eq 'hcl' then begin srandcolper=1.1229 ;random error percentages calculated by errorcalcncar, listed in Error_summary sspectcolper=3.4154; spectral error endif if gas eq 'hf' then begin srandcolper=1.05456 ;random error percentages calculated by errorcalcncar, listed in Error_summary sspectcolper=0.61739; spectral error endif if gas eq 'o3' then begin srandcolper=0.49616;random error percentages calculated by errorcalcncar, listed in Error_summary sspectcolper=1.6240; spectral error endif if gas eq 'c2h6' then begin srandcolper=1.3058;random error percentages calculated by errorcalcncar, listed in Error_summary sspectcolper=13.5258; spectral error endif if gas eq 'co' then begin srandcolper=0.5026;random error percentages calculated by errorcalcncar, listed in Error_summary sspectcolper=1.5615; spectral error endif if srandcolper eq 0 then begin print, 'random and systematic error percentages not yet entered in makeHDFdata for this gas. Using fill value' stop endif endif ;close MLO if srandcolper eq 0 then begin print, 'random and systematic error percentages not yet entered in makeHDFdata for this site. Using fill value' stop endif capgas=strupcase(gas) savfilename='../'+gas+'.sav' ;savfilename='../'+gas+'.housefiltered_all.sav' restore,savfilename il=where(data.year eq year, nil) if nil eq 0 then goto, next temp=data(il) data=temp ;add a bit to remove any MLO measurements from 19961029 or 19961102) if site eq 'MLO' then begin furtherfilter=where(temp.year eq 1996 and temp.day eq 29 and temp.month eq 10, complement=others) datat=temp(others) furtherfilter2=where(datat.year eq 1996 and datat.day eq 2 and datat.month eq 11, complement=others) data=datat(others) endif n=n_elements(data.datetime) if site eq 'TAB' then nlayers=47 if site eq 'MLO' then nlayers=41 Srandomfile=capgas+'_Srandom.covariance' Srandom=fltarr(nlayers, nlayers) Ssystfile=capgas+'_Ssystematic.covariance' Ssyst=fltarr(nlayers, nlayers) junk='' ;read the covariance matrices in openr,1,Srandomfile readf,1,junk readf,1,Srandom close,1 openr,1,Ssystfile readf,1,junk readf,1,Ssyst close,1 ;reverse both of these matrices because everything else is altitude bottom-top! ;temp=reverse(reverse(Srandom,1),2) ;Srandom=temp ;temp=reverse(reverse(Ssyst,1),2) ;Ssyst=temp inputfilename=gas+'_'+year+'_input.txt' openw,1,inputfilename printf,1, 'DATETIME' for i=0, n-1 do printf,1, data(i).datetime printf,1,'LATITUDE.INSTRUMENT' printf,1, data(0).latitude printf,1,'LONGITUDE.INSTRUMENT' printf,1, data(0).longitude printf,1,'ALTITUDE.INSTRUMENT' printf,1, data(0).alt_instrument printf,1,'ALTITUDE.BOUNDARIES' ;for i=0, n-1 do begin for j=0, nlayers-1 do begin printf,1,data(0).alt_boundaries(0,j) endfor for j=0, nlayers-1 do begin printf,1,data(0).alt_boundaries(1,j) endfor ;endfor ;printf,1,'ALTITUDE.LAYER.INDEX' ;;for i=0, n-1 do begin ; for j=0, nlayers-1 do printf,1, data(0).alt_index(j) ;;endfor printf,1,'SURFACE.PRESSURE_INDEPENDENT' for i=0, n-1 do begin if data(i).surface_pressure eq -999.0000 then begin printf,1,' -90000.000' endif else printf,1, data(i).surface_pressure endfor printf,1,'SURFACE.TEMPERATURE_INDEPENDENT' for i=0, n-1 do printf,1, data(i).surface_temperature printf,1,'ALTITUDE' for j=0, nlayers-1 do printf,1,data(0).altitude(j) printf,1,'PRESSURE_INDEPENDENT' for i=0, n-1 do begin for j=0, nlayers-1 do begin printf,1,data(i).p(j) endfor endfor printf,1,'TEMPERATURE_INDEPENDENT' for i=0, n-1 do begin for j=0, nlayers-1 do begin printf,1,data(i).t(j) endfor endfor printf,1,capgas+'.MIXING.RATIO_ABSORPTION.SOLAR' for i=0, n-1 do begin for j=0, nlayers-1 do begin printf,1,data(i).retvmr(j) endfor endfor printf,1, capgas+'.MIXING.RATIO_ABSORPTION.SOLAR_APRIORI' for i=0, n-1 do begin for j=0, nlayers-1 do begin printf,1,data(i).aprvmr(j) endfor endfor printf,1,capgas+'.MIXING.RATIO_ABSORPTION.SOLAR_AVK' for i=0, n-1 do begin for j=0, nlayers-1 do begin for k=0, nlayers-1 do begin printf,1,data(i).AK(j,k) endfor endfor endfor printf,1, 'INTEGRATION.TIME'; capgas+'.MIXING.RATIO_ABSORPTION.SOLAR_INTEGRATION.TIME' for i=0, n-1 do printf,1,data(i).int_time printf,1,capgas+'.MIXING.RATIO_ABSORPTION.SOLAR_UNCERTAINTY.RANDOM' for i=0, n-1 do begin for j=0, nlayers-1 do begin for k=0, nlayers-1 do begin printf,1,Srandom(j,k) endfor endfor endfor printf,1, capgas+'.MIXING.RATIO_ABSORPTION.SOLAR_UNCERTAINTY.SYSTEMATIC' for i=0, n-1 do begin for j=0, nlayers-1 do begin for k=0, nlayers-1 do begin printf,1,Ssyst(j,k) endfor endfor endfor printf,1,capgas+'.COLUMN.PARTIAL_ABSORPTION.SOLAR' for i=0, n-1 do begin for j=0, nlayers-1 do begin printf,1,data(i).retlaycol(j) endfor endfor printf,1,capgas+'.COLUMN.PARTIAL_ABSORPTION.SOLAR_APRIORI' for i=0, n-1 do begin for j=0, nlayers-1 do begin printf,1,data(i).aprlaycol(j) endfor endfor printf,1,capgas+'.COLUMN_ABSORPTION.SOLAR' for i=0, n-1 do printf,1,data(i).rettc printf,1,capgas+'.COLUMN_ABSORPTION.SOLAR_APRIORI' for i=0, n-1 do printf,1,data(i).aprtc printf,1,capgas+'.COLUMN_ABSORPTION.SOLAR_AVK' for i=0, n-1 do begin for j=0, nlayers-1 do begin printf,1,data(i).aktc(j) endfor endfor printf,1,capgas+'.COLUMN_ABSORPTION.SOLAR_UNCERTAINTY.RANDOM' if srandcolper ne 0. then begin for i=0, n-1 do printf,1, (srandcolper/100.)*data(i).rettc endif else begin for i=0, n-1 do printf,1, '-9.0000E+004' endelse printf,1,capgas+'.COLUMN_ABSORPTION.SOLAR_UNCERTAINTY.SYSTEMATIC' if sspectcolper ne 0 then begin for i=0, n-1 do printf,1, (sspectcolper/100.)*data(i).rettc endif else begin for i=0L, 572-1 do printf,1, '-9.0000E+004' endelse printf,1,'ANGLE.SOLAR_ZENITH.ASTRONOMICAL' for i=0, n-1 do printf,1,data(i).sza printf,1,'ANGLE.SOLAR_AZIMUTH' for i=0, n-1 do begin if data(i).azi le 180 then printf,1, data(i).azi ;azi is 360 from S, converting to description in meta, +/- S if data(i).azi gt 180 then printf,1, (360.-data(i).azi)*(-1) endfor printf,1,'H2O.MIXING.RATIO_ABSORPTION.SOLAR' for i=0, n-1 do begin for j=0, nlayers-1 do begin printf,1,data(i).aprh2ovmr(j) endfor endfor printf,1,'H2O.COLUMN_ABSORPTION.SOLAR' for i=0, n-1 do printf,1,data(i).aprh2otc close,1 next: end