Skip to content

Commit

Permalink
add testing images
Browse files Browse the repository at this point in the history
  • Loading branch information
jukent committed May 8, 2024
1 parent 9a0b70c commit 20a4c27
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 71 deletions.
Binary file added baseline/test_add_bias_legend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added baseline/test_add_contours.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added baseline/test_add_corr_grid.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added baseline/test_add_legend.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added baseline/test_add_model_name.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added baseline/test_add_model_set.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 14 additions & 71 deletions tests/test_taylor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,13 @@
import matplotlib.pyplot as plt
import numpy as np

import geocat.viz as gv
from geocat.viz.taylor import TaylorDiagram


@pytest.mark.mpl_image_compare
def test_taylor_ex():
@pytest.mark.mpl_image_compare(tolerance=0.02, remove_text=True, style='default')
def test_add_model_set():
fig = plt.figure(figsize=(10, 10))
taylor = gv.TaylorDiagram(fig=fig, label='REF')

taylor.add_corr_grid(np.array([0.6, 0.9]))

taylor.add_model_set(
[1.230, 0.988, 1.092],
[0.958, 0.973, 0.740],
percent_bias_on=
True, # indicate marker and size to be plotted based on bias_array
bias_array=[2.7, -1.5, 17.31], # specify bias array
color='red',
label='Model A',
fontsize=16)

taylor.add_model_set([1.129, 0.996, 1.016], [0.963, 0.975, 0.801],
percent_bias_on=True,
bias_array=[1.7, 2.5, -17.31],
color='blue',
label='Model B',
fontsize=16)

taylor.add_model_name(['a', 'b', 'c'], fontsize=16)

taylor.add_legend(fontsize=16)

taylor.add_bias_legend()

taylor.add_contours(levels=np.arange(0, 1.1, 0.25),
colors='lightgrey',
linewidths=0.5)
return fig


@pytest.mark.mpl_image_compare
def test_add_model_Set():
fig = plt.figure(figsize=(10, 10))
taylor = gv.TaylorDiagram(fig=fig, label='REF')
taylor = TaylorDiagram(fig=fig, label='REF')

taylor.add_model_set([1.230, 0.988, 1.092], [0.958, 0.973, 0.740],
color='red',
Expand All @@ -55,10 +19,10 @@ def test_add_model_Set():
return fig


@pytest.mark.mpl_image_compare
@pytest.mark.mpl_image_compare(tolerance=0.02, remove_text=True, style='default')
def test_add_legend():
fig = plt.figure(figsize=(10, 10))
taylor = gv.TaylorDiagram(fig=fig, label='REF')
taylor = TaylorDiagram(fig=fig, label='REF')

taylor.add_model_set(
[1.230, 0.988, 1.092],
Expand All @@ -82,10 +46,10 @@ def test_add_legend():
return fig


@pytest.mark.mpl_image_compare
@pytest.mark.mpl_image_compare(tolerance=0.02, remove_text=True, style='default')
def test_add_bias_legend():
fig = plt.figure(figsize=(10, 10))
taylor = gv.TaylorDiagram(fig=fig, label='REF')
taylor = TaylorDiagram(fig=fig, label='REF')

taylor.add_model_set(
[1.230, 0.988, 1.092],
Expand All @@ -102,10 +66,10 @@ def test_add_bias_legend():
return fig


@pytest.mark.mpl_image_compare
@pytest.mark.mpl_image_compare(tolerance=0.02, remove_text=True, style='default')
def test_add_model_name():
fig = plt.figure(figsize=(10, 10))
taylor = gv.TaylorDiagram(fig=fig, label='REF')
taylor = TaylorDiagram(fig=fig, label='REF')

taylor.add_model_set(
[1.230, 0.988, 1.092],
Expand All @@ -122,31 +86,10 @@ def test_add_model_name():
return fig


@pytest.mark.mpl_image_compare
def test_taylor_ex():
fig = plt.figure(figsize=(10, 10))
taylor = gv.TaylorDiagram(fig=fig, label='REF')

taylor.add_model_set(
[1.230, 0.988, 1.092],
[0.958, 0.973, 0.740],
percent_bias_on=
True, # indicate marker and size to be plotted based on bias_array
bias_array=[2.7, -1.5, 17.31], # specify bias array
color='red',
label='Model A',
fontsize=16)

taylor.add_contours(levels=np.arange(0, 1.1, 0.25),
colors='lightgrey',
linewidths=0.5)
return fig


@pytest.mark.mpl_image_compare
@pytest.mark.mpl_image_compare(tolerance=0.02, remove_text=True, style='default')
def test_add_corr_grid():
fig = plt.figure(figsize=(10, 10))
taylor = gv.TaylorDiagram(fig=fig, label='REF')
taylor = TaylorDiagram(fig=fig, label='REF')

taylor.add_corr_grid(np.array([0.6, 0.9]))

Expand All @@ -163,10 +106,10 @@ def test_add_corr_grid():
return fig


@pytest.mark.mpl_image_compare
@pytest.mark.mpl_image_compare(tolerance=0.02, remove_text=True, style='default')
def test_add_contours():
fig = plt.figure(figsize=(10, 10))
taylor = gv.TaylorDiagram(fig=fig, label='REF')
taylor = TaylorDiagram(fig=fig, label='REF')

taylor.add_model_set(
[1.230, 0.988, 1.092],
Expand Down

0 comments on commit 20a4c27

Please sign in to comment.