Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Add cfradial2 read example #1700

Merged
merged 7 commits into from
Dec 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ADD: Add cfradial2 example
mgrover1 committed Dec 3, 2024

Verified

This commit was signed with the committer’s verified signature.
frapell Franco Pellegrini
commit 564e81b3aee43c1e178d41f9beb5c4ef1fed1413
28 changes: 28 additions & 0 deletions examples/io/plot_read_cfradial2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
==========================================================
Read and Plot Cfradial2/FM301 data Using Xradar and Py-ART
==========================================================

An example which uses xradar and Py-ART to read and plot Cfradial2/FM301 data.

"""

# Author: Max Grover (mgrover@anl.gov)
# License: BSD 3 clause


import xradar as xd

import pyart
from pyart.testing import get_test_data

# Locate the test data and read in using xradar
filename = get_test_data("cfrad2.20080604_002217_000_SPOL_v36_SUR.nc")
tree = xd.io.open_cfradial1_datatree(filename)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be cfradial2? Or does xradar handle both for that datatree?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it in the example - we can use xarray open datatree directly!


# Give the tree Py-ART radar methods
radar = tree.pyart.to_radar()

# Plot the Reflectivity Field (corrected_reflectivity_horizontal)
display = pyart.graph.RadarMapDisplay(radar)
display.plot_ppi("DBZ", cmap="pyart_ChaseSpectral", vmin=-20, vmax=70)