{ "cells": [ { "cell_type": "markdown", "id": "682d6aec", "metadata": { "id": "682d6aec" }, "source": [ "# Exploring TC PRIMED, Chapter 1b: The Overpass File\n", "- Creators: Naufal Razin1, Chris Slocum2, and Kathy Haynes1\n", "- Affiliation:\n", " - 1Cooperative Institute for Research in the Atmosphere, Colorado State University, Fort Collins, CO\n", " - 2NOAA/NESDIS Center for Satellite Applications and Research, Fort Collins, CO\n", "- History:\n", " - August 15th, 2024: Modified for TC PRIMED v01r01\n", " - November 16th, 2026: Updated:\n", " - code to use `tcprimedapi` and new package download routine\n", " - link to TC PRIMED dataset documentation.\n", "---\n", "\n", "## Overview\n", "TC PRIMED consists of two types of files: the overpass file and the environmental file. The overpass file contains all available satellite products from *one* overpass of a tropical cyclone, while the environmental file contains all available tropical cyclone information, and environmental diagnostics and fields *at synoptic times* (00, 06, 12, 18 UTC) throughout the storm's life. In this notebook, you will learn how to load and plot data from the TC PRIMED overpass file.\n", "\n", "## Prerequisites\n", "To successfully navigate and use this notebook, you should be familiar with:\n", "- the basics of Python programming such as loading modules, assigning variables, and list/array indexing\n", "- NetCDF files and NetCDF groups (see Chapter 1a of this Learning Journey)\n", "- plotting data using matplotlib\n", "\n", "## Learning Outcomes\n", "By working through this notebook, you should be able to:\n", "- understand the data structure of a TC PRIMED overpass file\n", "- interact with (e.g., load and plot) data from a TC PRIMED overpass file\n", "\n", "## Time Estimate\n", "- Estimated text reading time: 8 to 16 min\n", "- Estimated code reading time: 3 to 6 min\n", "- Estimated total reading time: 11 to 22 min" ] }, { "cell_type": "markdown", "id": "0a074d3b-e0e5-4dca-a602-405c902c34d2", "metadata": {}, "source": [ "## Background\n", "Data in the TC PRIMED overpass files are stored in up to six different NetCDF groups. They are:\n", "- `overpass_metadata`, which contains information about the satellite.\n", "- `overpass_storm_metadata`, which contains information about the storm at the overpass time.\n", "- `passive_microwave`, which contains passive microwave observations of the storm.\n", "- `GPROF`, which contains retrieved precipitation variables. Except for a small minority of cases, these are available almost all the time.\n", "- `radar_radiometer`, which contains combined radar-radiometer products from the TRMM PR and GPM DPR (when available).\n", "- `infrared`, which contains infrared observations of the storm and derived metrics (when available).\n", "\n", "In this notebook, you will learn to load and plot the field variables, such as the passive microwave and infrared brightness temperatures. In order to successfully do so, you must first understand passive microwave observation data.\n", "\n", "As passive microwave sensors orbit the earth on their respective satellites, they rotate and record their observations at each pixel. Each rotation is called a scan, while the size of each pixel is called the instantaneous field-of-view (IFOV). Depending on the sensor architecture, passive microwave brightness temperature observations have different observing frequencies, are available on different grids or swaths, and have different IFOV. The figures below illustrate this concept of different swaths and IFOV using passive microwave observations from all sensors available in TC PRIMED, which are:\n", "\n", "- Conical-scanning sensors:\n", " - Advanced Microwave Scanning Radiometer 2 (AMSR2)\n", " - Advanced Microwave Scanning Radiometer - Earth Observing System (AMSRE)\n", " - Special Sensor Microwave Imager (SSMI)\n", " - Special Sensor Microwave Imager / Sounder (SSMIS)\n", " - Global Precipitation Measurement (GPM) Microwave Imager (GMI)\n", " - Tropical Rainfall Measuring Mission (TRMM) Microwave Imager (TMI)\n", " \n", "- Cross-track-scanning sensors:\n", " - Advanced Microwave Sounding Unit B (AMSUB)\n", " - Advanced Technology Microwave Sounder (ATMS)\n", " - Microwave Humidity Sounder (MHS)" ] }, { "cell_type": "markdown", "id": "f12de9ab-caf9-41d3-bce9-2c09dd568434", "metadata": {}, "source": [ "
\n", "\"An\n", "\n", "
Figure 1. The IFOV for the different observing frequencies of the conical-scanning sensors in TC PRIMED. Only two scans are shown, and every fourth pixel highlighted. Also shown is the swath and IFOV for the TRMM precipitation radar and GPM dual-frequency precipitation radar. There are two figures each for the TMI and GMI sensors, showing their respective IFOV before and after an orbital boost. The orbital boost increased the orbit height of the satellite to prolong its life, resulting in a slightly larger IFOV after the orbit boost. The arrow in each figure shows the ground motion vector of the satellite.
\n", " \n", "
" ] }, { "cell_type": "markdown", "id": "b8f70d65-a958-489d-8b38-07328e12d5c6", "metadata": {}, "source": [ "From Figure 1,\n", "- The SSMI does not have observations near the 10 GHz frequency, while the SSMIS and GMI have additional observing frequencies at around 160 and 183 GHz.\n", "- Observations at lower frequencies have a bigger IFOV (lower resolution) than observations at higher frequencies for the same sensor.\n", "- Different sensors have different IFOVs, with the SSMI having the biggest IFOV (lowest resolution) and the GMI generally having the smallest IFOV (highest resolution).\n", "- For the SSMI, observations in the 19.35 - 37.0 GHz range are located on the same swath, as indicated by their concentric IFOV. Whereas observations in the 85.5 GHz frequency are located on a different swath.\n", "- For the AMSR2, observations in all of the frequencies are located on different swaths. However, the swaths for the 10.65 - 36.5 GHz frequency range are closely collocated.\n", "- For the GMI, observations in the 10.65 - 89.0 GHz frequency range are all located on the same swath.\n", "\n", "The scanning geometry of conical-scanning sensors allow for the IFOV to remain constant. Whereas cross-track-scanning sensors have the highest resolution (smallest IFOV) at the satellite nadir view, which gets coarser (increasing IFOV) towards the edge of the observation swath (Figure 2). For in-depth information on passive microwave remote sensing, including the differences between observations from conical and cross-track scanners, you can sign up for a free [COMET MetEd account](https://www.meted.ucar.edu/index.php) and go through their [passive microwave remote sensing course](https://www.meted.ucar.edu/education_training/course/15). **However, you don't need to go through the course to be able to load and plot the TC PRIMED overpass file data in this notebook.**" ] }, { "cell_type": "markdown", "id": "e0f96491", "metadata": {}, "source": [ "
\n", "\"An\n", "\n", "
Figure 2. The IFOV for the different observing frequencies of the cross-track-scanning sensors in TC PRIMED. Only two scans are shown, and every fourth pixel highlighted. The left column shows the IFOV for the sensor at nadir, while the right column shows the IFOV for the sensor at the edge of the swath. The IFOV of the different observing frequencies are the same for the AMSUB and MHS. The arrow in each figure shows the ground motion vector of the satellite.
\n", " \n", "
" ] }, { "cell_type": "markdown", "id": "08eaa7c8-7af9-45d2-9617-a8f41f732356", "metadata": { "id": "8eb3a0e3" }, "source": [ "Now that you're familiar with the basic concepts around passive microwave observations, let's learn how to load and plot them from a TC PRIMED overpass file. We will be using an overpass file from Hurricane Florence (2018), as observed by the cross-track-scanning Advanced Technology Microwage Sounder (ATMS) sensor aboard the NOAA-20 satellite." ] }, { "cell_type": "markdown", "id": "f724b62a-0f0f-4680-b775-a18fc1577e87", "metadata": { "id": "8eb3a0e3" }, "source": [ "
\n", "\"An\n", "\n", "
Figure 3. An image of Hurricane Florence (2018) captured by European Space Agency astronaut Alexander Gerst from aboard the International Space Station. Source: ESA
\n", " \n", "
" ] }, { "cell_type": "markdown", "id": "00de9b89-f179-44b1-ba8b-4165b1e14e02", "metadata": { "id": "8eb3a0e3" }, "source": [ "Hurricane Florence was a long-lived hurricane that formed off the coast of Senegal and The Gambia, and tracked westward across the North Atlantic Ocean. During its track across the Atlantic, it briefly intensified to a Category 4 hurricane (on the [Saffir-Simpson Hurricane Wind Scale](https://www.nhc.noaa.gov/aboutsshws.php#:~:text=The%20Saffir%2DSimpson%20Hurricane%20Wind,Scale%20estimates%20potential%20property%20damage.)), weakened to a tropical storm, and re-intensified back to a Category 4 hurricane before making landfall along the southeastern coast of North Carolina as a high-end Category 1 hurricane. Florence brought [record-breaking rainfall](https://www.weather.gov/ilm/HurricaneFlorence) across eastern North Carolina and parts of northeastern South Carolina.\n", "\n", "The ATMS observation of Hurricane Florence that you will load and plot is from September 4th, 2018, when Florence was a Category 1 hurricane before it intensified to a Category 4 hurricane for the first time." ] }, { "cell_type": "markdown", "id": "9abb56ec", "metadata": { "id": "9abb56ec" }, "source": [ "## Software\n", "This tutorial uses the Python programming language and packages. We will use:\n", "- `tcprimedapi` to query and retrieve TC PRIMED files from the Amazon Web Service S3 bucket\n", "- `netCDF4` to load the TC PRIMED file\n", "- `matplotlib` to plot the data" ] }, { "cell_type": "markdown", "id": "26647f47-60c5-4a14-be3b-7bed1b7510b6", "metadata": {}, "source": [ "
\n", " This Learning Journey assumes that the user is running the notebook in a clean conda environment. If the user runs this notebook in an existing environment, it may install a different version of an existing package, and the user would need to restart the kernel after the required package version is installed.\n", "
\n", "
\n", " Users should also note that support for particular packages may not be available for the newest Python versions. If the install code below produces the following error message:\n", "
\n",
    "        ERROR: Could not find a version that satisfies the requirement [package] (from versions: none)\n",
    "        ERROR: No matching distribution found for [package]\n",
    "    
\n", " users will want downgrade their Python version to a version supported by [package].\n", "
" ] }, { "cell_type": "markdown", "id": "dce41a9b", "metadata": { "id": "dce41a9b" }, "source": [ "### Install Packages\n", "Let's first check if we have the necessary Python packages to run this notebook. If we don't, let's install them." ] }, { "cell_type": "code", "execution_count": null, "id": "3c6fdd7e-9ec6-403b-9423-c4b2abb4e5e1", "metadata": {}, "outputs": [], "source": [ "# sys provides access to system level information (i.e., the executable for the Python installation)\n", "import sys\n", "\n", "# subprocess makes system level calls\n", "import subprocess\n", "\n", "# json allows us to query text stored in json format\n", "import json\n", "\n", "# version allows us to check package version\n", "from importlib.metadata import version\n", "\n", "# Specify packages, their distribution name, and version needed for this notebook\n", "PACKAGES = {\"netCDF4\": {\"distribution_name\": None, \"version\": None},\n", " \"tcprimedapi\": {\"distribution_name\": None, \"version\": None},\n", " \"matplotlib\": {\"distribution_name\": None, \"version\": None}}\n", "\n", "restart_kernel_flag = 0\n", "\n", "# Loop through each package to import\n", "for package in PACKAGES:\n", "\n", " # Get distribution name to use for install\n", " dist_name = package if PACKAGES[package][\"distribution_name\"] is None else PACKAGES[package][\"distribution_name\"]\n", " \n", " try:\n", " \n", " # First, attempt to import the package\n", " __import__(package)\n", "\n", " # Then, obtain the installed package version, the required version, and the\n", " # latest version\n", " installed_version = version(dist_name)\n", " required_version = PACKAGES[package][\"version\"]\n", "\n", " output = subprocess.check_output([sys.executable, '-m', 'pip', 'index', 'versions', '--pre', dist_name, '--json'], text=True)\n", " latest_version = json.loads(output)['latest']\n", "\n", " # Specify the version we require based on required version or latest version\n", " required_version = latest_version if required_version is None else required_version\n", "\n", " # If the required version and doesn't match the installed version\n", " if installed_version != required_version:\n", "\n", " # Get distribution version to use for install\n", " dist_version = \"==\".join([dist_name, required_version])\n", "\n", " # Force reinstall the required distribution version using pip\n", " print('############################################################################')\n", " print(package)\n", " subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--no-cache-dir', '--force-reinstall', dist_version])\n", "\n", " restart_kernel_flag = 1\n", " \n", " except (ImportError, ModuleNotFoundError):\n", "\n", " # Obtain the required package version\n", " required_version = PACKAGES[package][\"version\"]\n", "\n", " # Obtain the latest version\n", " output = subprocess.check_output([sys.executable, '-m', 'pip', 'index', 'versions', '--pre', dist_name, '--json'], text=True)\n", " latest_version = json.loads(output)['latest']\n", "\n", " # Specify the version we require based on required version or latest version\n", " required_version = latest_version if required_version is None else required_version\n", "\n", " # Get distribution version to use for install\n", " dist_version = \"==\".join([dist_name, required_version])\n", "\n", " # Install the distribution version using pip\n", " print('############################################################################')\n", " print(package)\n", " subprocess.check_call([sys.executable, '-m', 'pip', 'install', '--no-cache-dir', dist_version])\n", "\n", "if restart_kernel_flag == 1:\n", " \n", " print('###############################################################')\n", " print('NEW PACKAGE VERSION INSTALLED. RESTART JUPYTER NOTEBOOK KERNEL!')\n", " print('###############################################################')" ] }, { "cell_type": "markdown", "id": "d6974147", "metadata": { "id": "d6974147" }, "source": [ "Now, let's load the modules in the packages (e.g., `Dataset`) or load the packages and assign a shorter object name for the packages (e.g., `import matplotlib.pyplot as plt`) for a cleaner use throughout the notebook." ] }, { "cell_type": "code", "execution_count": null, "id": "9825be5d", "metadata": { "id": "9825be5d" }, "outputs": [], "source": [ "# Load the Python packages we will use in this notebook\n", "import tcprimedapi\n", "from netCDF4 import Dataset\n", "import matplotlib.pyplot as plt\n", "plt.rcParams['pcolor.shading'] = 'auto'" ] }, { "cell_type": "markdown", "id": "07d73cad", "metadata": { "id": "07d73cad" }, "source": [ "## Read File Online\n", "Finally, let's retrieve information from the TC PRIMED file that we will use in this example. As we have mentioned above, the TC PRIMED file will be from an ATMS overpass of Hurricane Florence (2018). We will retrieve the TC PRIMED file from the [Amazon Web Service (AWS) S3 bucket](https://noaa-nesdis-tcprimed-pds.s3.amazonaws.com/index.html) as part of the [NOAA Open Data Dissemination program (NODD)](https://www.noaa.gov/information-technology/open-data-dissemination).\n", "\n", "The TC PRIMED team provides a Python package to query and retrieve TC PRIMED files from the AWS S3 bucket called [`tcprimedapi`](https://pypi.org/project/tcprimedapi/). To retrieve TC PRIMED files using `tcprimedapi`, we simply provide the API with the criteria for the file(s) of interest. The criteria that are relevant to this notebook are the:\n", "- `atcf_id`: the Automated Tropical Cyclone Forecast System (ATCF) 8 character storm identifier. The ATCF ID for Hurricane Florence (2018) is `AL062018`.\n", "- `file_type`: which can be the sensor or platform abbreviation or the TC PRIMED environmental file. Since we are interested in looking at an ATMS overpass, this will be `ATMS`.\n", "\n", "Let's query the TC PRIMED AWS S3 bucket using `tcprimedapi` and the criteria above." ] }, { "cell_type": "code", "execution_count": null, "id": "f584a337-5d26-4e26-b3fa-478b9d6f6051", "metadata": {}, "outputs": [], "source": [ "# Create an instance of a Client\n", "tcpc = tcprimedapi.Client()\n", "\n", "# List desired ATCF ID\n", "atcf_id = [\"AL062018\"]\n", "\n", "# List desired file type\n", "file_type = [\"ATMS\"]\n", "\n", "# Setup a data request dictionary\n", "data_request = {\"atcf_id\": atcf_id,\n", " \"file_type\": file_type}\n", "\n", "# Make a data request query\n", "tcpc.query(data_request)" ] }, { "cell_type": "markdown", "id": "1b8ec6d7-ecee-4059-bf7a-883ca6346c86", "metadata": {}, "source": [ "As you can see, the query returned 84 files that match our criteria. Let's list all of them." ] }, { "cell_type": "code", "execution_count": null, "id": "b82a95da-bdc1-4765-9001-25d250a0e826", "metadata": {}, "outputs": [], "source": [ "for obj_key in tcpc.object_keys:\n", " print(obj_key)" ] }, { "cell_type": "markdown", "id": "730db11b-fdba-4d46-8c78-ada48b474802", "metadata": {}, "source": [ "Let's retrieve and explore data from `TCPRIMED_v01r01-final_AL062018_ATMS_NOAA20_004112_20180904043709.nc`.\n", "\n", "Note that `tcprimedapi` is designed to safely handle a large volume of data. The conventional way of using `tcprimedapi` involves iterating over the available files from the query and individually downloading each file or reading into memory specific variables from each file while ensuring that each file is properly closed.\n", "\n", "However, for this notebook, we will be retrieving and exploring data from a single file, which requires the file to remain open until we are done with it. So, we will use the `iter()` and `next()` functions.\n", "\n", "Therefore, we will take the following steps:\n", "- Redefine `object_keys` to have just the file of interest (`TCPRIMED_v01r01-final_AL062018_ATMS_NOAA20_004112_20180904043709.nc`).\n", "- Retrieve the datastream object associated with the file.\n", "- Load the datastream object into a NetCDF instance called \"DS\" without downloading the file. The data will exist only in your local system's random access memory (RAM)." ] }, { "cell_type": "code", "execution_count": null, "id": "83997055-0a41-426a-ab2f-a85e576be401", "metadata": {}, "outputs": [], "source": [ "# Redefine object_keys with just the file of interest\n", "new_key = \"v01r01/final/2018/AL/06/TCPRIMED_v01r01-final_AL062018_ATMS_NOAA20_004112_20180904043709.nc\"\n", "tcpc.object_keys = [new_key]\n", "\n", "# Retrieve the datastream associated with the file\n", "obj_key, obj_memory = next(iter(tcpc.inmemory()))\n", "\n", "# Load the datastream object into a NetCDF instance\n", "DS = Dataset(obj_key, memory=obj_memory)" ] }, { "cell_type": "markdown", "id": "122ede8f", "metadata": { "id": "122ede8f" }, "source": [ "## Part 1: Loading and plotting passive microwave data\n", "As discussed in the [background](#Background), passive microwave observations are available on different swaths, depending on the sensor type. To load variables from a particular swath, you would point to the variable within the `passive_microwave` group and swath sub-group (e.g., `S1` or `S2`, etc.). The [dataset documentation](https://noaa-nesdis-tcprimed-pds.s3.amazonaws.com/TCPRIMED_v01r01_documentation.pdf) provides information on the swaths that are available for each TC PRIMED sensor. However, you can also identify the passive microwave swaths that are available in a TC PRIMED overpass files by printing out the `passive_microwave` group instance. Let's take a look at the available swaths for the ATMS sensor." ] }, { "cell_type": "code", "execution_count": null, "id": "22aef7e0", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 3, "status": "ok", "timestamp": 1686353211096, "user": { "displayName": "Naufal Razin", "userId": "00945304052336708650" }, "user_tz": 360 }, "id": "22aef7e0", "outputId": "33e2a77e-56db-4be5-81e1-80f5a9b66cde" }, "outputs": [], "source": [ "# Using the file instance, load the passive_microwave group as a\n", "# group instance called passive_microwave_group\n", "passive_microwave_group = DS[\"passive_microwave\"]\n", "\n", "# Print the passive_microwave group instance\n", "print(passive_microwave_group)" ] }, { "cell_type": "markdown", "id": "0c982408", "metadata": { "id": "0c982408" }, "source": [ "Notice from the print out above of the `passive_microwave` group instance, there are four groups associated with four swaths `S1`, `S2`, `S3`, and `S4` for the ATMS sensor. Each of these groups will have its own set of latitude and longitude information associated with the swath, along with the brightness temperature values from the particular observing frequency associated with the swath. You can query these groups individually to search for the particular observing frequency in which you are interested, or refer to the [dataset documentation](https://noaa-nesdis-tcprimed-pds.s3.amazonaws.com/TCPRIMED_v01r01_documentation.pdf). For brevity, let's move on to loading the 88.2 GHz quasi-vertical polarization brightness temperature data from the `S3` swath." ] }, { "cell_type": "code", "execution_count": null, "id": "8c9136e5", "metadata": { "id": "8c9136e5" }, "outputs": [], "source": [ "# Using the file instance, load the latitude, longitude, and brightness\n", "# temperature variable from the S3 sub-group in the passive_microwave\n", "# group by specifying its \"path\" in the file and using [:] to load the variable\n", "S3_latitude = DS[\"passive_microwave/S3/latitude\"][:] # Latitude of observations on swath S3\n", "S3_longitude = DS[\"passive_microwave/S3/longitude\"][:] # Longitude of observations on swath S3\n", "S3_88V = DS[\"passive_microwave/S3/TB_88.2QV\"][:] # 88.2 GHz quasi-vertical-polarization\n", " # brightness temperature observations on swath S3" ] }, { "cell_type": "markdown", "id": "7c778d88", "metadata": { "id": "7c778d88" }, "source": [ "Fantastic! You've successfully loaded passive microwave data from a TC PRIMED overpass file. Let's now plot the brightness temperature data using `matplotlib`." ] }, { "cell_type": "code", "execution_count": null, "id": "486fac6a", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 560 }, "executionInfo": { "elapsed": 443, "status": "ok", "timestamp": 1686353211538, "user": { "displayName": "Naufal Razin", "userId": "00945304052336708650" }, "user_tz": 360 }, "id": "486fac6a", "outputId": "1404f06c-bc00-4d4a-9ebc-47141a8c2ba5" }, "outputs": [], "source": [ "# Set figure size\n", "plt.figure(figsize=[10,6])\n", "\n", "# Plot data as colormesh, with the \"nipy_spectral_r\" colormap\n", "plt.pcolormesh(S3_longitude, S3_latitude, S3_88V, cmap=\"viridis\")\n", "\n", "# Add and label the colorbar\n", "plt.colorbar(pad=-0.04, fraction=0.03, label=\"88.2 GHz Brightness Temperature (Kelvin)\")\n", "\n", "# Scale the aspect ratio of the figure so that 1 degree longitude = 1 degree latitude\n", "plt.axis(\"scaled\")\n", "\n", "# Add latitude and longitude labels\n", "plt.xlabel(\"Longitude (degrees east)\")\n", "plt.ylabel(\"Latitude (degrees north)\")" ] }, { "cell_type": "markdown", "id": "c11e66e0", "metadata": { "id": "c11e66e0" }, "source": [ "As you can see, the plot shows the ATMS scans within the vicinity of Hurricane Florence (2018). However, Hurricane Florence is shifted to the right of the image. How do you center the image? To do so, you can use the storm center location from the overpass file. The storm center location is in the `overpass_storm_metadata` group of the TC PRIMED overpass files. If you're wondering what other variables are available in the `overpass_storm_metadata`, you can always print out their instances.\n", "\n", "The storm_latitude and storm_longitude data in the `overpass_storm_metadata` group are in a one-element array. Let's just obtain the array element by first loading the variable using `[:]` and then pulling out the element by supplying an array index of `[0]`." ] }, { "cell_type": "code", "execution_count": null, "id": "a45aed2e", "metadata": { "id": "a45aed2e" }, "outputs": [], "source": [ "# Using the file instance, load the storm_latitude and storm_longitude\n", "# from the overpass_storm_metadata group by specifying its \"path\" in\n", "# the file, using [:] to load the variable, and using [0] to load the\n", "# single element in the variable array\n", "storm_latitude = DS[\"overpass_storm_metadata/storm_latitude\"][:][0]\n", "storm_longitude = DS[\"overpass_storm_metadata/storm_longitude\"][:][0]" ] }, { "cell_type": "markdown", "id": "4d7312fc", "metadata": { "id": "4d7312fc" }, "source": [ "Now that you've loaded the `storm_latitude` and `storm_longitude` values, use `xlim` and `ylim` to constrain the image within +/- 7.5 degree latitude and longitude of the storm center" ] }, { "cell_type": "code", "execution_count": null, "id": "2dc26044", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 533 }, "executionInfo": { "elapsed": 189, "status": "ok", "timestamp": 1686353211726, "user": { "displayName": "Naufal Razin", "userId": "00945304052336708650" }, "user_tz": 360 }, "id": "2dc26044", "outputId": "e761b91c-0a06-4d6c-e7cb-3acc47319b35" }, "outputs": [], "source": [ "# Set figure size\n", "plt.figure(figsize=[6,6])\n", "\n", "# Plot data as colormesh, with the \"nipy_spectral_r\" colormap\n", "plt.pcolormesh(S3_longitude, S3_latitude, S3_88V, cmap=\"viridis\")\n", "\n", "# Add and label the colorbar\n", "plt.colorbar(pad=0.02, fraction=0.047, label=\"88.2 GHz Brightness Temperature (Kelvin)\")\n", "\n", "# Scale the aspect ratio of the figure so that 1 degree longitude = 1 degree latitude\n", "plt.axis(\"scaled\")\n", "\n", "# Add latitude and longitude labels\n", "plt.xlabel(\"Longitude (degrees east)\")\n", "plt.ylabel(\"Latitude (degrees north)\")\n", "\n", "# Constrain the image to within +/- 7.5 degree latitude and longitude of the\n", "# storm center\n", "plt.xlim(storm_longitude - 7.5, storm_longitude + 7.5)\n", "plt.ylim(storm_latitude - 7.5, storm_latitude + 7.5)" ] }, { "cell_type": "markdown", "id": "7a977ef7", "metadata": { "id": "7a977ef7" }, "source": [ "Wonderful! Note that you can use the storm location from the `overpass_storm_metadata` group to re-center any other data from the satellite, such as data from the `GPROF` group or data from the `radar_radiometer` group (for the TRMM and GPM satellites)" ] }, { "cell_type": "markdown", "id": "9872b6fc", "metadata": { "id": "9872b6fc" }, "source": [ "
\n", "

Exercise 1

Using the example above, load and plot the 165.5 GHz quasi-horizontal-polarization brightness temperature from the S4 swath.\n", "
" ] }, { "cell_type": "markdown", "id": "c7da47bc", "metadata": { "id": "c7da47bc" }, "source": [ "
\n", " Hint: Print out the S4 group instance from the passive_microwave group to identify the variables you would want to load.\n", "
" ] }, { "cell_type": "markdown", "id": "8849069e", "metadata": { "id": "8849069e" }, "source": [ "## Part 2: Reading in and plotting GPROF data\n", "Since rainfall retrievals from the Goddard PROFiling algorithm (GPROF) derive from the passive microwave observations, GPROF data follows a similar structure to the passive microwave data. However, instead of having multiple swaths, GPROF data is located on only one swath, `S1`.\n", "\n", "Before we load and plot the surface precipitation data from GPROF, note that for a small minority of cases, GPROF data isn't available even though its corresponding passive microwave data is available. To indicate data availability, we use availability flags, with a value of 0 indicating that the data is not available and a value of 1 indicating that the data is available. Let's first retrieve this availability flag." ] }, { "cell_type": "code", "execution_count": null, "id": "4956e850", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "executionInfo": { "elapsed": 156, "status": "ok", "timestamp": 1686353211878, "user": { "displayName": "Naufal Razin", "userId": "00945304052336708650" }, "user_tz": 360 }, "id": "4956e850", "outputId": "fc1f0f16-e5e3-4f34-dd9b-55fac5ede995" }, "outputs": [], "source": [ "# Using the file instance, load the availability_flag\n", "# from the GPROF group by specifying its \"path\" in\n", "# the file, using [:] to load the variable, and using [0]\n", "# to load the single element in the variable array\n", "gprof_flag = DS[\"GPROF/availability_flag\"][:][0]\n", "\n", "# Print the GPROF availability flag\n", "print(gprof_flag)" ] }, { "cell_type": "markdown", "id": "a5adb62b", "metadata": { "id": "a5adb62b" }, "source": [ "Now that we know that GPROF data is available, we can proceed. There are a few GPROF variables that you can load and plot. They are listed in the file and in the [dataset documentation](https://noaa-nesdis-tcprimed-pds.s3.amazonaws.com/TCPRIMED_v01r01_documentation.pdf). However, here, we'll load and plot the GPROF surface precipitation rate." ] }, { "cell_type": "code", "execution_count": null, "id": "b7858c9b", "metadata": { "id": "b7858c9b" }, "outputs": [], "source": [ "# Using the file instance, load the latitude, longitude, and surface\n", "# precipitation variable from the S1 sub-group in the GPROF\n", "# group by specifying its \"path\" in the file and using [:] to load the variable\n", "S1_latitude = DS[\"GPROF/S1/latitude\"][:] # Latitude of observations on GPROF swath S1\n", "S1_longitude = DS[\"GPROF/S1/longitude\"][:] # Longitude of observation on GPROF swath S1\n", "S1_sfcprcp = DS[\"GPROF/S1/surfacePrecipitation\"][:] # surface precipitation rate from GPROF swath S1" ] }, { "cell_type": "code", "execution_count": null, "id": "14ab4101", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 533 }, "executionInfo": { "elapsed": 274, "status": "ok", "timestamp": 1686353212150, "user": { "displayName": "Naufal Razin", "userId": "00945304052336708650" }, "user_tz": 360 }, "id": "14ab4101", "outputId": "74823975-041e-4950-f6e6-ab057b63a112" }, "outputs": [], "source": [ "# Set figure size\n", "plt.figure(figsize=[6,6])\n", "\n", "# Plot data as colormesh, with the \"Blues\" colormap\n", "plt.pcolormesh(S1_longitude, S1_latitude, S1_sfcprcp, cmap=\"Blues\")\n", "\n", "# Add and label the colorbar\n", "plt.colorbar(pad=0.02, fraction=0.047, label=\"GPROF Surface Precipitation (mm/hr)\")\n", "\n", "# Scale the aspect ratio of the figure so that 1 degree longitude = 1 degree latitude\n", "plt.axis(\"scaled\")\n", "\n", "# Add latitude and longitude labels\n", "plt.xlabel(\"Longitude (degrees east)\")\n", "plt.ylabel(\"Latitude (degrees north)\")\n", "\n", "# Constrain the image to within +/- 7.5 degree latitude and longitude of the\n", "# storm center\n", "plt.xlim(storm_longitude - 7.5, storm_longitude + 7.5)\n", "plt.ylim(storm_latitude - 7.5, storm_latitude + 7.5)" ] }, { "cell_type": "markdown", "id": "22976212", "metadata": { "id": "22976212" }, "source": [ "## Part 3: Loading and plotting near-coincident infrared data\n", "The TC PRIMED overpass files also contain nearly-coincident infrared brightness temperatures from a geostationary satellite along with derived variables like the infared-based size parameter, R5 (Knaff et al. 2014, 2017). However, just like the GPROF product, both the infared and R5 data may or may not be available, with their availability marked by an availability flag.\n", "\n", "In addition, since the infrared data may be available any time within 3 hours of the overpass time, the storm center location in the infared data may not be the same as the storm center location in the passive microwave or GPROF data. Therefore, when infrared data is available, the infrared group also stores the storm center latitude and longitude at the infrared observation time.\n", "\n", "Finally, the infrared data does not have the swath structure associated with the passive microwave observations. Therefore, you will not need to refer to a specific swath when loading infrared data." ] }, { "cell_type": "markdown", "id": "67771028", "metadata": { "id": "67771028" }, "source": [ "
\n", "

Practice

Using what you've learned from loading and plotting the passive microwave and GPROF data above\n", "
    \n", "
  • print out the infrared availability flag
  • \n", "
  • load and plot the infrared data, centered on the storm center at the infrared observation time
  • \n", "
\n", "
" ] }, { "cell_type": "markdown", "id": "956139dc", "metadata": { "id": "956139dc" }, "source": [ "
\n", "Hint: Print out the infrared group instance to identify the names of the variables you want to obtain.\n", "
" ] }, { "cell_type": "markdown", "id": "5qtHMSWeQn7E", "metadata": { "id": "5qtHMSWeQn7E" }, "source": [ "## Close the File\n", "When loading data from a NetCDF file, **always remember to close the file**. A best practice would be to close the file immediately after loading the variable or attribute of interest. However, since we're loading various variables and attributes throughout this notebook, we will close the file at the end of this notebook using the command below." ] }, { "cell_type": "code", "execution_count": null, "id": "oCyW6_HlQvpK", "metadata": { "id": "oCyW6_HlQvpK" }, "outputs": [], "source": [ "DS.close()" ] }, { "cell_type": "markdown", "id": "bfb0969b", "metadata": { "id": "bfb0969b" }, "source": [ "## Final Thoughts\n", "There are a host of other variables you can obtain and plot from the TC PRIMED overpass file. However, the basic concepts of loading and plotting/printing that you learned in this tutorial also apply to those variables. To recap, in this tutorial, you learned:\n", "- about the basic structure of a TC PRIMED overpass file\n", "- how to load and plot data from the TC PRIMED overpass file\n", "- how to determine data availability in the TC PRIMED overpass file using the availability flag" ] }, { "cell_type": "markdown", "id": "382f060b", "metadata": { "id": "382f060b" }, "source": [ "## Data Statement\n", "\n", "- Razin, Muhammad Naufal; Slocum, Christopher J.; Knaff, John A.; Brown, Paula J. 2023. Tropical Cyclone PRecipitation, Infrared, Microwave, and Environmental Dataset (TC PRIMED). v01r01. NOAA National Centers for Environmental Information. https://doi.org/10.25921/dmy1-0595." ] }, { "cell_type": "markdown", "id": "eb646585", "metadata": { "id": "eb646585" }, "source": [ "## References\n", "- Knaff, J. A., S. P. Longmore, and D. A. Molenar, 2014: An objective satellite-based tropical cyclone size climatology. J. Climate, 27, 455–476, https://doi.org/10.1175/JCLI-D-13-00096.1.\n", "\n", "- Knaff, J. A., C. R. Sampson, and G. Chirokova, 2017: A global statistical-dynamical tropical cyclone wind radii forecast scheme. Wea. Forecasting, 32, 629–644, https://doi.org/10.1175/WAF-D-16-0168.1." ] }, { "cell_type": "markdown", "id": "54bbf046", "metadata": { "id": "54bbf046" }, "source": [ "## Metadata\n", "- Language / package(s)\n", " - Python\n", " - tcprimedapi\n", " - netCDF4\n", " - matplotlib\n", "- Domain\n", " - NOAA\n", " - NASA\n", "- Application keywords\n", " - Satellite passive microwave\n", " - Goddard Profiling algorithm (GPROF)\n", "- Geophysical keywords\n", " - Tropical cyclones" ] }, { "cell_type": "markdown", "id": "726b173f", "metadata": { "id": "5b8aeb90" }, "source": [ "## Disclaimer\n", "\n", "This Jupyter notebook is a scientific product and is not official communication of the National Oceanic and Atmospheric Administration, or the United States Department of Commerce. All NOAA Jupyter notebooks are provided on an 'as is' basis and the user assumes responsibility for its use. Any claims against the Department of Commerce or Department of Commerce bureaus stemming from the use of this Jupyter notebook will be governed by all applicable Federal law. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise does not constitute or imply their endorsement, recommendation or favoring by the Department of Commerce. The Department of Commerce seal and logo, or the seal and logo of a DOC bureau, shall not be used in any manner to imply endorsement of any commercial product or activity by DOC or the United States Government." ] }, { "cell_type": "code", "execution_count": null, "id": "3cf13891", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "colab": { "provenance": [] }, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.11" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": true } }, "nbformat": 4, "nbformat_minor": 5 }