예제 #1
0
파일: test_plot.py 프로젝트: wydh/oceanspy
def test_hor_sec_error(od_in, plotType, meanAxes):
    plt.close()
    with pytest.raises(ValueError):
        horizontal_section(od_in,
                           varName="Temp",
                           meanAxes=meanAxes,
                           plotType=plotType)
예제 #2
0
def test_hor_sec_warn(od_in):
    with pytest.warns(UserWarning):
        plt.close()
        fig, ax = plt.subplots(1, 1)
        ax = horizontal_section(od_in.set_projection('NorthPolarStereo'),
                                varName='Depth',
                                contourName='Depth',
                                ax=ax,
                                use_coords=False)
        assert isinstance(ax, plt.Axes)

    with pytest.warns(UserWarning):
        plt.close()
        fig, ax = plt.subplots(1, 1)
        ax = horizontal_section(od_in,
                                varName='Eta',
                                contourName='Depth',
                                ax=ax,
                                subplot_kws={'projection': None})
        assert isinstance(ax, xr.plot.FacetGrid)

    with pytest.warns(UserWarning):
        plt.close()
        fig, ax = plt.subplots(1, 1)
        ax = horizontal_section(od_in,
                                varName='Eta',
                                contourName='V',
                                ax=ax,
                                meanAxes=['Z'],
                                subplot_kws={'projection': od.projection})
        assert isinstance(ax, xr.plot.FacetGrid)
예제 #3
0
def test_hor_sec_warn(od_in):
    with pytest.warns(UserWarning):
        plt.close()
        fig, ax = plt.subplots(1, 1)
        ax = horizontal_section(
            od_in.set_projection("NorthPolarStereo"),
            varName="Depth",
            contourName="Depth",
            ax=ax,
            use_coords=False,
        )
        assert isinstance(ax, plt.Axes)

    with pytest.warns(UserWarning):
        plt.close()
        ax = horizontal_section(
            od_in,
            varName="Eta",
            contourName="Depth",
            subplot_kws={"projection": None},
        )
        assert isinstance(ax, xr.plot.FacetGrid)

    with pytest.warns(UserWarning):
        plt.close()
        ax = horizontal_section(
            od_in,
            varName="Eta",
            contourName="V",
            meanAxes=["Z"],
            subplot_kws={"projection": od.projection},
        )
        assert isinstance(ax, xr.plot.FacetGrid)
예제 #4
0
def test_hor_sec(od_in, varName, contourName):
    plt.close()
    cutout_kwargs = {'timeRange': [od_in.dataset['time'][0].values,
                                   od_in.dataset['time'][-1].values]}
    contour_kwargs = {'levels': 10}
    clabel_kwargs = {'fontsize': 10}
    if varName == 'Temp':
        od_in = od_in.set_projection('NorthPolarStereo')
    fig, ax = plt.subplots(1, 1, subplot_kw={'projection': od_in.projection})
    ax = horizontal_section(od_in,
                            varName=varName, meanAxes=True, ax=ax,
                            contourName=contourName,
                            contour_kwargs=contour_kwargs,
                            clabel_kwargs=clabel_kwargs,
                            cutout_kwargs=cutout_kwargs)
    assert isinstance(ax, plt.Axes)
예제 #5
0
def test_hor_sec(od_in, varName, contourName):
    plt.close()
    cutout_kwargs = {
        "timeRange": [od_in.dataset["time"][0].values, od_in.dataset["time"][-1].values]
    }
    contour_kwargs = {"levels": 10, "cmap": "viridis"}
    clabel_kwargs = {"fontsize": 10}
    if varName == "Temp":
        od_in = od_in.set_projection("NorthPolarStereo")
    fig, ax = plt.subplots(1, 1, subplot_kw={"projection": od_in.projection})
    ax = horizontal_section(
        od_in,
        varName=varName,
        meanAxes=True,
        ax=ax,
        contourName=contourName,
        contour_kwargs=contour_kwargs,
        clabel_kwargs=clabel_kwargs,
        cutout_kwargs=cutout_kwargs,
    )
    assert isinstance(ax, plt.Axes)
예제 #6
0
파일: test_plot.py 프로젝트: wydh/oceanspy
def test_hor_sec_facet(od_in, col):
    plt.close()
    ax = horizontal_section(od_in.set_projection(None), varName="Eta", col=col)
    assert isinstance(ax, xr.plot.FacetGrid)