{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Reading NEXRAD Data from the AWS Cloud\n\nWithin this example, we show how you can remotely access Next Generation Weather Radar (NEXRAD) Data from Amazon Web Services\nand plot quick looks of the datasets.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "print(__doc__)\n\n# Author: Max Grover (mgrover@anl.gov)\n# License: BSD 3 clause\n\nimport cartopy.crs as ccrs\nimport matplotlib.pyplot as plt\n\nimport pyart" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Read NEXRAD Level 2 Data\n\nLet's start first with NEXRAD Level 2 data, which is ground-based radar data collected\nby the National Oceanic and Atmospheric Administration (NOAA), as a part of the National Weather Service\n### Configure our Filepath for NEXRAD Level 2 Data\nWe will access data from the **unidata-nexrad-level2** bucket, with the data organized as:\n\n ``s3://unidata-nexrad-level2/year/month/date/radarsite/{radarsite}{year}{month}{date}_{hour}{minute}{second}_V06``\n\nWhere in our case, we are using a sample data file from Houston, Texas (KHGX)\non March 22, 2022, at 1201:25 UTC. This means our path would look like:\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "aws_nexrad_level2_file = (\n \"s3://unidata-nexrad-level2/2022/03/22/KHGX/KHGX20220322_120125_V06\"\n)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can use the **pyart.io.read_nexrad_archive** module to access our data, passing in the filepath.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "radar = pyart.io.read_nexrad_archive(aws_nexrad_level2_file)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's take a look at a summary of what fields are available.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "list(radar.fields)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's plot the reflectivity/velocity fields as a first step to investigating our dataset.\n\nNote: the reflectivity and velocity fields are in different sweeps, so we will need to specify which sweep to plot in each plot.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig = plt.figure(figsize=(12, 4))\ndisplay = pyart.graph.RadarMapDisplay(radar)\n\nax = plt.subplot(121, projection=ccrs.PlateCarree())\n\ndisplay.plot_ppi_map(\n \"reflectivity\",\n sweep=0,\n ax=ax,\n colorbar_label=\"Equivalent Relectivity ($Z_{e}$) \\n (dBZ)\",\n vmin=-20,\n vmax=60,\n)\n\nax = plt.subplot(122, projection=ccrs.PlateCarree())\n\ndisplay.plot_ppi_map(\n \"velocity\",\n sweep=1,\n ax=ax,\n colorbar_label=\"Radial Velocity ($V_{r}$) \\n (m/s)\",\n vmin=-70,\n vmax=70,\n)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Within this plot, we see that the velocity data still has regions that are folded, indicating the dataset has not yet been dealiased.\n\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Read NEXRAD Level 3 Data\nWe can also access NEXRAD Level 3 data using Py-ART!\n\nThese datasets have had additional data quality processes applied, including dealiasing.\n\nEach Level 3 data field is stored in **separate file** - in this example, we will look at the reflectivity and\nvelocity field at the lowest levels. These correspond to the following variable names:\n\n- ``N0U`` - Velocity at the lowest level\n- ``NOQ`` - Reflectivity at the lowest level\n\nThese datasets are also in a different bucket (**unidata-nexrad-level3**), and the files are in a **flat directory structure**\nusing the following naming convention:\n\n ``s3://unidata-nexrad-level3/{radarsite}_{field}_{year}_{month}_{date}_{hour}_{minute}_{second}``\n\nFor example, we can look at data from that same time as the NEXRAD Level 2 data used previously (March 22, 2022 at 1201 UTC)\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "aws_nexrad_level3_velocity_file = (\n \"s3://unidata-nexrad-level3/HGX_N0U_2022_03_22_12_01_25\"\n)\naws_nexrad_level3_reflectivity_file = (\n \"s3://unidata-nexrad-level3/HGX_N0Q_2022_03_22_12_01_25\"\n)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Read our Data using **pyart.io.read_nexrad_level3**\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "radar_level3_velocity = pyart.io.read_nexrad_level3(aws_nexrad_level3_velocity_file)\nradar_level3_reflectivity = pyart.io.read_nexrad_level3(\n aws_nexrad_level3_reflectivity_file\n)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's confirm that each radar object has a single field:\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "print(\n \"velocity radar object: \",\n list(radar_level3_velocity.fields),\n \"reflectivity radar object: \",\n list(radar_level3_reflectivity.fields),\n)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Plot a Quick Look of our NEXRAD Level 3 Data\n\nLet's plot the reflectivity/velocity fields as a first step to investigating our dataset.\n\nNote: the reflectivity and velocity fields are in different radars, so we need to setup different displays.\n\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "fig = plt.figure(figsize=(12, 4))\nreflectivity_display = pyart.graph.RadarMapDisplay(radar_level3_reflectivity)\n\nax = plt.subplot(121, projection=ccrs.PlateCarree())\n\nreflectivity_display.plot_ppi_map(\n \"reflectivity\",\n ax=ax,\n colorbar_label=\"Equivalent Relectivity ($Z_{e}$) \\n (dBZ)\",\n vmin=-20,\n vmax=60,\n)\n\nvelocity_display = pyart.graph.RadarMapDisplay(radar_level3_velocity)\n\nax = plt.subplot(122, projection=ccrs.PlateCarree())\n\nvelocity_display.plot_ppi_map(\n \"velocity\",\n ax=ax,\n colorbar_label=\"Radial Velocity ($V_{r}$) \\n (m/s)\",\n vmin=-70,\n vmax=70,\n)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.14.3" } }, "nbformat": 4, "nbformat_minor": 0 }