{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Correct reflectivity attenuation\n\nIn this example the reflectivity attenuation is calculated and then corrected\nfor a polarimetric radar using a Z-PHI method implemented in Py-ART.\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "print(__doc__)\n\n# Author: Jonathan J. Helmus (jhelmus@anl.gov)\n# License: BSD 3 clause\n\nimport matplotlib.pyplot as plt\n\nimport pyart\n\nfile = pyart.testing.get_test_data(\"sgpcsaprsurcmacI7.c0.20110520.095101.nc\")\n\n# read in the data\nradar = pyart.io.read_cfradial(file)\n\n# remove existing corrections\nradar.fields.pop(\"specific_attenuation\")\nradar.fields.pop(\"corrected_reflectivity_horizontal\")\n\n# perform attenuation correction\nspec_at, cor_z = pyart.correct.calculate_attenuation(\n radar,\n 0,\n refl_field=\"reflectivity_horizontal\",\n ncp_field=\"norm_coherent_power\",\n rhv_field=\"copol_coeff\",\n phidp_field=\"proc_dp_phase_shift\",\n)\nradar.add_field(\"specific_attenuation\", spec_at)\nradar.add_field(\"corrected_reflectivity_horizontal\", cor_z)\n\n# create the plot\nfig = plt.figure(figsize=(15, 5))\nax1 = fig.add_subplot(131)\ndisplay = pyart.graph.RadarDisplay(radar)\ndisplay.plot(\n \"reflectivity_horizontal\",\n 0,\n ax=ax1,\n vmin=0,\n vmax=60.0,\n colorbar_label=\"\",\n title=\"Raw Reflectivity\",\n)\n\nax2 = fig.add_subplot(132)\ndisplay.plot(\n \"specific_attenuation\",\n 0,\n vmin=0,\n vmax=1.0,\n colorbar_label=\"\",\n ax=ax2,\n title=\"Specific Attenuation\",\n)\n\nax3 = fig.add_subplot(133)\ndisplay = pyart.graph.RadarDisplay(radar)\ndisplay.plot(\n \"corrected_reflectivity_horizontal\",\n 0,\n vmin=0,\n vmax=60.0,\n colorbar_label=\"\",\n ax=ax3,\n title=\"Corrected Reflectivity\",\n)\n\nplt.suptitle(\"Attenuation correction using Py-ART\", fontsize=16)\nplt.show()" ] } ], "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.13.0" } }, "nbformat": 4, "nbformat_minor": 0 }