Skip to content

Commit

Permalink
DOC: Add example for showing colormaps on a real case.
Browse files Browse the repository at this point in the history
  • Loading branch information
zssherman committed Jan 22, 2025
1 parent 35b077f commit 968822e
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions ci/environment-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies:
- sphinx-gallery
- sphinx-copybutton
- sphinx<7.2
- arm_pyart
- pip
- pip:
- ablog
Expand Down
64 changes: 64 additions & 0 deletions examples/plot_convection_cvd_colormaps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
"""
=========================================================
Plotting a Convective System using CVD Friendly Colormaps
=========================================================
This is an example of using both HomeyerRainbow and ChaseSpectral CVD friendly
colormaps for a convective system in Oklahoma.
"""
print(__doc__)

# Author: Zach Sherman
# License: BSD 3 clause

from open_radar_data import DATASETS
import matplotlib.pyplot as plt
import pyart

import cmweather # noqa

######################################
# **Download and read in the data**
#
# First we will read in the example data from the repository open_radar_data
# by using a built in fetch function to download the data.

file = DATASETS.fetch("110635.nc")

# Read the data using pyart
radar = pyart.io.read(file)

# Apply a filter to remove ring artifact
gatefilter = pyart.filters.GateFilter(radar)
gatefilter.exclude_last_gates("reflectivity", n_gates=7)

######################################
# **Color Vision Deficiency (CVD) Friendly Colormap HomeyerRainbow**
#
# Let's visualize the HomeyerRainbow CVD friendly colormap for the reflectivity
# moment in our data.

# create the plot using RadarDisplay
display = pyart.graph.RadarDisplay(radar)
fig = plt.figure()
display.plot(
"reflectivity", 0, vmin=-16.0, vmax=64, title="PPI", cmap="HomeyerRainbow", gatefilter=gatefilter,
)
display.set_limits(ylim=[-150, 150], xlim=[-150, 150])
plt.show()

#######################################
# **Color Vision Deficiency (CVD) Friendly Colormap ChaseSpectral**
#
# Similar to the previous example, let's visualize the ChaseSpectral CVD
# friendly colormap

# create the plot using RadarDisplay
display = pyart.graph.RadarDisplay(radar)
fig = plt.figure()
display.plot(
"reflectivity", 0, vmin=-16.0, vmax=64, title="PPI", cmap="ChaseSpectral", gatefilter=gatefilter,
)
display.set_limits(ylim=[-150, 150], xlim=[-150, 150])
plt.show()

0 comments on commit 968822e

Please sign in to comment.