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)
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)
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)
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)
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)
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)