thenk you for your e-mail,
following in attachment the python code that take data and plot the two images.
# Thake offset and gain info from file
gain=fcontent['dataset%d/data1/what' %i]['gain']
offset=fcontent['dataset%d/data1/what' %i]['offset']
#Take data from file
data = fcontent['dataset%d/data1/data' %i]
data = gain*np.array(data)+offset
fig = pl.figure(figsize=(24,24), dpi=100)
ax, pm = wrl.vis.plot_ppi(data, fig=fig)
pl.title('Reflectivity Map')
pl.show()
'''
#Clutter statistics
clutter = wrl.clutter.filter_gabella(data, tr1=12, n_p=6, tr2=1.1)
pl.figure(figsize=(10,10))
ax, pm = wrl.vis.plot_ppi(clutter, cmap=pl.cm.gray)
pl.title('Clutter Map')
#Decluttering
data_no_clutter = wrl.ipol.interpolate_polar(data, clutter)
pl.figure(figsize=(10,10))
ax, pm = wrl.vis.plot_ppi(data_no_clutter) # simple diagnostic plot
cbar = pl.colorbar(pm, shrink=0.75)
'''
elev = "elev%d" % i
dataset = "dataset%d" % i
shapefile_name = "%s_centroidi%d" % (hdf5_file_base , i)
#print(elev)
# Single elevation geotiff file name
geotiff_elev_name = "%s_%s.tif" % (hdf5_file_base , elev)
#print(geotiff_elev_name)
geotiff_list.append("%s%s" % (wdir,geotiff_elev_name))
#Get the elevation angle
elangle = fcontent['dataset%d/where' % i]['elangle']
#print(elangle)
'''
coords, proj_radar = georef.spherical_to_xyz(
coord[..., 0],
np.degrees(coord[..., 1]),
coord[..., 2],
sitecoords
)
'''
#Manipulating coordinates
# Get the x,y,z coordinatres of each point of the scan. coords dimension is numelev x numazimuth x numnbeams x 3
coords, proj_radar = wrl.georef.spherical_to_xyz(polargrid[0], polargrid[1],
elangle, sitecoords)
#Get the final grid coordinates
#lonlatalt coordinates are in lat lon height lonlatalt dimension is numazimuth x numnbeams x 3
lonlatalt = georef.spherical_to_proj(polargrid[0], polargrid[1],
elangle, sitecoords)
#lonlatalt1 dimension is is numelev x numazimuth x numnbeams x 3
lonlatalt1 = georef.reproject(
coords,
projection_source=proj_radar,
projection_target=georef.get_default_projection()
)
#Coordinates management
x = lonlatalt1[..., 0]
y = lonlatalt1[..., 1]
#cent_lon will be used in exporting the geotiff
cent_lon = lonlatalt[..., 0:2]
#Setup the grids
xgrid = np.linspace(x.min(), x.max(), 2400)
ygrid = np.linspace(y.min(), y.max(), 2400)
grid_xy = np.meshgrid(xgrid, ygrid)
grid_xy = np.vstack((grid_xy[0].ravel(), grid_xy[1].ravel())).transpose()
x_min = x.min()
y_max = y.max()
x_max = x.max()
y_min = y.min()
x_ravel = x.ravel()
x_ravel_none = x.ravel()[:,None]
y_ravel = y.ravel()
y_ravel_none = y.ravel()[:,None]
xy=np.concatenate([x.ravel()[:,None],y.ravel()[:,None]], axis=1)
print(xy.shape)
print(x_ravel_none.shape)
print(y_ravel_none.shape)
print(wrl.__version__)
# Now we transfer the polar data to the grid
gridded = wrl.comp.togrid(xy, grid_xy, 108000., np.array([x.mean(), y.mean()]), data.ravel(), wrl.ipol.Nearest)
#gridded = np.ma.masked_where(gridded == 0, gridded).reshape((len(xgrid), len(ygrid)))
gridded = np.ma.masked_invalid(gridded).reshape((len(xgrid), len(ygrid)))
#Printing the geolocated data
fig = pl.figure(figsize=(10,8))
ax = pl.subplot(111, aspect="equal")
pm = pl.pcolormesh(xgrid, ygrid, gridded)
pl.colorbar(pm, shrink=0.75)
pl.xlabel("Easting (m)")
pl.ylabel("Northing (m)")
pl.xlim(min(xgrid), max(xgrid))
pl.ylim(min(ygrid), max(ygrid))
pl.show()