Skip to content

Commit

Permalink
Merge pull request #38 from zssherman/main
Browse files Browse the repository at this point in the history
DOC: Add example for showing colormaps on a real case.
  • Loading branch information
zssherman authored Jan 22, 2025
2 parents 35b077f + a1fbf2c commit 6824a9f
Show file tree
Hide file tree
Showing 2 changed files with 77 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
76 changes: 76 additions & 0 deletions examples/plot_convection_cvd_colormaps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
"""
=========================================================
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

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

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 6824a9f

Please sign in to comment.