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.

Combined usage of packages

Load open OpenMRG example data and project coordinates

We load 8 days of the OpenMRG dataset and do some quick visualization of the data using poligrain.

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!
<Axes: xlabel='lon', ylabel='lat'>
<Figure size 640x480 with 2 Axes>

CML processing

Here we do a standard CML processing with, what we believe, are reasonable methods and parameters. Note that, we use the radar as wet-dry indicator and we use poligrain to extract the path-averaged radar data for each CML which is needed for that.

<Axes: >
<Figure size 1800x500 with 6 Axes>
<Figure size 500x800 with 4 Axes>

Apply the indicator correlation filter to detect outliers

Note that the indicator correlation filter was developed for quality control of PWS data, but we will use it here for the processed CML rainfall data to examplify the usage of tools.

  0%|          | 0/10 [00:00<?, ?it/s]
 70%|███████   | 7/10 [00:00<00:00, 62.27it/s]
100%|██████████| 10/10 [00:00<00:00, 59.73it/s]

<Figure size 640x480 with 1 Axes>
  0%|          | 0/10 [00:00<?, ?it/s]
 10%|█         | 1/10 [00:00<00:06,  1.49it/s]
 20%|██        | 2/10 [00:01<00:05,  1.44it/s]
 30%|███       | 3/10 [00:02<00:04,  1.47it/s]
 40%|████      | 4/10 [00:02<00:03,  1.63it/s]
 50%|█████     | 5/10 [00:03<00:02,  1.70it/s]
 60%|██████    | 6/10 [00:03<00:02,  1.84it/s]
 70%|███████   | 7/10 [00:03<00:01,  2.00it/s]
 80%|████████  | 8/10 [00:04<00:01,  1.85it/s]
 90%|█████████ | 9/10 [00:05<00:00,  1.71it/s]
100%|██████████| 10/10 [00:05<00:00,  1.68it/s]
100%|██████████| 10/10 [00:05<00:00,  1.70it/s]

<Figure size 640x480 with 1 Axes>
Loading...
256 of 364 CMLs were accepted
Loading...
<Figure size 600x1000 with 3 Axes>
<Figure size 640x480 with 2 Axes>
<Figure size 640x480 with 2 Axes>
<Figure size 640x480 with 2 Axes>
<Figure size 640x480 with 2 Axes>
<Figure size 640x480 with 2 Axes>
<Figure size 640x480 with 2 Axes>
<Figure size 640x480 with 2 Axes>
<Figure size 640x480 with 2 Axes>
<Figure size 640x480 with 2 Axes>
<Figure size 640x480 with 2 Axes>
<Figure size 640x480 with 2 Axes>
<Figure size 640x480 with 2 Axes>

Adjust radar with CMLs using mergeplg

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[20], line 36
     32 R_rad_at_gauge = grid_at_points(
     33     da_gridded_data=R_radar.sel(time=t),
     34     da_point_data=R_gauges.sel(time=t),
     35 )
---> 36 R_adjusted_rad_at_gauge = grid_at_points(
     37     da_gridded_data=R_grid_idw,
     38     da_point_data=R_gauges.sel(time=t),
     39 )

File ~/work/OpenSenseAction.github.io/OpenSenseAction.github.io/.venv/lib/python3.11/site-packages/poligrain/spatial.py:452, in GridAtPoints.__call__(self, da_gridded_data, da_point_data)
    449 da_point_data_t = da_point_data.sel(time=t)
    451 # copy-paste code from wradlib.adjust.RawAtObs.__call__
--> 452 raw = da_gridded_data_t.to_numpy().flatten()
    453 obs = da_point_data_t.to_numpy()
    454 # get the values of the raw neighbours of obs

File ~/work/OpenSenseAction.github.io/OpenSenseAction.github.io/.venv/lib/python3.11/site-packages/xarray/core/common.py:286, in AttrAccessMixin.__getattr__(self, name)
    284         with suppress(KeyError):
    285             return source[name]
--> 286 raise AttributeError(
    287     f"{type(self).__name__!r} object has no attribute {name!r}"
    288 )

AttributeError: 'Dataset' object has no attribute 'to_numpy'