{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "tobac example: Tracking deep convection based on OLR from geostationary satellite retrievals\n", "==\n", "\n", "This example notebook demonstrates the use of tobac to track isolated deep convective clouds based on outgoing longwave radiation (OLR) calculated based on a combination of two different channels of the GOES-13 imaging instrument.\n", "\n", "The data used in this example is downloaded from \"zenodo link\" automatically as part of the notebooks (This only has to be done once for all the tobac example notebooks)." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "execution": { "iopub.execute_input": "2026-02-02T20:12:47.953528Z", "iopub.status.busy": "2026-02-02T20:12:47.953202Z", "iopub.status.idle": "2026-02-02T20:12:48.652963Z", "shell.execute_reply": "2026-02-02T20:12:48.652518Z" } }, "outputs": [], "source": [ "# Import a range of python libraries used in this notebook:\n", "import datetime\n", "import shutil\n", "from pathlib import Path\n", "from six.moves import urllib\n", "\n", "import numpy as np\n", "import pandas as pd\n", "import xarray as xr\n", "\n", "import matplotlib.pyplot as plt\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2026-02-02T20:12:48.654726Z", "iopub.status.busy": "2026-02-02T20:12:48.654554Z", "iopub.status.idle": "2026-02-02T20:12:49.860518Z", "shell.execute_reply": "2026-02-02T20:12:49.860027Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "using tobac version 1.6.2\n" ] } ], "source": [ "# Import tobac itself:\n", "import tobac\n", "print('using tobac version', str(tobac.__version__))" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2026-02-02T20:12:49.878643Z", "iopub.status.busy": "2026-02-02T20:12:49.878422Z", "iopub.status.idle": "2026-02-02T20:12:49.880532Z", "shell.execute_reply": "2026-02-02T20:12:49.880108Z" } }, "outputs": [], "source": [ "# Disable a few warnings:\n", "import warnings\n", "warnings.filterwarnings('ignore', category=UserWarning, append=True)\n", "warnings.filterwarnings('ignore', category=RuntimeWarning, append=True)\n", "warnings.filterwarnings('ignore', category=FutureWarning, append=True)\n", "warnings.filterwarnings('ignore',category=pd.io.pytables.PerformanceWarning)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Download example data:** \n", "This has to be done only once for all tobac examples." ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2026-02-02T20:12:49.881865Z", "iopub.status.busy": "2026-02-02T20:12:49.881770Z", "iopub.status.idle": "2026-02-02T20:12:49.883247Z", "shell.execute_reply": "2026-02-02T20:12:49.882894Z" } }, "outputs": [], "source": [ "data_out=Path('../')" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "execution": { "iopub.execute_input": "2026-02-02T20:12:49.884447Z", "iopub.status.busy": "2026-02-02T20:12:49.884356Z", "iopub.status.idle": "2026-02-02T20:12:49.889156Z", "shell.execute_reply": "2026-02-02T20:12:49.888705Z" } }, "outputs": [], "source": [ "# Download the data: This only has to be done once for all tobac examples and can take a while\n", "data_file = list(data_out.rglob('data/Example_input_OLR_satellite.nc'))\n", "if len(data_file) == 0:\n", " file_path='https://zenodo.org/records/3195910/files/climate-processes/tobac_example_data-v1.0.1.zip'\n", " #file_path='http://zenodo..'\n", " tempfile=Path('temp.zip')\n", " print('start downloading data')\n", " request=urllib.request.urlretrieve(file_path, tempfile)\n", " print('start extracting data')\n", " shutil.unpack_archive(tempfile, data_out)\n", " tempfile.unlink()\n", " print('data extracted')\n", " data_file = list(data_out.rglob('data/Example_input_OLR_satellite.nc'))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Load data:**" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "execution": { "iopub.execute_input": "2026-02-02T20:12:49.890330Z", "iopub.status.busy": "2026-02-02T20:12:49.890254Z", "iopub.status.idle": "2026-02-02T20:12:50.613577Z", "shell.execute_reply": "2026-02-02T20:12:50.613066Z" } }, "outputs": [], "source": [ "#Load Data from downloaded file:\n", "OLR = xr.open_dataset(data_file[0]).olr" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "execution": { "iopub.execute_input": "2026-02-02T20:12:50.615098Z", "iopub.status.busy": "2026-02-02T20:12:50.614947Z", "iopub.status.idle": "2026-02-02T20:12:50.621809Z", "shell.execute_reply": "2026-02-02T20:12:50.621425Z" } }, "outputs": [ { "data": { "text/html": [ "
<xarray.DataArray 'olr' (time: 54, lat: 131, lon: 184)> Size: 10MB\n",
"[1301616 values with dtype=float64]\n",
"Coordinates:\n",
" * time (time) datetime64[ns] 432B 2013-06-19T19:02:22 ... 2013-06-20T02...\n",
" * lat (lat) float64 1kB 28.03 28.07 28.11 28.15 ... 32.92 32.96 32.99\n",
" * lon (lon) float64 1kB -94.99 -94.95 -94.91 ... -88.08 -88.04 -88.01\n",
"Attributes:\n",
" long_name: OLR\n",
" units: W m^-2| \n", " | frame | \n", "idx | \n", "hdim_1 | \n", "hdim_2 | \n", "num | \n", "threshold_value | \n", "feature | \n", "time | \n", "timestr | \n", "lat | \n", "lon | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "0 | \n", "1 | \n", "2.574109 | \n", "154.214477 | \n", "9 | \n", "250 | \n", "1 | \n", "2013-06-19 19:02:22 | \n", "2013-06-19 19:02:22 | \n", "28.131008 | \n", "-89.103851 | \n", "
| 1 | \n", "0 | \n", "3 | \n", "3.354292 | \n", "162.980569 | \n", "9 | \n", "250 | \n", "2 | \n", "2013-06-19 19:02:22 | \n", "2013-06-19 19:02:22 | \n", "28.160780 | \n", "-88.769332 | \n", "
| 2 | \n", "0 | \n", "8 | \n", "37.479003 | \n", "146.971379 | \n", "6 | \n", "250 | \n", "3 | \n", "2013-06-19 19:02:22 | \n", "2013-06-19 19:02:22 | \n", "29.462995 | \n", "-89.380251 | \n", "
| 3 | \n", "0 | \n", "22 | \n", "106.638010 | \n", "145.251412 | \n", "14 | \n", "250 | \n", "4 | \n", "2013-06-19 19:02:22 | \n", "2013-06-19 19:02:22 | \n", "32.102135 | \n", "-89.445885 | \n", "
| 4 | \n", "0 | \n", "24 | \n", "108.354401 | \n", "152.894109 | \n", "7 | \n", "250 | \n", "5 | \n", "2013-06-19 19:02:22 | \n", "2013-06-19 19:02:22 | \n", "32.167634 | \n", "-89.154237 | \n", "