Exemple #1
0
def radar_to_cappi(radar1_filename, radar2_filename,**kwargs):
	ini_fname=kwargs.get('ini_fname', os.getenv('HOME')+'/bom_mds/bom_mds.ini')
	loud=kwargs.get('loud', False)
	ini_dict=parse_ini.parse_ini(ini_fname)
	if loud: print "Loading radar file 1"
	if 'radar1_path' in ini_dict.keys():
		radar1=read_radar.load_radar(ini_dict['radar1_path']+radar1_filename)
	else:
		radar1=pyradar.load_radar(radar1_filename)
	if loud: print "Loading radar file 2"
	if 'radar2_path' in ini_dict.keys():
		radar2=read_radar.load_radar(ini_dict['radar2_path']+radar2_filename)
	else:
		radar2=pyradar.load_radar(radar2_filename)
	cappi_z_bounds=ini_dict.get('cappi_z_bounds', [500,15000])
	cappi_xy_bounds=ini_dict.get('cappi_xy_bounds', [-50000, 50000])
	cappi_resolution=ini_dict.get('cappi_resolution', [100, 40])
	levs=linspace(cappi_z_bounds[0], cappi_z_bounds[1], cappi_resolution[1])
	xar=linspace(cappi_xy_bounds[0], cappi_xy_bounds[1], cappi_resolution[0])
	yar=linspace(cappi_xy_bounds[0], cappi_xy_bounds[1], cappi_resolution[0])
	displace=mathematics.corner_to_point(radar1[0]['radar_loc'], radar2[0]['radar_loc'])
	if loud: print "Cappi-ing radar 1"
	radar1_cube=radar_to_cart.make_cube(radar1, xar, yar, levs)
	if loud: print "Cappi-ing radar 2"
	radar2_cube=radar_to_cart.make_cube(radar2, xar, yar, levs, displacement=displace)
	cube_fname=ini_dict['cube_path']+'cappi_'+std_datestr(radar1_cube['date'])+'.nc'
	netcdf_utis.save_data_cube(radar1_cube, radar2_cube, cube_fname)
Exemple #2
0
def save_cube_test(date,gpnum, bernum):
	gp_0740=read_rays.construct_lassen_scan(path='/bm/gdata/scollis/gunn_pt/'+date+gpnum+'/')
	ber_0740=read_rays.construct_uf_scan(path='/bm/gdata/scollis/berrimah/'+date+'_'+bernum+'/')	
	ber_loc=[-12.457, 130.925]
	gp_loc=	 [-12.2492,  131.0444]
	displace=mathematics.corner_to_point(gp_loc, ber_loc)
	ldict={'lat_0':gp_loc[0], 'lon_0':gp_loc[1],'llcrnrlat':-13.0, 'llcrnrlon':130.2, 'urcrnrlat':-12.0 , 'urcrnrlon':131.2, 'lat_ts':gp_loc[0]}
	levs=linspace(500,15000, 21)
	xar=linspace(-50.,50., 100)*1000.0
	yar=linspace(-50.,50., 100)*1000.0
	gp_cube=radar_to_cart.make_cube(gp_0740, xar, yar, levs)
	ber_cube=radar_to_cart.make_cube(ber_0740, xar-displace[0], yar-displace[1], levs)
	netcdf_utis.save_data_cube(ber_cube, gp_cube, '/bm/gdata/scollis/cube_data/'+date+'_'+bernum[0:4]+'_ver1.nc', gp_loc)
Exemple #3
0
def pickle_to_cappi(gp_pickle, ber_pickle, **kwargs):
	path=kwargs.get('path', '/bm/gkeep/scollis/deal_ber/')
	debug=kwargs.get('debug', False)
	if debug: print "Loading Pickles"
	gp=pickle_zip.load(path+gp_pickle)
	ber=pickle_zip.load(path+ber_pickle)	
	ber_loc=[-12.457, 130.925]
	gp_loc=[-12.2492,  131.0444]
	displace=mathematics.corner_to_point(gp_loc, ber_loc)
	ldict={'lat_0':gp_loc[0], 'lon_0':gp_loc[1],'llcrnrlat':-13.0, 'llcrnrlon':130.2, 'urcrnrlat':-12.0 , 'urcrnrlon':131.2, 'lat_ts':gp_loc[0]}
	levs=linspace(500,10000, 30)
	xar=linspace(-50.,50., 100)*1000.0
	yar=linspace(-50.,50., 100)*1000.0
	gp_cube=radar_to_cart.make_cube(gp, xar, yar, levs)
	ber_cube=radar_to_cart.make_cube(ber, xar-displace[0], yar-displace[1], levs)
	print gp_cube['CZ'].shape
	netcdf_utis.save_data_cube(ber_cube, gp_cube, '/bm/gdata/scollis/cube_data/'+std_datestr(gp[0]['date'])+'_deal.nc', gp_loc)