Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

mergeplg quick tour

This is a very brief overview of features available in the mergeplg package for merging rainfall data from multiple sensors (CMLs, PWSs, SMLs) with gridded data such as radar. A more comprehensive overview can be found in the mergeplg documentation.

'0.2.0'

Load example data

We use a subset of the OpenMRG dataset (Andersson et al., 2022) which contains radar, CML and rain gauge data in Gothenburg, Sweden. poligrain provides a convenient loader for this dataset.

File already exists at example_data/openmrg_cml_8d.nc
Not downloading!
File already exists at example_data/openmrg_rad_8d.nc
Not downloading!
File already exists at example_data/openmrg_municp_gauge_8d.nc
Not downloading!
File already exists at example_data/openmrg_smhi_gauge_8d.nc
Not downloading!

Adjust radar with CMLs

mergeplg provides different methods for merging radar with gauge and CML data. All methods provide a similar interface. Below we show and example using MergeDifferenceIDW which does additive radar adjustment using inverse distance weighting (IDW) for the interpolattion of the bias field calculated from the difference between gauges and/or CMLs and radar measurements.

First we resample the CML rain rates from 10 seconds to 5 minutes, which is the time interval of the radar data. Note that the CML data has already been with a simple standard proccedure, see this notebook in the OpenSense example data repository.

We also resample the 1-minute gauge rainfall amounts to 5-minute rain rates.

This is a quick look at the 5-minute radar, gauge and CML rainfall rates for a specific time step.

<Figure size 640x480 with 2 Axes>

To do the radar adjustment we initialize the MergeDifferenceIDW object which precalculates the CML-grid-intersection weights and the nearest neighbor lookup used for interpolation. This merger object can the be called for each time step to calculate and return the adjusted radar field.

Here is an example of unadjusted vs. adjusted radar rainfall rates.

<Figure size 1200x400 with 6 Axes>

Compare adjusted fields to rain gauges

To do a quantitative comparison between the adjusted radar fields and the rain gauges, we extract the values of the radar grid at the gauge locations and then compare them to the actual gauge measurements.

We do this using poligrain’s GridAtPoints class. The same functionality is available for CMLs using the GridAtLines class. Both these classes are also used internally by the MergeDifferenceIDW class, and the other merging methods in mergeplg, to perform the radar adjustment.

Now plot unadjusted and adjusted radar rainfall fields for a specific time step together with the difference at the gauges.

<Figure size 1200x800 with 8 Axes>

Let’s also plot the time series at two of the gauges for the period around the specific time step shown above.

<Figure size 1200x200 with 1 Axes>
<Figure size 1200x200 with 1 Axes>

Finally, plot all data for unadjusted and adjusted radar rainfall fields against the gauge data as hexbin plot.

<Figure size 1000x500 with 2 Axes>