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

ENH: Update the cb_friendly to match cvd_friendly. #820

Merged
merged 2 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
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
22 changes: 11 additions & 11 deletions act/plotting/timeseriesdisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def plot(
cbar_h_adjust=None,
y_axis_flag_meanings=False,
colorbar_labels=None,
cb_friendly=False,
cvd_friendly=False,
match_line_label_color=False,
**kwargs,
):
Expand Down Expand Up @@ -412,8 +412,8 @@ def plot(
1: {'text': 'Liquid', 'color': 'green'},
2: {'text': 'Ice', 'color': 'blue'},
3: {'text': 'Mixed phase', 'color': 'purple'}}
cb_friendly : boolean
Set to true if you want to use the integrated colorblind friendly
cvd_friendly : boolean
Set to true if you want to use the integrated color vision deficiency (CVD) friendly
colors for green/red based on the Homeyer colormap.
match_line_label_color : boolean
Will set the y label to match the line color in the plot. This
Expand All @@ -440,7 +440,7 @@ def plot(
if y_axis_flag_meanings:
kwargs['linestyle'] = ''

if cb_friendly:
if cvd_friendly:
cmap = 'HomeyerRainbow'
assessment_overplot_category_color['Bad'] = (
0.9285714285714286,
Expand Down Expand Up @@ -1278,7 +1278,7 @@ def time_height_scatter(
cb_label=None,
subplot_index=(0,),
plot_alt_field=False,
cb_friendly=False,
cvd_friendly=False,
day_night_background=False,
set_title=None,
**kwargs,
Expand Down Expand Up @@ -1309,7 +1309,7 @@ def time_height_scatter(
The index of the subplot to set the x range of.
plot_alt_field : boolean
Set to true to plot the altitude field on the secondary y-axis
cb_friendly : boolean
cvd_friendly : boolean
If set to True will use the Homeyer colormap
day_night_background : boolean
If set to True will plot the day_night_background
Expand Down Expand Up @@ -1339,7 +1339,7 @@ def time_height_scatter(
self.axes = np.array([plt.axes()])
self.fig.add_axes(self.axes[0])

if cb_friendly:
if cvd_friendly:
cmap = 'HomeyerRainbow'

ax = self.axes[subplot_index]
Expand Down Expand Up @@ -1436,7 +1436,7 @@ def qc_flag_block_plot(
assessment_color=None,
edgecolor='face',
set_shading='auto',
cb_friendly=False,
cvd_friendly=False,
**kwargs,
):
"""
Expand Down Expand Up @@ -1465,8 +1465,8 @@ def qc_flag_block_plot(
set_shading : string
Option to to set the matplotlib.pcolormesh shading parameter.
Default to 'auto'
cb_friendly : boolean
Set to true if you want to use the integrated colorblind friendly
cvd_friendly : boolean
Set to true if you want to use the integrated color vision deficiency (CVD) friendly
colors for green/red based on the Homeyer colormap
**kwargs : keyword arguments
The keyword arguments for :func:`plt.broken_barh`.
Expand All @@ -1482,7 +1482,7 @@ def qc_flag_block_plot(
'Not Failing': 'green',
'Acceptable': 'green',
}
if cb_friendly:
if cvd_friendly:
color_lookup['Bad'] = (0.9285714285714286, 0.7130901016453677, 0.7130901016453677)
color_lookup['Incorrect'] = (0.9285714285714286, 0.7130901016453677, 0.7130901016453677)
color_lookup['Not Failing'] = (0.0, 0.4240129715562796, 0.4240129715562796)
Expand Down
2 changes: 1 addition & 1 deletion examples/io/plot_sodar.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@

# Plot shear with a wind barb overlay, while using a color vision
# deficiency (CVD) colormap.
display.plot('shear', subplot_index=(0,), cb_friendly=True)
display.plot('shear', subplot_index=(0,), cvd_friendly=True)
display.plot_barbs_from_spd_dir('speed', 'dir')
plt.show()
4 changes: 2 additions & 2 deletions examples/plotting/plot_ceil.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
# Adjust ceilometer data for plotting
ceil_ds = act.corrections.ceil.correct_ceil(ceil_ds, -9999.0)

# Plot up ceilometer backscatter using HomeyerRainbow cb friendly colormap
# Plot up ceilometer backscatter using HomeyerRainbow CVD friendly colormap
# The same could be done with keyword 'cmap='HomeyerRainbow'
display = act.plotting.TimeSeriesDisplay(ceil_ds, subplot_shape=(1,), figsize=(15, 5))
display.plot('backscatter', subplot_index=(0,), cb_friendly=True)
display.plot('backscatter', subplot_index=(0,), cvd_friendly=True)
plt.show()
2 changes: 1 addition & 1 deletion examples/plotting/plot_time_height_scatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Create scatter plots of the sonde data
display = act.plotting.TimeSeriesDisplay(ds, figsize=(7, 6), subplot_shape=(2,))
display.time_height_scatter('tdry', plot_alt_field=True, subplot_index=(0,))
display.time_height_scatter('rh', subplot_index=(1,), cb_friendly=True, day_night_background=True)
display.time_height_scatter('rh', subplot_index=(1,), cvd_friendly=True, day_night_background=True)
plt.tight_layout()
ds.close()

Expand Down
8 changes: 4 additions & 4 deletions examples/qc/plot_qc_bsrn.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
display = act.plotting.TimeSeriesDisplay(ds, figsize=(15, 10), subplot_shape=(2,))

# Plot radiation data in top plot
display.plot(variable, subplot_index=(0,), day_night_background=True, cb_friendly=True)
display.plot(variable, subplot_index=(0,), day_night_background=True, cvd_friendly=True)

# Plot ancillary QC data in bottom plot
display.qc_flag_block_plot(variable, subplot_index=(1,), cb_friendly=True)
display.qc_flag_block_plot(variable, subplot_index=(1,), cvd_friendly=True)
plt.show()

# Add initial BSRN QC tests to ancillary QC varialbles. Use defualts for
Expand Down Expand Up @@ -74,9 +74,9 @@
subplot_index=(0,),
day_night_background=True,
assessment_overplot=True,
cb_friendly=True,
cvd_friendly=True,
)

# Plot ancillary QC data in bottom plot
display.qc_flag_block_plot(variable, subplot_index=(1,), cb_friendly=True)
display.qc_flag_block_plot(variable, subplot_index=(1,), cvd_friendly=True)
plt.show()
2 changes: 1 addition & 1 deletion examples/templates/notebook_and_blog_template.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@
"\n",
"# Plot shear with a wind barb overlay, while using a color vision\n",
"# deficiency (CVD) colormap.\n",
"display.plot('shear', subplot_index=(0,), cb_friendly=True)\n",
"display.plot('shear', subplot_index=(0,), cvd_friendly=True)\n",
"display.plot_barbs_from_spd_dir('speed', 'dir')\n",
"plt.show()"
]
Expand Down
6 changes: 3 additions & 3 deletions tests/plotting/test_timeseriesdisplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ def test_time_height_scatter2():
{'sgpsondewnpnC1.b1': sonde_ds}, figsize=(8, 10), subplot_shape=(2,)
)
display.time_height_scatter(
'tdry', day_night_background=True, subplot_index=(0,), cb_friendly=True, plot_alt_field=True
'tdry', day_night_background=True, subplot_index=(0,), cvd_friendly=True, plot_alt_field=True
)
display.time_height_scatter(
'rh', day_night_background=True, subplot_index=(1,), cb_friendly=True
'rh', day_night_background=True, subplot_index=(1,), cvd_friendly=True
)

sonde_ds.close()
Expand Down Expand Up @@ -310,7 +310,7 @@ def test_qc_flag_block_plot():
display.plot('surface_albedo_mfr_narrowband_10m', force_line_plot=True, labels=True)

display.qc_flag_block_plot(
'surface_albedo_mfr_narrowband_10m', subplot_index=(1,), cb_friendly=True
'surface_albedo_mfr_narrowband_10m', subplot_index=(1,), cvd_friendly=True
)

ds.close()
Expand Down
Loading