pro riq_idl,file ;This program reads an RIQ file and saves the header in an IDL ;structure ;Justin Mabie ;Version 1.0 3/1/2013 ;CIRES @ NOAA/NESDIS/NGDC prefix=strmid(file,0,19) ;file prefix ext=strmid(file,20,3) ;file extension - to handle riq or RIQ infile=strcompress(prefix+'.'+ext,/remove_all) openr,11,infile a=0L aa=0.0 b=0D ;ba=bytarr(128) ;b ;bb=bytarr(64) ;c ;bc=bytarr(32) ;d ;bd=bytarr(16) ;e ;be=bytarr(8) ;f ;instead, define variables directly te='12345678' ;8 td=strcompress(te+te,/remove_all) ;16 tc=strcompress(td+td,/remove_all) ;32 tb=strcompress(tc+tc,/remove_all) ;64 ta=strcompress(tb+tb,/remove_all) ;128 tf=strcompress(ta+ta+ta+ta,/remove_all) ;512 sf=make_array(256,value=a) ;1024 sa=make_array(32,value=tc) ;g 128 sb=make_array(16,value=a) ;h 64 sc=make_array(8,value=tc) ;i 32 sg=make_array(8,value=a) sd=make_array(2,value=a) ;j 16 se=make_array(1,value=a) ;k 8 char rxt=make_array(8,32,value=a) ;rx antenna type descriptors rxd=make_array(3,32,value=aa) ;array for rx position and direction rxa=make_array(3,value=a) ;for tx vector dba=make_array(2,64,value=a) ;drive band bounds dbb=make_array(64,value=a) bda=make_array(2,1024,value=a) ;data and cal baud ba=make_array(8192,value=a) ;base table pa=make_array(256,value=a) ;pulse pattern rxm=make_array(16,value=a) ;rx map ca=make_array(160,value=a) ;coefficients ma=make_array(8,value=a) ;monitor vars ;header header={magic:a,sounding_table_size:a,pulse_table_size:a,raw_data_size:a,struct_version:aa,start_year:a,start_daynumber:a,start_month:a,start_day:a,start_hour:a,start_minute:a,start_second:a,start_epoch:a,readme:ta,decimation_method:a,decimation_threshold:a,user:ta,partial_file_flag:a,max_pulse:a} ; Format and object end. Length 316 bytes ;station station={file_id:tb,ursi_id:te,rx_name:tc,rx_latitude:aa,rx_longitude:aa,rx_altitude:aa,rx_count:a,rx_antenna_type:sa,rx_position:rxd,rx_direction:rxd,rx_height:sa,rx_cable_length:sa,frontend_atten:aa,tx_name:tc,tx_latitude:aa,tx_longitude:aa,tx_altitude:aa,tx_antenna_type:tc,tx_vector:rxa,tx_height:aa,tx_cable_length:aa,drive_band_count:a,drive_band_bounds:dba,drive_band_atten:dbb,rf_control:a,ref_type:tc,clock_type:tc,user:ta} ;Format and object end. Size 3236 bytes ;offset is 3552 ;timing timing={file_id:tb,pri:a,pri_count:a,ionogram_count:a,holdoff:a,range_gate_offset:a,gate_count:a,gate_start:a,gate_end:a,gate_step:a,data_start:a,data_width:a,data_baud_count:a,data_wave_file:tb,data_baud:bda,data_pairs:a,cal_start:a,cal_width:a,cal_baud_count:a,cal_wave_file:tb,cal_baud:bda,cal_pairs:a,user:ta} ;Format and object end. Size 16772 bytes. ;offset is 20324 ;frequency frequency={file_id:tb,base_start:a,base_end:a,base_steps:a,tune_type:a,base_table:ba,linear_step:a,log_step:a,freq_table_id:tb,tune_steps:a,pulse_count:a,pulse_pattern:sf,pulse_offset:a,ramp_steps:a,ramp_repeats:a,drive_table:ba,user:ta} ;Format and object end. Size 66860 bytes. ;offset is 87184 ;receiver rx={file_id:tb,rx_chan:a,rx_map:rxm,word_format:a,cic2_dec:a,cic2_interp:a,cic2_scale:a,cic5_dec:a,cic5_scale:a,rcf_type:tc,rcf_dec:a,rcf_taps:a,coefficients:pa,analog_delay:a,user:ta} ;Format and object end. Size 968 bytes ;offset is 88152 ;exciter ex={file_id:tb,cic_scale:a,cic2_dec:a,cic2_interp:a,cic5_interp:a,rcf_type:sc,rcf_taps:a,rcf_taps_phase:a,coefficients:pa,analog_delay:a,user:ta} ;Format and object end. Size 1276 bytes. ;offset is 89428 ;monitor monitor={balun_currents:sg,balun_status:sg,front_end_status:sg,receiver_status:sg,exciter_status:sd,user:tf} ;Format and object end. Size 648 bytes ;pct={record_id:a,pri_ut:b,pri_time_offset:b,base_id:a,pulse_id:a,ramp_id:a,repeat_id:a,loop_id:a,frequency:a,nco_tune_word:a,drive_attenuation:a,pa_flags:a,pa_forward_power:a,pa_reflected_power:a,pa_vswr:a,pa_temperature:a,proc_range_count:a,proc_noise_level:a,user:tb} sct={header:header,station:station,timing:timing,frequency:frequency,rx:rx,ex:ex,monitor:monitor};,pct:pct} ;call the routine that reads in SCT values outname=prefix read_bin,sct,outname close,/all end