.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/io/plot_nexrad_data_aws.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_io_plot_nexrad_data_aws.py: ====================================== Reading NEXRAD Data from the AWS Cloud ====================================== Within this example, we show how you can remotely access Next Generation Weather Radar (NEXRAD) Data from Amazon Web Services and plot quick looks of the datasets. .. GENERATED FROM PYTHON SOURCE LINES 10-20 .. code-block:: Python print(__doc__) # Author: Max Grover (mgrover@anl.gov) # License: BSD 3 clause import cartopy.crs as ccrs import matplotlib.pyplot as plt import pyart .. GENERATED FROM PYTHON SOURCE LINES 21-33 Read NEXRAD Level 2 Data ------------------------ Let's start first with NEXRAD Level 2 data, which is ground-based radar data collected by the National Oceanic and Atmospheric Administration (NOAA), as a part of the National Weather Service ### Configure our Filepath for NEXRAD Level 2 Data We will access data from the **noaa-nexrad-level2** bucket, with the data organized as: ``s3://noaa-nexrad-level2/year/month/date/radarsite/{radarsite}{year}{month}{date}_{hour}{minute}{second}_V06`` Where in our case, we are using a sample data file from Houston, Texas (KHGX) on March 22, 2022, at 1201:25 UTC. This means our path would look like: .. GENERATED FROM PYTHON SOURCE LINES 33-38 .. code-block:: Python aws_nexrad_level2_file = ( "s3://noaa-nexrad-level2/2022/03/22/KHGX/KHGX20220322_120125_V06" ) .. GENERATED FROM PYTHON SOURCE LINES 39-40 We can use the **pyart.io.read_nexrad_archive** module to access our data, passing in the filepath. .. GENERATED FROM PYTHON SOURCE LINES 40-43 .. code-block:: Python radar = pyart.io.read_nexrad_archive(aws_nexrad_level2_file) .. GENERATED FROM PYTHON SOURCE LINES 44-45 Let's take a look at a summary of what fields are available. .. GENERATED FROM PYTHON SOURCE LINES 45-48 .. code-block:: Python list(radar.fields) .. rst-class:: sphx-glr-script-out .. code-block:: none ['cross_correlation_ratio', 'spectrum_width', 'clutter_filter_power_removed', 'differential_phase', 'velocity', 'differential_reflectivity', 'reflectivity'] .. GENERATED FROM PYTHON SOURCE LINES 49-52 Let's plot the reflectivity/velocity fields as a first step to investigating our dataset. Note: the reflectivity and velocity fields are in different sweeps, so we will need to specify which sweep to plot in each plot. .. GENERATED FROM PYTHON SOURCE LINES 52-78 .. code-block:: Python fig = plt.figure(figsize=(12, 4)) display = pyart.graph.RadarMapDisplay(radar) ax = plt.subplot(121, projection=ccrs.PlateCarree()) display.plot_ppi_map( "reflectivity", sweep=0, ax=ax, colorbar_label="Equivalent Relectivity ($Z_{e}$) \n (dBZ)", vmin=-20, vmax=60, ) ax = plt.subplot(122, projection=ccrs.PlateCarree()) display.plot_ppi_map( "velocity", sweep=1, ax=ax, colorbar_label="Radial Velocity ($V_{r}$) \n (m/s)", vmin=-70, vmax=70, ) .. image-sg:: /examples/io/images/sphx_glr_plot_nexrad_data_aws_001.png :alt: KHGX 0.5 Deg. 2022-03-22T12:01:25Z Equivalent reflectivity factor, KHGX 0.5 Deg. 2022-03-22T12:01:43Z Radial velocity of scatterers away from instrument :srcset: /examples/io/images/sphx_glr_plot_nexrad_data_aws_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 79-80 Within this plot, we see that the velocity data still has regions that are folded, indicating the dataset has not yet been dealiased. .. GENERATED FROM PYTHON SOURCE LINES 82-100 Read NEXRAD Level 3 Data ------------------------ We can also access NEXRAD Level 3 data using Py-ART! These datasets have had additional data quality processes applied, including dealiasing. Each Level 3 data field is stored in **separate file** - in this example, we will look at the reflectivity and velocity field at the lowest levels. These correspond to the following variable names: - ``N0U`` - Velocity at the lowest level - ``NOQ`` - Reflectivity at the lowest level These datasets are also in a different bucket (**unidata-nexrad-level3**), and the files are in a **flat directory structure** using the following naming convention: ``s3://unidata-nexrad-level3/{radarsite}_{field}_{year}_{month}_{date}_{hour}_{minute}_{second}`` For example, we can look at data from that same time as the NEXRAD Level 2 data used previously (March 22, 2022 at 1201 UTC) .. GENERATED FROM PYTHON SOURCE LINES 100-108 .. code-block:: Python aws_nexrad_level3_velocity_file = ( "s3://unidata-nexrad-level3/HGX_N0U_2022_03_22_12_01_25" ) aws_nexrad_level3_reflectivity_file = ( "s3://unidata-nexrad-level3/HGX_N0Q_2022_03_22_12_01_25" ) .. GENERATED FROM PYTHON SOURCE LINES 109-110 Read our Data using **pyart.io.read_nexrad_level3** .. GENERATED FROM PYTHON SOURCE LINES 110-116 .. code-block:: Python radar_level3_velocity = pyart.io.read_nexrad_level3(aws_nexrad_level3_velocity_file) radar_level3_reflectivity = pyart.io.read_nexrad_level3( aws_nexrad_level3_reflectivity_file ) .. GENERATED FROM PYTHON SOURCE LINES 117-118 Let's confirm that each radar object has a single field: .. GENERATED FROM PYTHON SOURCE LINES 118-126 .. code-block:: Python print( "velocity radar object: ", list(radar_level3_velocity.fields), "reflectivity radar object: ", list(radar_level3_reflectivity.fields), ) .. rst-class:: sphx-glr-script-out .. code-block:: none velocity radar object: ['velocity'] reflectivity radar object: ['reflectivity'] .. GENERATED FROM PYTHON SOURCE LINES 127-132 Plot a Quick Look of our NEXRAD Level 3 Data Let's plot the reflectivity/velocity fields as a first step to investigating our dataset. Note: the reflectivity and velocity fields are in different radars, so we need to setup different displays. .. GENERATED FROM PYTHON SOURCE LINES 132-157 .. code-block:: Python fig = plt.figure(figsize=(12, 4)) reflectivity_display = pyart.graph.RadarMapDisplay(radar_level3_reflectivity) ax = plt.subplot(121, projection=ccrs.PlateCarree()) reflectivity_display.plot_ppi_map( "reflectivity", ax=ax, colorbar_label="Equivalent Relectivity ($Z_{e}$) \n (dBZ)", vmin=-20, vmax=60, ) velocity_display = pyart.graph.RadarMapDisplay(radar_level3_velocity) ax = plt.subplot(122, projection=ccrs.PlateCarree()) velocity_display.plot_ppi_map( "velocity", ax=ax, colorbar_label="Radial Velocity ($V_{r}$) \n (m/s)", vmin=-70, vmax=70, ) .. image-sg:: /examples/io/images/sphx_glr_plot_nexrad_data_aws_002.png :alt: 0.5 Deg. 2022-03-22T12:01:25Z Equivalent reflectivity factor, 0.5 Deg. 2022-03-22T12:01:25Z Radial velocity of scatterers away from instrument :srcset: /examples/io/images/sphx_glr_plot_nexrad_data_aws_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 14.504 seconds) .. _sphx_glr_download_examples_io_plot_nexrad_data_aws.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_nexrad_data_aws.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_nexrad_data_aws.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_