.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/correct/plot_dealias_rhi.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_correct_plot_dealias_rhi.py: ========================================== Dealias doppler velocities for an RHI file ========================================== In this example doppler velocities from range height indicator (RHI) scans are dealiased, using custom parameters with the region-based dealiasing algorithm in Py-ART. .. GENERATED FROM PYTHON SOURCE LINES 9-23 .. code-block:: Python print(__doc__) # Author: Max Grover (mgrover@anl.gov) import matplotlib.pyplot as plt from open_radar_data import DATASETS import pyart # Read data from the open-radar-data package file = DATASETS.fetch("cfrad.20211011_223602.712_to_20211011_223612.091_DOW8_RHI.nc") radar = pyart.io.read(file) .. GENERATED FROM PYTHON SOURCE LINES 24-27 **Apply the default parameters for dealiasing** Now let's apply the default region-based technique .. GENERATED FROM PYTHON SOURCE LINES 27-75 .. code-block:: Python # Retrieve the nyquist velocity from the first sweep nyq = radar.instrument_parameters["nyquist_velocity"]["data"][0] # Apply the dealiasing algorithm with default parameters velocity_dealiased = pyart.correct.dealias_region_based( radar, vel_field="VEL", nyquist_vel=nyq, ) # Add the field to the radar object radar.add_field("corrected_velocity", velocity_dealiased, replace_existing=True) # Visualize the output fig = plt.figure(figsize=(12, 4)) ax1 = fig.add_subplot(121) display = pyart.graph.RadarDisplay(radar) display.plot( "VEL", ax=ax1, vmin=-30, vmax=30, cmap="balance", title="Uncorrected Radial Velocity", ) cbar = display.cbs[0] # Modify the colorbar label and size cbar.set_label(label="Raw Radial Velocity ($V_{R}$) [m/s]", fontsize=12) plt.ylim(0, 10) plt.xlim(20, 60) ax2 = fig.add_subplot(122) display = pyart.graph.RadarDisplay(radar) display.plot( "corrected_velocity", ax=ax2, vmin=-30, vmax=30, cmap="balance", title="Corrected Radial Velocity", ) cbar = display.cbs[0] # Modify the colorbar label and size cbar.set_label(label="Corrected Radial Velocity ($V_{R}$) [m/s]", fontsize=12) plt.ylim(0, 10) plt.xlim(20, 60) .. image-sg:: /examples/correct/images/sphx_glr_plot_dealias_rhi_001.png :alt: Uncorrected Radial Velocity, Corrected Radial Velocity :srcset: /examples/correct/images/sphx_glr_plot_dealias_rhi_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none (20.0, 60.0) .. GENERATED FROM PYTHON SOURCE LINES 76-85 **Refining the technique** If we use the default configuration, notice how extreme the values are for the output. The algorithm keys on the small variations in the clear air returns, and results in much larger values than would be expected. It is considered best practice to apply a base-level of quality control here to improve the results. We can use velocity texture as a base level, where the noisier data will be removed. .. GENERATED FROM PYTHON SOURCE LINES 85-142 .. code-block:: Python # Calculate the velocity texture and add it to the radar object vel_texture = pyart.retrieve.calculate_velocity_texture( radar, vel_field="VEL", nyq=nyq, ) radar.add_field("velocity_texture", vel_texture, replace_existing=True) # Set up the gatefilter to be based on the velocity texture. gatefilter = pyart.filters.GateFilter(radar) gatefilter.exclude_above("velocity_texture", 6) # Dealias with the gatefilter and add the corrected field to the radar object velocity_dealiased = pyart.correct.dealias_region_based( radar, vel_field="VEL", nyquist_vel=nyq, gatefilter=gatefilter, ) radar.add_field("corrected_velocity", velocity_dealiased, replace_existing=True) # Visualize the output fig = plt.figure(figsize=(12, 4)) ax1 = fig.add_subplot(121) display = pyart.graph.RadarDisplay(radar) display.plot( "VEL", ax=ax1, vmin=-30, vmax=30, cmap="balance", title="Uncorrected Radial Velocity", ) cbar = display.cbs[0] # Modify the colorbar label and size cbar.set_label(label="Raw Radial Velocity ($V_{R}$) [m/s]", fontsize=12) plt.ylim(0, 10) plt.xlim(20, 60) ax2 = fig.add_subplot(122) display = pyart.graph.RadarDisplay(radar) display.plot( "corrected_velocity", ax=ax2, vmin=-30, vmax=30, cmap="balance", title="Corrected Radial Velocity", ) cbar = display.cbs[0] # Modify the colorbar label and size cbar.set_label(label="Corrected Radial Velocity ($V_{R}$) [m/s]", fontsize=12) plt.ylim(0, 10) plt.xlim(20, 60) .. image-sg:: /examples/correct/images/sphx_glr_plot_dealias_rhi_002.png :alt: Uncorrected Radial Velocity, Corrected Radial Velocity :srcset: /examples/correct/images/sphx_glr_plot_dealias_rhi_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none (20.0, 60.0) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 9.706 seconds) .. _sphx_glr_download_examples_correct_plot_dealias_rhi.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_dealias_rhi.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_dealias_rhi.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_dealias_rhi.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_