{ "cells": [ { "cell_type": "markdown", "id": "99aafef2", "metadata": { "id": "99aafef2" }, "source": [ "# Exploring TC PRIMED, Chapter 2: Composite Analysis\n", "- Creators: Naufal Razin1, Kathy Haynes1, and Chris Slocum2\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 code to use `tcprimedapi` and new package download routine\n", "\n", "---\n", "\n", "## Overview\n", "With an extensive array of tropical cyclone passive microwave observations, retrieved precipitation, track and intensity information, and environmental diagnostics, TC PRIMED provides users with the opportunity to conduct a comprehensive study on tropical cyclone convective and precipitation structure, intensity, and environment. In this notebook, you will learn how to conduct a simple timeseries composite using TC PRIMED data.\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 (Chapter 1a of this Learning Journey)\n", "- plotting data using matplotlib\n", "- TC PRIMED overpass file data structure (Chapter 1b of this Learning Journey)\n", "- TC PRIMED environmental file data structure (Chapter 1c of this Learning Journey)\n", "\n", "## Learning Outcomes\n", "By working through this notebook, you will learn how to:\n", "- conduct a simple timeseries composite analysis using TC PRIMED data\n", "\n", "## Time Estimate\n", "- Estimated text reading time: 8 to 16 min\n", "- Estimated code reading time: 7 to 13 min\n", "- Estimated total reading time: 15 to 29 min" ] }, { "cell_type": "markdown", "id": "f530e9b2-7a76-4de8-8e10-aeff6b66d57d", "metadata": { "id": "31f930d1" }, "source": [ "## Background\n", "One of the key concepts that is widely understood in the tropical cyclone community is the importance of robust convection in the tropical cyclone inner-core for achieving and maintaining strong tropical cyclone winds. Strong inner-core convection often coincide with more intense tropical cyclones that have a maximum 1-minute average tangential wind speed in the middle-to-higher end of the [Saffir-Simpson Hurricane Wind Scale](https://www.nhc.noaa.gov/aboutsshws.php#:~:text=The%20Saffir%2DSimpson%20Hurricane%20Wind,Scale%20estimates%20potential%20property%20damage.). Forecasters often analyze satellite passive microwave observations to gain insight into the convective structure of tropical cyclones and predict its intensity trend. In this notebook, you will learn to use passive microwave observations from TC PRIMED to conduct a simple timeseries composite, and relate the tropical cyclone convective structure to intensity.\n", "\n", "### Hurricane Florence (2018)\n", "In this example, we will use TC PRIMED files from Hurricane Florence (2018). If you have gone through the earlier notebooks in this series, you should be familiar with Hurricane Florence. 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, 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." ] }, { "cell_type": "markdown", "id": "28aecab2-bf98-4e5f-ac65-3d04bf3cbeac", "metadata": { "id": "31f930d1" }, "source": [ "
\n", "\"An\n", "\n", "
Figure 1. An image of Hurricane Florence (2018) captured by European Space Agency astronaut Alexander Gerst from aboard the International Space Station. Source: ESA
\n", "
" ] }, { "cell_type": "markdown", "id": "083143bf-0280-4791-acac-b08870dc2106", "metadata": { "id": "31f930d1" }, "source": [ "### Passive Microwave Observations in the 85 to 92 GHz Frequency Window\n", "In this notebook, we will relate the convective structure of Hurricane Florence to its intensity. More precisely, we will look at passive microwave signatures in the 85 to 92 GHz frequency window to infer the strength and location of convection. In this frequency window, large precipitation-sized ice particles, such as that found in deep convection, scatter radiation from the Earth. The scattering of Earth radiation results in observations of localized low brightness temperatures. Stronger convection produces larger ice particles, which result in stronger scattering of Earth radiation and therefore, lower brightness temperatures.\n", "\n", "Other sources can also influence passive microwave brightness temperatures to produce low or high brightness temperatures, like land. To remove the effect of varying brightness temperatures to the varying properties of the Earth's surface and isolate just the ice-scattering signatures, satellite analysts use the polarization-corrected brightness temperature (PCT), which uses a combination of the observations from the vertically- and horizontally- polarized brightness temperatures. In this notebook, we will use the equation for PCT from Cecil and Chronis (2018), where\n", "\n", "$$\n", " PCT = {TB}_{V} \\times 1.7 - {TB}_{H} \\times 0.7\n", "$$\n", "\n", "Here, ${TB}_{V}$ is the vertically-polarized brightness temperature and ${TB}_{H}$ is the horizontally-polarized brightness temperature." ] }, { "cell_type": "markdown", "id": "677bc7e7", "metadata": { "id": "677bc7e7" }, "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 read in the TC PRIMED file\n", "- `matplotlib` to plot the data\n", "- `numpy` for simple array operations\n", "- `scipy` for calculating bin statistics" ] }, { "cell_type": "markdown", "id": "aa4d354e-3de8-477e-8e64-159ba7c13b14", "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": "741ece79", "metadata": { "id": "741ece79" }, "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": "98dbe45f-2694-4c6c-86e7-4cb838abdda6", "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", " \"numpy\": {\"distribution_name\": None, \"version\": None},\n", " \"scipy\": {\"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": "JtpVbGoyfP7p", "metadata": { "id": "JtpVbGoyfP7p" }, "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": "29acec82", "metadata": { "id": "29acec82" }, "outputs": [], "source": [ "# Load the Python packages we will use in this notebook\n", "import tcprimedapi\n", "import datetime\n", "from netCDF4 import Dataset\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "from scipy import stats" ] }, { "cell_type": "markdown", "id": "a9baf22e", "metadata": { "id": "a9baf22e" }, "source": [ "## File Selection\n", "When choosing the files to conduct the analysis, there are several key aspects of passive microwave observations that users should note:\n", "- Cross-track-scanning passive microwave sensors have varying instantaneous fields-of-view (IFOV) across its swath, with the smallest IFOV (highest resolution) at nadir and the biggest IFOV (coarsest resolution) at the edge of its swath. Whereas conical-scanning passive microwave sensors have a constant IFOV/resolution across its swath.\n", "- Different passive microwave sensors have different instantaneous fields-of-view (IFOV). Some sensors have smaller IFOV (higher resolution) while other sensors have bigger IFOV (coarser resolution). For more information, see Figure 1 from Chapter 1b of this Learning Journey.\n", "- Some sensors are available on only one satellite (e.g., the Global Precipitation Measurement (GPM) Microwave Imager (GMI)), while other sensors are available on multiple satellites (e.g., the Special Sensor Microwave Imager (SSMI))\n", "- Different observing frequencies do not produce the same brightness temperature observation. In other words, given all else equal, the observation of a convective cell at the 85.5 GHz frequency would not yield the same brightness temperature value as the same observation in at the 89.0 GHz frequency.\n", "\n", "When doing a timeseries composite, particularly from only one storm, we want to select a sensor that is available on multiple satellites to increase our chances of obtaining multiple observations of the storm throughout its life. In addition, we want to ensure consistent observations such that the sensor characteristics do not influence the observed brightness temperatures. Therefore, we will use observations from only the conical-scanning SSMIS sensor in this notebook. Within the range of the 85 to 92 GHz observation frequency, the Special Sensor Microwave - Imager/Sounder (SSMIS) sensor has an observation frequency at 91.665 GHz (92 GHz, for brevity)." ] }, { "cell_type": "markdown", "id": "Niw6a8YTddh6", "metadata": { "id": "Niw6a8YTddh6" }, "source": [ "## Read Files Online\n", "Let's retrieve the files that we will use in this example. As we have mentioned above, the TC PRIMED files will be from SSMIS overpasses 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 SSMIS overpasses, this will be `SSMIS`.\n", "\n", "Let's query the TC PRIMED AWS S3 bucket using `tcprimedapi` and the criteria above." ] }, { "cell_type": "code", "execution_count": null, "id": "1286e8d0-1a85-4b51-b3cf-69bb8ab972cc", "metadata": {}, "outputs": [], "source": [ "# Create an instance of a Client\n", "tcpc_ovp = tcprimedapi.Client()\n", "\n", "# List desired ATCF ID\n", "atcf_id = [\"AL062018\"]\n", "\n", "# List desired file type\n", "file_type = [\"SSMIS\"]\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_ovp.query(data_request)" ] }, { "cell_type": "markdown", "id": "e9995a31-da6a-47e1-b173-5768eb84ef62", "metadata": {}, "source": [ "As you can see, the query returned 79 files that match our criteria. Let's list all of them." ] }, { "cell_type": "code", "execution_count": null, "id": "179ca9ec-75a0-4b22-9d8d-3a2f0d3580a2", "metadata": {}, "outputs": [], "source": [ "for obj_key in tcpc_ovp.object_keys:\n", " print(obj_key)" ] }, { "cell_type": "markdown", "id": "40cc3bd4-4109-45dd-8916-d55b65569e66", "metadata": {}, "source": [ "Notice that the files are listed in alphabetical order based on the platform name (i.e., F16, F17, and F18). When creating our composite, we would want to re-order them based on the overpass times. So, we will do several things when retrieving the data from the files:\n", "- Generate a dictionary to store the data from each file. Use the `obj_key` above as the dictionary key for each file. The data exist only in your local system's random access memory (RAM)\n", "- Store the `obj_key` in a list called `OVERPASS_FILE_NAMES`.\n", "- Retrieve the overpass time from each file and store them in `OVERPASS_UNIX_TIMES`\n", "\n", "**Since we will be retrieving data from multiple files, the following code block will take some time to run.**" ] }, { "cell_type": "code", "execution_count": null, "id": "126dd8b7-17e3-4e67-b043-88051ebdfc1d", "metadata": {}, "outputs": [], "source": [ "# Initialize a dictionary to store data from files\n", "DS = {}\n", "\n", "# Initialize numpy arrays to store dictionary keys and overpass times\n", "OVERPASS_FILE_NAMES = np.array([])\n", "OVERPASS_UNIX_TIMES = np.array([])\n", "\n", "# Loop through each object in the tcprimed Client query\n", "for object_key, memory in tcpc_ovp.inmemory():\n", "\n", " # Read the data from each file and store them in the dictionary\n", " DS[object_key] = Dataset(object_key, memory=memory)\n", "\n", " # Obtain the overpass unix time\n", " overpass_unix_time = DS[object_key][\"overpass_metadata\"][\"time\"][:][0]\n", "\n", " # Store the overpass unix time into array for all overpass unix times\n", " OVERPASS_UNIX_TIMES = np.append(OVERPASS_UNIX_TIMES, overpass_unix_time)\n", "\n", " # Store the object key into array to use as dictionary key\n", " OVERPASS_FILE_NAMES = np.append(OVERPASS_FILE_NAMES, object_key)" ] }, { "cell_type": "markdown", "id": "815c8d25-e1fa-4c9d-a2f3-90d7c8c630ad", "metadata": {}, "source": [ "Great! We've loaded the data from each file. Now, let's reorder the data in the order of increasing time and print out the file names again." ] }, { "cell_type": "code", "execution_count": null, "id": "565c4980-f2d3-47a5-b454-4a22a2614ae7", "metadata": {}, "outputs": [], "source": [ "# Get indices of the overpass unix times reordered\n", "# in increasing time\n", "reordered_idx = np.argsort(OVERPASS_UNIX_TIMES)\n", "\n", "# Apply the indices above to the overpass unix times\n", "# and file names\n", "OVERPASS_UNIX_TIMES = OVERPASS_UNIX_TIMES[reordered_idx]\n", "OVERPASS_FILE_NAMES = OVERPASS_FILE_NAMES[reordered_idx]\n", "\n", "# Print the reordered overpass file names\n", "for overpass_file_name in OVERPASS_FILE_NAMES:\n", " print(overpass_file_name)" ] }, { "cell_type": "markdown", "id": "d5856a85-eb82-4f87-8c9b-57a41c1c9725", "metadata": {}, "source": [ "Perfect! Our overpass files have been reordered in the order of increasing time. Since we want to relate the passive microwave convective signatures with the tropical cyclone intensity, let's retrieve and read information from the TC PRIMED environmental file. We'll again use `tcprimedapi` to pull the `env` file data for Hurricane Florence." ] }, { "cell_type": "code", "execution_count": null, "id": "1b0c4722-9a78-47e3-b0d4-62b5528acd9d", "metadata": {}, "outputs": [], "source": [ "# Create an instance of a Client\n", "tcpc_env = tcprimedapi.Client()\n", "\n", "# List desired ATCF ID\n", "atcf_id = [\"AL062018\"]\n", "\n", "# List desired file type\n", "file_type = [\"env\"]\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_env.query(data_request)" ] }, { "cell_type": "markdown", "id": "5820fff8-2931-48a2-a101-563c02febfb3", "metadata": {}, "source": [ "Since we know that there is only one TC PRIMED environmental file, we can simply use that environmental file name as another dictionary key, and store the environmental file data in the same dictionary we have above." ] }, { "cell_type": "code", "execution_count": null, "id": "76211f36", "metadata": { "id": "76211f36" }, "outputs": [], "source": [ "# Initialize empty string to store environmental file name\n", "ENV_FILE_NAME = \"\"\n", "\n", "# Loop through each object in the tcprimed Client query\n", "for object_key, memory in tcpc_env.inmemory():\n", "\n", " # Read the data from each file and store them in the dictionary\n", " DS[object_key] = Dataset(object_key, memory=memory)\n", "\n", " # Assign object_key to ENV_FILE_NAME\n", " ENV_FILE_NAME = object_key" ] }, { "cell_type": "markdown", "id": "c679bf91", "metadata": { "id": "c679bf91" }, "source": [ "We have retrieved all of the files we need to perform this composite analysis. To begin, let's load the intensity information from the TC PRIMED environmental file." ] }, { "cell_type": "code", "execution_count": null, "id": "9f0f65d2", "metadata": { "id": "9f0f65d2" }, "outputs": [], "source": [ "# Load the time and intensity data from the storm_metadata\n", "# group of the TC PRIMED environmental file\n", "storm_metadata_time = DS[ENV_FILE_NAME][\"/storm_metadata/time\"][:]\n", "storm_metadata_vmax = DS[ENV_FILE_NAME][\"/storm_metadata/intensity\"][:]\n", "\n", "# All time variables in TC PRIMED files are stored in units\n", "# of seconds since 1970-01-01, a.k.a., the Unix time stamp\n", "# Convert this Unix time stamp array into a Python datetime\n", "# array.\n", "# Then, convert this Python datetime array into a string array\n", "# in the form of \"month/day hour\"\n", "storm_metadata_datetime = [datetime.datetime.fromtimestamp(t) for t in storm_metadata_time]\n", "storm_metadata_datetime_str = [t.strftime(\"%m/%d %H\") for t in storm_metadata_datetime]" ] }, { "cell_type": "markdown", "id": "3ff00201", "metadata": { "id": "3ff00201" }, "source": [ "## Selecting Parameters for Timeseries Composite\n", "Since we want to present our data in the form of a timeseries, our output data array must have time as one of its dimensions. This time dimension corresponds to the time of the passive microwave observation throughout Hurricane Florence's life, which is the same as the number of TC PRIMED overpass files. We also want to show the evolution of the passive microwave convective signature — how strong it is and where it is located in Hurricane Florence. One way to do this is by taking the average passive microwave brightness temperature within various radial regions around the center of Hurricane Florence. Therefore, we will need to specify our radial bins for these radial regions. Let's do that first." ] }, { "cell_type": "code", "execution_count": null, "id": "527b1f8a", "metadata": { "id": "527b1f8a" }, "outputs": [], "source": [ "# Radial bin parameters\n", "radial_bins_min = 0 # Innermost radius used for binning, in km\n", "radial_bins_max = 301 # Outermost radius used for binning, in km\n", "radial_bins_size = 25 # Size of the radial bin, in km\n", "# Generate array of the radial bins\n", "radial_bins = np.arange(radial_bins_min, radial_bins_max, radial_bins_size)\n", "\n", "# When storing and plotting the mean brightness temperatures, we will want to use\n", "# the center of the radial bins, which has a size equivalent to len(radial_bins) - 1.\n", "# Let's obtain that.\n", "radial_bin_center = np.arange(radial_bins_min + (radial_bins_size/2),\n", " radial_bins_max - (radial_bins_size/2) + 1,\n", " radial_bins_size)\n", "\n", "# Initialize time array, which has the same size as the number of\n", "# selected observations of Hurricane Florence\n", "overpass_times = np.zeros(len(OVERPASS_FILE_NAMES))\n", "\n", "# Initialize array to store mean PCT values\n", "stat_pct92 = np.zeros((overpass_times.size, radial_bin_center.size))" ] }, { "cell_type": "markdown", "id": "f4f95932", "metadata": { "id": "f4f95932" }, "source": [ "## Timeseries Composite\n", "Compositing the timeseries consists of several steps. At each observation time:\n", "- Load the necessary variables\n", "- Using the x and y (or zonal and meridional) distance of the observation pixels for each overpass, calculate the radius of the observation pixels\n", "- Using the horizontally and vertically polarized 92 GHz observation, calculate the polarization-corrected brightness temperatures (PCT)\n", "- Bin the PCT into the radial bins and calculate the mean in each bin. This process is automatically handled by scipy's binned_statistic function." ] }, { "cell_type": "code", "execution_count": null, "id": "4a28a0ea", "metadata": { "id": "4a28a0ea" }, "outputs": [], "source": [ "# Loop through each file from each selected observation time\n", "# NOTE: we have already arranged the files in the order of increasing\n", "# time\n", "\n", "# Specify the statistic we want to calculate in each radial bin\n", "# Options include mean, std, median, count, sum, min, max, or\n", "# a user-defined or numerical function (e.g., np.nanmean)\n", "stat = 'mean'\n", "for file_idx, overpass_file_name in enumerate(OVERPASS_FILE_NAMES):\n", "\n", " # Load the overpass time variable\n", " overpass_time = DS[overpass_file_name][\"/overpass_metadata/time\"][:][0]\n", " # Put the overpass time variable into the array we specified above\n", " overpass_times[file_idx] = overpass_time\n", "\n", " # Load the x and y values for the pixels in the S4 swath\n", " # (corresponding to the swath for the 92 GHz observation)\n", " S4_x = DS[overpass_file_name][\"/passive_microwave/S4/x\"][:]\n", " S4_y = DS[overpass_file_name][\"/passive_microwave/S4/y\"][:]\n", " # Calculated the radius of the pixels in the S4 swath relative\n", " # to the storm center\n", " S4_r = np.sqrt(S4_x**2 + S4_y**2)\n", "\n", " # Load the horizontal and vertical polarization brightness temperature\n", " # at 92 GHz\n", " S4_v92 = DS[overpass_file_name][\"/passive_microwave/S4/TB_91.665V\"][:]\n", " S4_h92 = DS[overpass_file_name][\"/passive_microwave/S4/TB_91.665H\"][:]\n", "\n", " # Calculate the PCT using the horizontal and vertical polarization\n", " # brightness temperature\n", " S4_pct92 = S4_v92 * 1.7 - S4_h92 * 0.7\n", "\n", " # Using scipy's binned_statistic, bin the PCT into the radial bins we have\n", " # specified above and calculate the statistic\n", " # To ensure a single value is returned for each radial bin, we will have to\n", " # flatten the radius and PCT arrays\n", " stat_pct92[file_idx, :], \\\n", " bin_edges, \\\n", " bin_number = stats.binned_statistic(S4_r.flatten(), S4_pct92.flatten(),\n", " statistic=stat, bins=radial_bins)" ] }, { "cell_type": "markdown", "id": "04269cf5", "metadata": { "id": "04269cf5" }, "source": [ "## Plotting the Timeseries\n", "Now you are ready to plot the timeseries composite! To show how the passive microwave convective signature evolves with Hurricane Florence's intensity, we will also plot the intensity evolution on the same figure using the `twiny()` function. Therefore, the radius bins will be located on the axis at the bottom of the figure, while the tropical cyclone intensity will be located on the axis at the top of the figure. The mean 92 GHz PCT and tropical cyclone intensity will share the same y-axis corresponding to time." ] }, { "cell_type": "code", "execution_count": null, "id": "ab61a965", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 890 }, "executionInfo": { "elapsed": 1216, "status": "ok", "timestamp": 1686598905014, "user": { "displayName": "Naufal Razin", "userId": "00945304052336708650" }, "user_tz": 360 }, "id": "ab61a965", "outputId": "c140e6ef-f39e-4b1c-ec81-60dedb4333fb" }, "outputs": [], "source": [ "# Set the figure size\n", "plt.figure(figsize=(7, 10))\n", "\n", "# Plot the mean 92 GHz PCT in each radial bin and at each selected\n", "# observation time\n", "# Specify the colormap and contour levels to use\n", "plt.contourf(radial_bin_center, overpass_times, stat_pct92,\n", " cmap=\"inferno_r\",\n", " levels=np.arange(220, 291, 2),\n", " extend=\"both\")\n", "# Plot and label the colorbar\n", "plt.colorbar(label=\"91.665-GHz Brightness Temperature (K)\")\n", "# Label the x axis\n", "plt.xlabel(\"Radial Bins (km)\")\n", "\n", "# Generate new x-axis sharing the y-axis with the plot above\n", "plt.twiny()\n", "\n", "# Plot the intensity values throughout the storm's life\n", "plt.plot(storm_metadata_vmax, storm_metadata_time, color=\"k\", lw=5)\n", "\n", "# Label the x axis\n", "plt.xlabel(\"Intensity (knots)\")\n", "\n", "# Recall that the time units are still in Unix time\n", "# Replace the Unix time with the time string array we\n", "# generated above and only plot the ticks at every\n", "# fourth entry\n", "plt.yticks(storm_metadata_time[::4], storm_metadata_datetime_str[::4]);" ] }, { "cell_type": "markdown", "id": "ea96ccc5", "metadata": { "id": "ea96ccc5" }, "source": [ "## Analysis\n", "First, notice that at different points throughout Hurricane Florence's life, pockets of low mean 92 GHz PCT (lower than 230 Kelvin) exist in radial bins less than 50 to 100 km from the storm center. Recall that low brightness temperatures in this observation frequency correspond to strong convection that produces large precipitation-sized ice particles that scatter Earth radiation. Therefore, you can infer that at these times and these radial bins that are close to the inner core, strong convection exist.\n", "\n", "If you compare these convective signals with the evolution of Hurricane Florence's intensity, you can see that they correspond to really strong intensities, above 80 knots!\n", "\n", "Second, notice at the times corresponding to stronger intensities, lower mean 92 GHz PCT (lower than 250 Kelvin) also extend farther out, radially. In the context of our averaging approach, the larger extent of lower mean 92 GHz PCT may correspond to an increase in the number of strong, isolated convective cells or an increase in the number of moderate, widespread convective cells.\n", "\n", "Nonetheless, the timeseries composite shows a strong relationship between the strength and location of convective signatures (hence, convection) and a tropical cyclone's intensity." ] }, { "cell_type": "markdown", "id": "28b5fed1", "metadata": { "id": "28b5fed1" }, "source": [ "
\n", "

Practice

\n", " \n", "
\n", "\n", "
\n", "Hint: Experiment with a relative humidity time series at the vertical level and averaging region of your choice." ] }, { "cell_type": "markdown", "id": "TatB3zIhU08B", "metadata": { "id": "TatB3zIhU08B" }, "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 files at the end of this notebook using the command below." ] }, { "cell_type": "code", "execution_count": null, "id": "hvQruJ1NU73b", "metadata": { "id": "hvQruJ1NU73b" }, "outputs": [], "source": [ "DS[ENV_FILE_NAME].close()\n", "\n", "for overpass_file_name in OVERPASS_FILE_NAMES:\n", " DS[overpass_file_name].close()" ] }, { "cell_type": "markdown", "id": "33f46a3a", "metadata": { "id": "33f46a3a" }, "source": [ "## Final Thoughts\n", "In this tutorial, you learned how to generate a simple timeseries composite from observations of Hurricane Florence (2018) and saw how convection evolves with intensity and vice versa. This timeseries composite represents one of many ways you can use TC PRIMED data. You're not limited to generating a timeseries composite. You can create other types of composites, like a composite in the x and y dimensions, and using other criteria such as observations that meet only certain environmental characteristics." ] }, { "cell_type": "markdown", "id": "0764cbdf", "metadata": { "id": "0764cbdf" }, "source": [ "## Data Statement\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": "d65b93c4", "metadata": { "id": "d65b93c4" }, "source": [ "## References\n", "- Cecil, D. J., and T. Chronis, 2018: Polarization-corrected temperatures for 10-, 19-, 37-, and 89-GHz passive microwave frequencies. J. Appl. Meteor. Climatol., 57, 2249–2265, https://doi.org/10.1175/JAMC-D-18-0022.1." ] }, { "cell_type": "markdown", "id": "0b4beeaa", "metadata": { "id": "0b4beeaa" }, "source": [ "## Metadata\n", "- Language / package(s)\n", " - Python\n", " - tcprimedapi\n", " - netCDF4\n", " - scipy\n", " - matplotlib\n", "- Domain\n", " - NOAA\n", " - NASA\n", " - JTWC\n", "- Application keywords\n", " - Satellite passive microwave\n", " - Timeseries\n", "- Geophysical keywords\n", " - Tropical cyclones\n", " - Convection" ] }, { "cell_type": "markdown", "id": "4120c173", "metadata": { "id": "5c443693" }, "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": "918a0cbe", "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": false } }, "nbformat": 4, "nbformat_minor": 5 }