How to filter rays coming mentioned inside black boundry, I not sure but I think these problem beacause of antenna transition. I have given google drive link netcdf file inside that,this radar have reflectivity, velocity, spectral width
Since the data is already filtered, at this moment, the easiest is to mask the reflectivity using the mask of spectrum width.
def apply_mask(radar):
radar.fields['reflectivity']['data'] = np.ma.masked_where(
radar.fields['spectrum_width']['data'].mask, radar.fields["reflectivity"]['data'])
return radar
files = glob.glob("BHP*nc")
files.sort()
for file in files:
radar = pyart.io.read(file)
radar = apply_mask(radar)
# pyart.io.write(os.path.join(out_dir ,file))
You can also try wradlib data quality — Project Pythia Cookbook Template, and tweak the thresholds.
import xarray as xr
def extract_clutter(da, wsize=3, thrsnorain=0, tr1=6.0, n_p=6, tr2=1.3, rm_nans=False):
return xr.apply_ufunc(
wrl.clutter.filter_gabella,
da,
input_core_dims=[["azimuth", "range"]],
output_core_dims=[["azimuth", "range"]],
dask="parallelized",
kwargs=dict(
wsize=wsize,
thrsnorain=thrsnorain,
tr1=tr1,
n_p=n_p,
tr2=tr2,
rm_nans=rm_nans,
),
)
vol = wrl.io.open_cfradial1_dataset("BHP210601104223.nc")
swp0 = vol[0].pipe(wrl.georef.georeference_dataset)
clmap = swp0.reflectivity.pipe(
extract_clutter, wsize=3, thrsnorain=0.0, tr1=14, n_p=2, tr2=1.5, rm_nans=False
)
swpx = swp0.assign({"CMAP": clmap})
fig = plt.figure(figsize=(15, 12))
ax1 = fig.add_subplot(221)
swpx.reflectivity.plot(x="x", y="y", ax=ax1, vmin=0, vmax=60)
ax1.set_title("Reflectivity raw")
ax2 = fig.add_subplot(222)
swpx.CMAP.plot(x="x", y="y", ax=ax2)
ax2.set_title("Cluttermap")
ax3 = fig.add_subplot(223)
swpx.reflectivity.where(swpx.CMAP == 1).plot(
x="x", y="y", ax=ax3, vmin=0, vmax=60
)
ax3.set_title("Clutter")
ax4 = fig.add_subplot(224)
swpx.reflectivity.where(swpx.CMAP < 1).plot(
x="x", y="y", ax=ax4, vmin=0, vmax=60
)
ax4.set_title("Reflectivity clutter removed")
@kmuehlbauer can help you to apply it on full volume and export the data to the desired format.
Thanks @syedhamidali, great writeup an nice link to the ERAD2022 workshop. I’ll try to get to this the next days.
deeply thanks @syedhamidali
@sanjayyadav3184 First, welcome to openradar community and discourse.
Thanks to the fine work of @syedhamidali I was able to quickly transform this to using next generation Python packages.
Please have a look at this gist: Jupyter Notebook Viewer
thank you sho much Sir
You are welcome, @sanjayyadav3184. Glad, we were able to help.