.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/correct/plot_zdr_check.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_zdr_check.py: ZDR Bias Calculation --------------------- This example shows how to calculate the ZDR bias from VPT/Birdbath scans. The technique here uses a vertically pointing scan in regions of light rain. In these regions, raindrops should be approximately spherical and therefore their ZDR near zero. Therefore, we want the average ZDR in these regions. This code applies reflectivity and cross correlation ratio-based thresholds to the ZDR bias calculation to ensure that we are taking the average ZDR in light rain. .. GENERATED FROM PYTHON SOURCE LINES 13-51 .. image-sg:: /examples/correct/images/sphx_glr_plot_zdr_check_001.png :alt: plot zdr check :srcset: /examples/correct/images/sphx_glr_plot_zdr_check_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Zdr Bias: 2.69 | .. code-block:: Python import matplotlib.pyplot as plt from open_radar_data import DATASETS import pyart # Read in example data filename = DATASETS.fetch("sgpxsaprcfrvptI4.a1.20200205.100827.nc") ds = pyart.io.read(filename) # Set up a typical filter for ZDR bias calculation in birdbath scan # Light rain and RhoHV near 1 ensures that raindrops are close to spherical # Therefore ZDR should be zero in these regions gatefilter = pyart.filters.GateFilter(ds) gatefilter.exclude_below("cross_correlation_ratio_hv", 0.995) gatefilter.exclude_above("cross_correlation_ratio_hv", 1) gatefilter.exclude_below("reflectivity", 10) gatefilter.exclude_above("reflectivity", 30) results = pyart.correct.calc_zdr_offset( ds, zdr_var="differential_reflectivity", gatefilter=gatefilter, height_range=(1000, 3000), ) print("Zdr Bias: " + "{:.2f}".format(results["bias"])) fig, ax = plt.subplots(1, 3, figsize=(8, 5)) ax[0].plot(results["profile_zdr"], results["range"]) ax[0].set_ylabel("Range (m)") ax[0].set_xlabel("Zdr (dB)") ax[1].plot(results["profile_reflectivity"], results["range"]) ax[1].set_xlabel("Zh (dBZ)") ax[2].plot(results["profile_cross_correlation_ratio_hv"], results["range"]) ax[2].set_xlabel("RhoHV ()") fig.tight_layout() plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.540 seconds) .. _sphx_glr_download_examples_correct_plot_zdr_check.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_zdr_check.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_zdr_check.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_zdr_check.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_