def read_scan(radar_obj, sweep_num, **kwargs): if "avail_index" in kwargs.keys(): avail_index=kwargs['avail_index'] else: radar_index={'DZ':0,'VR':1,'SW':2, 'CZ':3,'ZT':4,'DR':5,'LR':6,'ZD':7,'DM':8, 'RH':9,'PH':10,'XZ':11,'CR':12,'MZ':13,'MR':14, 'ZE':15,'VE':16,'KD':17,'TI':18,'DX':19,'CH':20,'AH':21,'CV':22, 'AV':23,'SQ':24} avail_index={} for index in radar_index.keys(): if pyradar.volume_exists(radar_obj, radar_index[index]): avail_index.update({index:radar_index[index]}) test_index=avail_index[avail_index.keys()[0]] myvol=pyradar.get_volume(radar_obj, test_index) mysweep=pyradar.get_sweep(myvol, sweep_num) myray=pyradar.get_ray(mysweep, 0) ngates=pyradar.get_ngates(myray) nrays=pyradar.get_nrays(mysweep) rng=linspace(pyradar.get_first_gate(myray), pyradar.get_first_gate(myray)+pyradar.get_gate_size(myray)*(pyradar.get_ngates(myray)-1.0), pyradar.get_ngates(myray))/1000.0 date_dict={'y':pyradar.get_yr(myray),'m':pyradar.get_month(myray),'d':pyradar.get_day(myray),'HH':pyradar.get_hour(myray), 'MM':pyradar.get_min(myray)} my_str="%(y)04d%(m)02d%(d)02d %(HH)02d%(MM)02d" %date_dict print ngates print nrays my_dict={} for index in avail_index.keys(): darr=zeros([nrays,ngates], dtype=float) rarr=zeros([nrays,ngates], dtype=float) elevs=zeros([nrays], dtype=float) azimuths=zeros([nrays], dtype=float) myvol=pyradar.get_volume(radar_obj, avail_index[index]) mysweep=pyradar.get_sweep(myvol, sweep_num) for i in range(nrays): elevs[i]=pyradar.get_elev(myray) azimuths[i]=pyradar.get_azimuth(myray) rarr[i,:]=rng for j in range(ngates): myray=pyradar.get_ray(mysweep, i) darr[i,j]=pyradar.get_value(myray, j) my_dict.update({index:darr}) my_dict.update({'Azmth':azimuths}) my_dict.update({'range':rarr}) my_dict.update({'Elev':elevs}) my_dict.update({'date':num2date(datestr2num(my_str))}) my_dict.update({'radar_name':pyradar.get_radarname(radar_obj)}) my_dict.update({'radar_loc':[pyradar.get_lat(radar_obj),pyradar.get_lon(radar_obj)]}) return my_dict
def read_volume(radar_obj, **kwargs): if "avail_index" in kwargs.keys(): avail_index=kwargs['avail_index'] else: radar_index={'DZ':0,'VR':1,'SW':2, 'CZ':3,'ZT':4,'DR':5,'LR':6,'ZD':7,'DM':8, 'RH':9,'PH':10,'XZ':11,'CR':12,'MZ':13,'MR':14, 'ZE':15,'VE':16,'KD':17,'TI':18,'DX':19,'CH':20,'AH':21,'CV':22, 'AV':23,'SQ':24} avail_index={} for index in radar_index.keys(): if pyradar.volume_exists(radar_obj, radar_index[index]): avail_index.update({index:radar_index[index]}) nscans=pyradar.get_nsweeps(pyradar.get_volume(radar_obj,avail_index[avail_index.keys()[0]])) scanlist=[] for i in range(nscans): print "Reading scan ",i+1, " of ", nscans scanlist.append(append_ijk(append_xyz(read_scan(radar_obj, i, avail_index=avail_index)))) return scanlist