.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/correct/plot_attenuation.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_attenuation.py: ================================ Correct reflectivity attenuation ================================ In this example the reflectivity attenuation is calculated and then corrected for a polarimetric radar using a Z-PHI method implemented in Py-ART. .. GENERATED FROM PYTHON SOURCE LINES 10-80 .. image-sg:: /examples/correct/images/sphx_glr_plot_attenuation_001.png :alt: Attenuation correction using Py-ART, Raw Reflectivity, Specific Attenuation, Corrected Reflectivity :srcset: /examples/correct/images/sphx_glr_plot_attenuation_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /store/msrad/utils/anaconda3-wolfensb/envs/pyart_new/lib/python3.12/site-packages/numpy/_core/fromnumeric.py:820: UserWarning: Warning: 'partition' will ignore the 'mask' of the MaskedArray. a.partition(kth, axis=axis, kind=kind, order=order) | .. code-block:: Python print(__doc__) # Author: Jonathan J. Helmus (jhelmus@anl.gov) # License: BSD 3 clause import matplotlib.pyplot as plt import pyart file = pyart.testing.get_test_data("sgpcsaprsurcmacI7.c0.20110520.095101.nc") # read in the data radar = pyart.io.read_cfradial(file) # remove existing corrections radar.fields.pop("specific_attenuation") radar.fields.pop("corrected_reflectivity_horizontal") # perform attenuation correction spec_at, cor_z = pyart.correct.calculate_attenuation( radar, 0, refl_field="reflectivity_horizontal", ncp_field="norm_coherent_power", rhv_field="copol_coeff", phidp_field="proc_dp_phase_shift", ) radar.add_field("specific_attenuation", spec_at) radar.add_field("corrected_reflectivity_horizontal", cor_z) # create the plot fig = plt.figure(figsize=(15, 5)) ax1 = fig.add_subplot(131) display = pyart.graph.RadarDisplay(radar) display.plot( "reflectivity_horizontal", 0, ax=ax1, vmin=0, vmax=60.0, colorbar_label="", title="Raw Reflectivity", ) ax2 = fig.add_subplot(132) display.plot( "specific_attenuation", 0, vmin=0, vmax=1.0, colorbar_label="", ax=ax2, title="Specific Attenuation", ) ax3 = fig.add_subplot(133) display = pyart.graph.RadarDisplay(radar) display.plot( "corrected_reflectivity_horizontal", 0, vmin=0, vmax=60.0, colorbar_label="", ax=ax3, title="Corrected Reflectivity", ) plt.suptitle("Attenuation correction using Py-ART", fontsize=16) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 13.376 seconds) .. _sphx_glr_download_examples_correct_plot_attenuation.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_attenuation.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_attenuation.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_attenuation.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_