;************************************************************* ; This program will read the dqr file and return the dates ; and times of bad data ;************************************************************* pro get_dqr,dqr_file,sec_per_day,day1,sjulian_day,ejulian_day,$ dqr_temp,dqr_rh,dqr_dp,dqr_uwind,dqr_vwind,dqr_pres ;************************************************************* ; Commands used to get the template ;************************************************************* ;filename='/data/mace/arm_data/twp/Manus_C1/twpsondewnpnC1.a1/dqr_twpsondewnpnC1.a1.txt' ;x=ascii_template(filename) ;IDL> print,x ;{ 1.00000 7 32 NaN 12 7 3 ; 3 3 3 3 3 3 ; 3 3 3 3 ;file start_date start_time end_date end_time pres tdry rh dp uwind vwind arm ; 0 19 31 43 53 63 ; 68 74 78 82 89 96 ; 0 1 2 3 4 5 ; 6 7 8 9 10 11 ;} ;IDL> help,x,/struct ;** Structure , 10 tags, length=376, data length=369, refs=1: ; VERSION FLOAT 1.00000 ; DATASTART LONG 7 ; DELIMITER BYTE 32 ; MISSINGVALUE FLOAT NaN ; COMMENTSYMBOL STRING '' ; FIELDCOUNT LONG 12 ; FIELDTYPES LONG Array[12] ; FIELDNAMES STRING Array[12] ; FIELDLOCATIONS LONG Array[12] ; FIELDGROUPS LONG Array[12] ;**************************************** ; Define the structure ;**************************************** ; Structure field names field_names=['datastream','start_date','start_time','end_date',$ 'end_time','pres','tdry','rh','dp','uwind','vwind','arm'] ; Structure field locations field_locations=['0','19','31','43','53','63','68','74','78','82','89','96'] ; Structure field types field_types=['7','3','3','3','3','3','3','3','3','3','3','3'] ; Structure field groups field_groups=[0,1,2,3,4,5,6,7,8,9,10,11] ; Structure field count field_count=[12] ; Ascii template structure a={dbasetemplate,$ VERSION:1.0,$ DATASTART:7,$ DELIMITER:32b,$ MISSINGVALUE:-9999.0,$ COMMENTSYMBOL:'',$ FIELDCOUNT:field_count,$ FIELDTYPES:field_types,$ FIELDNAMES:field_names,$ FIELDLOCATIONS:field_locations,$ FIELDGROUPS:field_groups} ;***************************************** ; Read the data from the ascii file into ; an IDL structure variable. Dbase is the data. ;***************************************** dbase=read_ascii(dqr_file,template=a) syy=strmid(string(dbase.start_date,format='(I8)'),0,4) smm=strmid(string(dbase.start_date,format='(I8)'),4,2) sdd=strmid(string(dbase.start_date,format='(I8)'),6,2) shh=strmid(string(dbase.start_time,format='(I04)'),0,2) smi=strmid(string(dbase.start_time,format='(I04)'),2,2) eyy=strmid(string(dbase.end_date,format='(I8)'),0,4) emm=strmid(string(dbase.end_date,format='(I8)'),4,2) edd=strmid(string(dbase.end_date,format='(I8)'),6,2) ehh=strmid(string(dbase.end_time,format='(I04)'),0,2) emi=strmid(string(dbase.end_time,format='(I04)'),2,2) dqr_pres=dbase.pres dqr_temp=dbase.tdry dqr_rh=dbase.rh dqr_dp=dbase.dp dqr_uwind=dbase.uwind dqr_vwind=dbase.vwind ;****************************************** ; Convert the dqr start and end time to julian day ;****************************************** sjulian_day=julday(smm,sdd,syy,shh,smi,0) ejulian_day=julday(emm,edd,eyy,ehh,emi,0) return end