Skip to content

Commit

Permalink
Update tutorial and examples for new shade_cin call
Browse files Browse the repository at this point in the history
  • Loading branch information
zbruick committed Oct 24, 2019
1 parent bf977e4 commit 8f8b5f4
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion examples/Advanced_Sounding.py
Expand Up @@ -73,7 +73,7 @@
skew.plot(p, prof, 'k', linewidth=2)

# Shade areas of CAPE and CIN
skew.shade_cin(p, T, prof)
skew.shade_cin(p, T, Td, prof)
skew.shade_cape(p, T, prof)

# An example of a slanted line at constant T -- in this case the 0
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions src/metpy/plots/skewt.py
Expand Up @@ -666,7 +666,7 @@ def shade_area(self, y, x1, x2=0, which='both', **kwargs):
return self.ax.fill_betweenx(*arrs, **fill_args)

def shade_cape(self, p, t, t_parcel, **kwargs):
r"""Shade areas of convective available potential energy (CAPE).
r"""Shade areas of Convective Available Potential Energy (CAPE).
Shades areas where the parcel is warmer than the environment (areas of positive
buoyancy.
Expand Down Expand Up @@ -699,7 +699,7 @@ def shade_cape(self, p, t, t_parcel, **kwargs):
return self.shade_area(p, t_parcel, t, which='positive', **kwargs)

def shade_cin(self, p, t, dewpoint, t_parcel, limit_shading=True, **kwargs):
r"""Shade areas of convective inhibition (CIN).
r"""Shade areas of Convective INhibition (CIN).
Shades areas where the parcel is cooler than the environment (areas of negative
buoyancy. Has option to not shade negative area below the lifting condensation level
Expand Down
Binary file modified tests/plots/baseline/test_skewt_shade_area.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_skewt_shade_area_kwargs.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_skewt_shade_cape_cin.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/plots/baseline/test_skewt_wide_aspect_ratio.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 9 additions & 10 deletions tests/plots/test_skewt.py
Expand Up @@ -173,7 +173,7 @@ def test_profile():
return pressure, temperature, dewpoint, profile


@pytest.mark.mpl_image_compare(tolerance=.02, remove_text=True, style='default')
@pytest.mark.mpl_image_compare(tolerance=.033, remove_text=True, style='default')
def test_skewt_shade_cape_cin(test_profile):
"""Test shading CAPE and CIN on a SkewT plot."""
p, t, td, tp = test_profile
Expand All @@ -191,8 +191,7 @@ def test_skewt_shade_cape_cin(test_profile):
return fig


@pytest.mark.mpl_image_compare(tolerance={'2': 2.02}.get(MPL_VERSION, 0.02), remove_text=True,
style='default')
@pytest.mark.mpl_image_compare(tolerance=0.033, remove_text=True, style='default')
def test_skewt_shade_cape_cin_no_limit(test_profile):
"""Test shading CIN without limits."""
p, t, td, tp = test_profile
Expand All @@ -210,10 +209,10 @@ def test_skewt_shade_cape_cin_no_limit(test_profile):
return fig


@pytest.mark.mpl_image_compare(tolerance=0.02, remove_text=True, style='default')
@pytest.mark.mpl_image_compare(tolerance=0.033, remove_text=True, style='default')
def test_skewt_shade_area(test_profile):
"""Test shading areas on a SkewT plot."""
p, t, td, tp = test_profile
p, t, _, tp = test_profile

with matplotlib.rc_context({'axes.autolimit_mode': 'data'}):
fig = plt.figure(figsize=(9, 9))
Expand All @@ -229,7 +228,7 @@ def test_skewt_shade_area(test_profile):

def test_skewt_shade_area_invalid(test_profile):
"""Test shading areas on a SkewT plot."""
p, t, td, tp = test_profile
p, t, _, tp = test_profile
fig = plt.figure(figsize=(9, 9))
skew = SkewT(fig, aspect='auto')
skew.plot(p, t, 'r')
Expand All @@ -238,10 +237,10 @@ def test_skewt_shade_area_invalid(test_profile):
skew.shade_area(p, t, tp, which='positve')


@pytest.mark.mpl_image_compare(tolerance=0.02, remove_text=True, style='default')
@pytest.mark.mpl_image_compare(tolerance=0.033, remove_text=True, style='default')
def test_skewt_shade_area_kwargs(test_profile):
"""Test shading areas on a SkewT plot with kwargs."""
p, t, td, tp = test_profile
p, t, _, tp = test_profile

with matplotlib.rc_context({'axes.autolimit_mode': 'data'}):
fig = plt.figure(figsize=(9, 9))
Expand All @@ -255,10 +254,10 @@ def test_skewt_shade_area_kwargs(test_profile):
return fig


@pytest.mark.mpl_image_compare(tolerance=0, remove_text=True, style='default')
@pytest.mark.mpl_image_compare(tolerance=0.039, remove_text=True, style='default')
def test_skewt_wide_aspect_ratio(test_profile):
"""Test plotting a skewT with a wide aspect ratio."""
p, t, td, tp = test_profile
p, t, _, tp = test_profile

fig = plt.figure(figsize=(12.5, 3))
skew = SkewT(fig, aspect='auto')
Expand Down
4 changes: 2 additions & 2 deletions tutorials/upperair_soundings.py
Expand Up @@ -139,7 +139,7 @@
skew.plot(p, parcel_prof, 'k', linewidth=2)

# Shade areas of CAPE and CIN
skew.shade_cin(p, T, parcel_prof)
skew.shade_cin(p, T, Td, parcel_prof)
skew.shade_cape(p, T, parcel_prof)

# Plot a zero degree isotherm
Expand Down Expand Up @@ -182,7 +182,7 @@
skew.plot(p, parcel_prof, 'k', linewidth=2)

# Shade areas of CAPE and CIN
skew.shade_cin(p, T, parcel_prof)
skew.shade_cin(p, T, Td, parcel_prof)
skew.shade_cape(p, T, parcel_prof)

# Plot a zero degree isotherm
Expand Down

0 comments on commit 8f8b5f4

Please sign in to comment.