Skip to content

Commit 038b65b

Browse files
committed
Add test for checking barb magnitudes before plotting
1 parent 58e229a commit 038b65b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/plots/test_declarative.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,30 @@ def test_no_field_error_barbs():
565565
barbs.draw()
566566

567567

568+
def test_too_big_error_barbs():
569+
"""Make sure we get an error when we are about to draw too many pennants."""
570+
data = xr.open_dataset(get_test_data('narr_example.nc', as_file_obj=False)).squeeze()
571+
572+
bp = BarbPlot()
573+
bp.data = data
574+
bp.field = ['u_wind', 'v_wind']
575+
bp.level = 500
576+
bp.scale = 1e4
577+
bp.skip = [8, 8]
578+
579+
mp = MapPanel()
580+
mp.layout = (1, 1, 1)
581+
mp.area = (-100, -70, 30, 45)
582+
mp.plots = [bp]
583+
584+
pc = PanelContainer()
585+
pc.size = (10, 8)
586+
pc.panels = [mp]
587+
588+
with pytest.raises(ValueError):
589+
pc.draw()
590+
591+
568592
@pytest.mark.mpl_image_compare(remove_text=True, tolerance=0.377)
569593
def test_projection_object(ccrs, cfeature):
570594
"""Test that we can pass a custom map projection."""

0 commit comments

Comments
 (0)