コード例 #1
0
ファイル: test_util.py プロジェクト: zhatin/MetPy
def test_gempak_color_image_compare():
    """Test creating a plot with all the GEMPAK colors."""
    c = range(32)
    mplc = convert_gempak_color(c)

    delta = 0.025
    x = y = np.arange(-3.0, 3.01, delta)
    xx, yy = np.meshgrid(x, y)
    z1 = np.exp(-xx**2 - yy**2)
    z2 = np.exp(-(xx - 1)**2 - (yy - 1)**2)
    z = (z1 - z2) * 2

    fig = plt.figure(figsize=(9, 9))
    cs = plt.contourf(xx, yy, z, levels=np.linspace(-1.8, 1.8, 33), colors=mplc)
    plt.colorbar(cs)
    return fig
コード例 #2
0
ファイル: test_util.py プロジェクト: akrherz/MetPy
def test_gempak_color_image_compare():
    """Test creating a plot with all the GEMPAK colors."""
    c = range(32)
    mplc = convert_gempak_color(c)

    delta = 0.025
    x = y = np.arange(-3.0, 3.01, delta)
    xx, yy = np.meshgrid(x, y)
    z1 = np.exp(-xx**2 - yy**2)
    z2 = np.exp(-(xx - 1)**2 - (yy - 1)**2)
    z = (z1 - z2) * 2

    fig = plt.figure(figsize=(9, 9))
    cs = plt.contourf(xx, yy, z, levels=np.linspace(-1.8, 1.8, 33), colors=mplc)
    plt.colorbar(cs)
    return fig
コード例 #3
0
ファイル: test_util.py プロジェクト: zhatin/MetPy
def test_gempak_color_scalar():
    """Test converting a single GEMPAK color."""
    mplc = convert_gempak_color(6)
    truth = 'cyan'
    assert mplc == truth
コード例 #4
0
ファイル: test_util.py プロジェクト: zhatin/MetPy
def test_gempak_color_quirks():
    """Test converting some unusual GEMPAK colors."""
    c = [-5, 95, 101]
    mplc = convert_gempak_color(c)
    truth = ['white', 'bisque', 'white']
    assert mplc == truth
コード例 #5
0
ファイル: test_util.py プロジェクト: zhatin/MetPy
def test_gempak_color_invalid_style():
    """Test converting a GEMPAK color with an invalid style parameter."""
    c = range(32)
    with pytest.raises(ValueError):
        convert_gempak_color(c, style='plt')
コード例 #6
0
ファイル: test_util.py プロジェクト: akrherz/MetPy
def test_gempak_color_scalar():
    """Test converting a single GEMPAK color."""
    mplc = convert_gempak_color(6)
    truth = 'cyan'
    assert mplc == truth
コード例 #7
0
ファイル: test_util.py プロジェクト: akrherz/MetPy
def test_gempak_color_quirks():
    """Test converting some unusual GEMPAK colors."""
    c = [-5, 95, 101]
    mplc = convert_gempak_color(c)
    truth = ['white', 'bisque', 'white']
    assert mplc == truth
コード例 #8
0
ファイル: test_util.py プロジェクト: akrherz/MetPy
def test_gempak_color_invalid_style():
    """Test converting a GEMPAK color with an invalid style parameter."""
    c = range(32)
    with pytest.raises(ValueError):
        convert_gempak_color(c, style='plt')