{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Explore example datasets" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We provide the option to download subsets of existing open datasets with opportunistic sensor data. In this notebook we present these datasets and their subsets." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2026-04-05T14:00:37.682737Z", "start_time": "2026-04-05T14:00:36.873640Z" } }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "\n", "import poligrain as plg" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## OpenMRG" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The data is downloaded from https://github.com/OpenSenseAction/opensense_example_data/tree/main/OpenMRG\n", "\n", "This is based on the OpenMRG dataset described in Andersson et al. (2022) https://doi.org/10.5194/essd-14-5411-2022\n", "\n", "Currently there are two different subsets:\n", "- `'5min_2h'`: 2.5 hours of data, all sensors aggregated to 5 minutes temporal resolution\n", "- `'8d'`: 8 days of data from the OpenMRG project (default subset). The CML data is processed using radar data as wet-dry indicator with `pycomlink`.\n", "\n", "For details of how the data was generated see the notebook in the example data repo linked above.\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2026-04-05T13:44:35.042594Z", "start_time": "2026-04-05T13:44:35.014880Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "File already exists at example_data/openmrg_cml_8d.nc\n", "Not downloading!\n", "File already exists at example_data/openmrg_rad_8d.nc\n", "Not downloading!\n", "File already exists at example_data/openmrg_municp_gauge_8d.nc\n", "Not downloading!\n", "File already exists at example_data/openmrg_smhi_gauge_8d.nc\n", "Not downloading!\n" ] } ], "source": [ "(\n", " ds_rad,\n", " ds_cmls,\n", " ds_gauges_municp,\n", " ds_gauge_smhi,\n", ") = plg.example_data.load_openmrg(data_dir=\"example_data\", subset=\"8d\")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2026-04-05T13:44:35.062558Z", "start_time": "2026-04-05T13:44:35.051493Z" } }, "outputs": [ { "data": { "text/html": [ "
<xarray.Dataset> Size: 1GB\n",
"Dimensions: (sublink_id: 2, cml_id: 364, time: 69120)\n",
"Coordinates:\n",
" * sublink_id (sublink_id) <U9 72B 'sublink_1' 'sublink_2'\n",
" * cml_id (cml_id) int64 3kB 10001 10002 10003 ... 10362 10363 10364\n",
" * time (time) datetime64[ns] 553kB 2015-07-22 ... 2015-07-29T23:59:50\n",
" site_0_lat (cml_id) float64 3kB ...\n",
" site_0_lon (cml_id) float64 3kB ...\n",
" site_1_lat (cml_id) float64 3kB ...\n",
" site_1_lon (cml_id) float64 3kB ...\n",
" frequency (sublink_id, cml_id) float64 6kB ...\n",
" polarization (sublink_id, cml_id) <U1 3kB ...\n",
" length (cml_id) float64 3kB ...\n",
"Data variables:\n",
" tsl (time, sublink_id, cml_id) float64 403MB ...\n",
" rsl (time, sublink_id, cml_id) float64 403MB ...\n",
" R (sublink_id, cml_id, time) float64 403MB ...\n",
"Attributes: (12/14)\n",
" title: OpenMRG-CML\n",
" version: 1.1\n",
" source: Swedish Meteorological and Hydrological Institute ...\n",
" contact: hydro.fou@smhi.se, jafet.andersson@smhi.se\n",
" license: https://creativecommons.org/licenses/by-sa/4.0\n",
" doi: https://doi.org/10.5281/zenodo.6673750\n",
" ... ...\n",
" institution: NA\n",
" date: NA\n",
" history: NA\n",
" naming convention: NA\n",
" license restrictions: NA\n",
" reference: NA<xarray.Dataset> Size: 55MB\n",
"Dimensions: (time: 11412, sublink_id: 2, cml_id: 151)\n",
"Coordinates:\n",
" * time (time) datetime64[ns] 91kB 2022-08-14 ... 2022-08-21T23:59:00\n",
" * sublink_id (sublink_id) <U8 64B 'channel1' 'channel2'\n",
" * cml_id (cml_id) <U4 2kB '412' '154' '1149' '55' ... '60' '434' '62'\n",
" length (cml_id) float64 1kB ...\n",
" site_0_lat (cml_id) float64 1kB ...\n",
" site_0_lon (cml_id) float64 1kB ...\n",
" site_0_elev (cml_id) float64 1kB ...\n",
" site_1_lat (cml_id) float64 1kB ...\n",
" site_1_lon (cml_id) float64 1kB ...\n",
" site_1_elev (cml_id) float64 1kB ...\n",
" frequency (cml_id, sublink_id) float64 2kB ...\n",
" polarization (cml_id, sublink_id) object 2kB ...\n",
"Data variables:\n",
" rsl (cml_id, sublink_id, time) float64 28MB ...\n",
" tsl (cml_id, sublink_id, time) float64 28MB ...\n",
"Attributes:\n",
" title: OpenRainER-CML: Lepida ScpA CML received and transmit...\n",
" file_authors: Elia Covi (ARPAE-SIMC Bologna (IT)); Giacomo Roversi ...\n",
" institution: Hydro-Meteorological and Climate Service of Emilia-Ro...\n",
" date: 2025-01-01\n",
" source: Lepida ScpA, Bologna (IT) https://www.lepida.net/ - C...\n",
" naming_convention: OpenSense-CML\n",
" license: https://creativecommons.org/licenses/by/4.0/\n",
" contact: elia.c.covi@gmail.com\n",
" reference: https://zenodo.org/doi/10.5281/zenodo.10593848\n",
" version: 1.1