Convert coordinate data for interpolate_polar command

62 views
Skip to first unread message

Pradipta Nandi Wardhana

unread,
Jul 31, 2018, 9:31:39 AM7/31/18
to wradlib-users

Good evening,

Working with wradlib is my first experience using python. I learn to understand python by doing several task in processing rain radar data (netcdf format) by using wradlib. I have some issues to use interpolate_radar command. The command require coordinate in (azimuth, range) format while the radar data has (ranges, azimuth) format. I have some question regarding how to convert the coordinate data. Please kindly find attached Wradlib script that I use. The netcdf file that I use to learn wradlib also obtained in this forum.

Thanks for your assistance.

Didid
Wradlib Python.ipynb

Pradipta Nandi Wardhana

unread,
Aug 2, 2018, 12:37:07 PM8/2/18
to wradlib-users
Good Evening, 

My current issue is regarding interpolate processing by using interpolate command. When I interpolated the netcdf data, I obtained big negative value that was different with the source data. Moreover, I tried to inspect data by using different command. The first one I using print(list) and later by using print(np.array(list)) command. The print(np.array(list)) show that my source data contains that big negative value (approx. -32678), while when I tried to search the min value by using np.amin(list) command the lowest value just -31.5. I use radar data provided by Yogesh Kolte in this google groups. I also attached the python script.

Thanks for your assistance.

Regards,

didid
Python script.ipynb

Kai Muehlbauer

unread,
Aug 3, 2018, 2:20:00 AM8/3/18
to wradli...@googlegroups.com
Dear Didid,

sorry for the delay. The problem is that your netcdf source variable
will be extracted as a numpy masked array. I had a quick look into the
dataset and the FillValue is -32768.

During normal operation (plotting etc) the masked values will not be
taken into account. But for the `interpolate_polar`-function the `mask'
can be taken into account and the FillValues might be used for computation.

To avoid this I suggest to fill the masked values with some reasonable
value (either NaN or the minimal value -31.5 in this case) before
computation.

1. Get the mask of the source array:

omask = dbzh.mask

2. For interpolation fill the masked values with NaN

data_no_clutter = wrl.ipol.interpolate_polar(dbzh[i1:i2].filled(np.nan),
mask=clutter, ipclass=wrl.ipol.Idw)

3. Use the mask from the source array on the result

data_no_clutter = np.ma.array(data_no_clutter, mask=omask[i1:i2])

Especially for netcdf files it is good to have a look at the FillValues
if they make sense.

HTH!

Cheers,
Kai
> --
> You received this message because you are subscribed to the Google
> Groups "wradlib-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to wradlib-user...@googlegroups.com
> <mailto:wradlib-user...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

--
Kai Muehlbauer
Meteorological Institute University of Bonn
Auf dem Huegel 20 | +49 228 739083
D-53121 Bonn | kai.mue...@uni-bonn.de
Reply all
Reply to author
Forward
0 new messages