In order to read this data I have installed the wradlib python library
into a Ubuntu workstation.
The good thing with it is that I am now learning a programing language
which is completely new to me.
The bad thing with it is that I am struggling a lot !
My intent is to read the DX data, to convert it into a regular grid
where each grid cell is 0.005 degrees x 0.005 degrees and to exportthis data into a netcdf file which is easier to manipulate for me.
From various websites I looked at, it seems that doing this data
manipulation is feasible via the wradlib library.
import wradlib
import numpy as np
import pylab as pl
data, meta = wradlib.io.readDX("raa00-dx_10908-0806021655-fbg---bin")
# set scan geometry and radar coordinates
r = np.arange(500.,128500.,1000.)
az = np.arange(0,360)
sitecoords = (8.005, 47.8744)
# create osr projection using epsg number for GK Zone 3
proj_gk3 = wradlib.georef.epsg_to_osr(31467)
# lat/lon coordiantes of bin centroids
cent_lon, cent_lat = wradlib.georef.polar2centroids(r, az, sitecoords)
x, y = wradlib.georef.reproject(cent_lon, cent_lat, projection_target=proj_gk3)
coords = np.array([x.ravel(),y.ravel()]).transpose()
# define target grid for composition
xmin, xmax, ymin, ymax = x.min(), x.max(), y.min(), y.max()
trgx = np.linspace(x.min(),x.max()+1000.,1000.)
trgy = np.linspace(y.min(),y.max()+1000.,1000.)
trgcoords = wradlib.util.gridaspoints(trgy,trgx)
# interpolate polar radar-data and quality data to the grid
gridded = wradlib.comp.togrid(coords, trgcoords, r.max()+500., coords.mean(axis=0), data.ravel(), wradlib.ipol.Nearest)
# Example map
fig = pl.figure(figsize=(10,8))
ax = pl.subplot(111, aspect="equal")
pm = pl.pcolormesh(trgx, trgy, np.ma.masked_invalid( gridded.reshape((len(trgx),len(trgy))) ), cmap="spectral")
grd = pl.grid()
cb = pl.colorbar(pm, shrink=0.5)
cb.set_label("dBZ")
import wradlib
import numpy as np
import pylab as pl
data, meta = wradlib.io.readDX("raa00-dx_10908-0806021655-fbg---bin")
# set scan geometry and radar coordinates
r = np.arange(500.,128500.,1000.)
az = np.arange(0,360)
sitecoords = (8.005, 47.8744)
# create osr projection using epsg number for GK Zone 3
proj_gk3 = wradlib.georef.epsg_to_osr(31467)
# lat/lon coordiantes of bin centroids
cent_lon, cent_lat = wradlib.georef.polar2centroids(r, az, sitecoords)
x, y = wradlib.georef.reproject(cent_lon, cent_lat, projection_target=proj_gk3)
coords = np.array([x.ravel(),y.ravel()]).transpose()
# define target grid for composition
xmin, xmax, ymin, ymax = x.min(), x.max(), y.min(), y.max()
trgx = np.linspace(x.min(),x.max()+1000.,1000.)
trgy = np.linspace(y.min(),y.max()+1000.,1000.)
trgcoords = wradlib.util.gridaspoints(trgy,trgx)
# interpolate polar radar-data and quality data to the grid
gridded = wradlib.comp.togrid(coords, trgcoords, r.max()+500., coords.mean(axis=0), data.ravel(), wradlib.ipol.Nearest)
# Example map
fig = pl.figure(figsize=(10,8))
ax = pl.subplot(111, aspect="equal")
pm = pl.pcolormesh(trgx, trgy, np.ma.masked_invalid( gridded.reshape((len(trgx),len(trgy))) ), cmap="spectral")
grd = pl.grid()
cb = pl.colorbar(pm, shrink=0.5)
cb.set_label("dBZ")
trglon, trglat = wradlib.georef.reproject(trgx, trgy,
projection_source=proj_gk3,
projection_target=wradlib.georef.get_default_projection() )
# Example map
fig = pl.figure(figsize=(12,8))
ax = pl.subplot(121, aspect="equal")
pm = pl.pcolormesh(trgx, trgy, np.ma.masked_invalid( gridded.reshape((len(trgx),len(trgy))) ), cmap="spectral")
grd = pl.grid()
cb = pl.colorbar(pm, shrink=0.5)
cb.set_label("dBZ")
pl.title("Gauss Krueger Zone 3")
ax = pl.subplot(122, aspect="equal")
pm = pl.pcolormesh(trglon, trglat, np.ma.masked_invalid( gridded.reshape((len(trglon),len(trglat))) ), cmap="spectral")
grd = pl.grid()
cb = pl.colorbar(pm, shrink=0.5)
cb.set_label("dBZ")
pl.title("Reprojected to lat/lon")
import wradlib
import numpy as np
import pylab as pl
data, meta = wradlib.io.readDX("raa00-dx_10908-0806021655-fbg---bin")
# set scan geometry and radar coordinates
r = np.arange(500.,128500.,1000.)
az = np.arange(0,360)
sitecoords = (8.005, 47.8744)
# lat/lon coordiantes of bin centroids
lon, lat = wradlib.georef.polar2centroids(r, az, sitecoords)
coords = np.array([lon.ravel(),lat.ravel()]).transpose()
# define target grid (fine tune to your needs)
trglon = np.arange(lon.min(),lon.max(),0.005)
trglat = np.arange(lat.min(),lat.max(),0.005)
trgcoords = wradlib.util.gridaspoints(trglat,trglon)
# Gridding (even beyond the maximum radar range)
gridded = wradlib.ipol.interpolate(coords, trgcoords, data.ravel(), wradlib.ipol.Nearest)
# Create mask in order to "remove" values outside the radar circle
# We do this in a Cartesian reference system, e.g. GK Zone 3
proj_gk3 = wradlib.georef.epsg_to_osr(31467)
sitecoords_repr = wradlib.georef.reproject(sitecoords, projection_target=proj_gk3)
trgcoords_repr = wradlib.georef.reproject(trgcoords, projection_target=proj_gk3)
mask = np.where( ((trgcoords_repr-sitecoords_repr)**2).sum(axis=-1) > r.max()**2 )[0]
# Mask out values outside the circle
gridded[mask] = np.nan
# Example map
fig = pl.figure(figsize=(10,8))
ax = pl.subplot(111, aspect="equal")
pm = pl.pcolormesh(trglon, trglat,
np.ma.masked_invalid( gridded.reshape((len(trglat),len(trglon))) ),
cmap="spectral")
grd = pl.grid()
cb = pl.colorbar(pm, shrink=0.5)
cb.set_label("dBZ")
Thank you very much Maik!