;CODE TO READ THE MONTHLY SHADOWBAND DATA (DIRECT & DIFFUSE) ;and merge to the FULL cimel data (SSA, PSD, etc) ;for only the clear days (read from Nick's file irradcal440_clear ;this is for +/- 1/2 hour of the cimel time ;++++++++++History++++++++++ ;2015-08-18 add extension='.txt' or '.it0' ;2015-08-08 add more variable (sfc albedo in 670, 870, 1020 nm) ;2015-05-18 this program is modified from create_match_file_water.pro to add an input variable(sfc albedo in 440) to a output file ;2014-03-25 add nighttime bias ;2013-12-19 matchfile527.440_more440_20131219.txt : no limitation of SZA to increase the number of data ;2013-12-05 add water[cm] ;2013-06-17 One run for all channels ;2013-01-21 nick changed the format of irradiance file (add tau_no2cn) ;select sza < 65 at V0_chan_alldays.pro ;2012-03-08 add climatological ozone(AERONET ozone) ;ncol=155 -> ncol=156 ;changed directory ;/home/krotkov/UVMFRSR527/GSFC_DOME/V0/irradcal332nmaeronet.clearno2 extension='.it0' ; read files with zero iterations ;extension='.txt' ;*****************INput specific channel to read irradcal shadowband calibrated data*************************** ; Define output match file name channels=['305','311','317','325','332','368','440'] for k=0, 6 do begin chan = channels[k] openw,2, 'out527.dd'+chan+'_bolivia2_sfc_albedo'+extension ;openw,2, 'out527.dd'+chan+'_bolivia2_sfc_albedo'+extension ;***********************now read in full CIMEL data*********************** print,'now reading CIMEL data' ;read it in as a string to get number of lines dir2 = './' ;dir2 = '/home/jmok/UVMFRSR527_CALIBRATION/V0527_bolivia/CALIBRATION_OUTPUT/' file2 = dir2+'070901_071031_SANTA_CRUZ_UTEPSA.dubovik' openr,1, file2 num_header = 4 hdr=strarr(num_header) readf,1,hdr ;read header file_line = file_lines(file2) - num_header ncol=156 nrows=file_line s=fltarr(ncol,nrows) readf,1,s close,1 dd=reform(s(0,*)) mm=reform(s(1,*)) yy=reform(s(2,*)) hh=reform(s(3,*)) mn=reform(s(4,*)) sc=reform(s(5,*)) alb440 =reform(s(150,*)) ;surface albedo in 440 nm alb670 =reform(s(151,*)) ;surface albedo in 670 nm alb870 =reform(s(152,*)) ;surface albedo in 870 nm alb1020=reform(s(153,*)) ;surface albedo in 1020 nm ;******************************************************************* ;output file to add filename = 'out527.dd'+chan+'_bolivia2'+extension print,filename header = '' a = '' b = '' nrows = file_lines(filename)-1 nrecords=nrows/2 data = strarr(nrecords) openr,1,filename readf, 1, header new_header=' oleg_dd,oleg_month,oleg_yyyy,oleg_hh,oleg_mm,oleg_ss,oleg_dayofyear,aot1020m,aot870m,aot670m,aot500m,aot440m,aot380m,aot340m,oleg_aot440,oleg_aot670,oleg_aot870,oleg_aot1020,oleg_w440,oleg_w670,oleg_w870,oleg_w1020,rr440,rr670,rr870,rr1020,ri440,ri670,ri870,ri1020,vf,vc, rvf,rvc, lnsf,lnsc,hh,mm,sec,sza,ozone,no2,surfpr,lam,n_real,k_real,aot_mfrsr,ssa_mfrsr,aot_aer,tau_ray,tau_ozn,lam_dir,trans_tot,trans_dif,trans_dirn,v0_raw, zenith_ray, zenith_ratio,e_dir_ray,e_dir_ratio,e_dif_ray,e_dif_ratio,calc_par,meas_par,nit,errno2DU,no2_delta_time,asymetry,jacobian_k_dd, jacobian_ssa_dk, jacobian_asym_dk, water, sphericity, sky_error, sun_error, nt_bias, alb440, alb670, alb870, alb1020' printf,2, new_header while (not eof(1)) do begin readf, 1, a readf, 1, b data = strsplit(a,' ',/extract) day = fix(data[0]) month = fix(data[1]) year = fix(data[2]) hour = fix(data[3]) min_aer = fix(data[4]) sec = fix(data[5]) w=where ((dd eq day) and (mm eq month) and (yy eq year) and (hh eq hour) and (mn eq min_aer) and (sc eq sec), w_cnt) if w_cnt eq 0 then stop printf, 2, a printf, 2, b+string(alb440(w),format='(1x,F0.6)')+string(alb670(w),format='(1x,F0.6)')+string(alb870(w),format='(1x,F0.6)')+string(alb1020(w),format='(1x,F0.6)') endwhile close,/all endfor ;k print, 'finished' END