Ejemplo n.º 1
0
def test_xsection_plot_map():
    radar_ds = arm.read_netcdf(
        sample_files.EXAMPLE_VISST)
    xsection = XSectionDisplay(radar_ds, figsize=(15, 8))
    xsection.plot_xsection_map(None, 'ir_temperature', vmin=220, vmax=300, cmap='Greys',
                               x='longitude', y='latitude', isel_kwargs={'time': 0})
    radar_ds.close()
    return xsection.fig
Ejemplo n.º 2
0
def test_xsection_plot():
    visst_ds = arm.read_netcdf(
        sample_files.EXAMPLE_CEIL1)

    xsection = XSectionDisplay(visst_ds, figsize=(10, 8))
    xsection.plot_xsection(None, 'backscatter', x='time', y='range',
                           cmap='coolwarm', vmin=0, vmax=320)
    visst_ds.close()
    return xsection.fig
Ejemplo n.º 3
0
def test_xsection_plot_map():
    radar_ds = arm.read_netcdf(sample_files.EXAMPLE_VISST,
                               combine='nested',
                               concat_dim='time')

    try:
        xsection = XSectionDisplay(radar_ds, figsize=(15, 8))
        xsection.plot_xsection_map(None,
                                   'ir_temperature',
                                   vmin=220,
                                   vmax=300,
                                   cmap='Greys',
                                   x='longitude',
                                   y='latitude',
                                   isel_kwargs={'time': 0})
        radar_ds.close()
        try:
            return xsection.fig
        finally:
            matplotlib.pyplot.close(xsection.fig)
    except Exception:
        pass
Ejemplo n.º 4
0
def test_xsection_errors():
    obj = arm.read_netcdf(sample_files.EXAMPLE_CEIL1)

    display = XSectionDisplay(obj, figsize=(10, 8), subplot_shape=(2, ))
    display.axes = None
    with np.testing.assert_raises(RuntimeError):
        display.set_yrng([0, 10])
    with np.testing.assert_raises(RuntimeError):
        display.set_xrng([-40, 40])

    display = XSectionDisplay(obj, figsize=(10, 8), subplot_shape=(1, ))
    with np.testing.assert_raises(RuntimeError):
        display.plot_xsection(None, 'backscatter', x='time')

    obj.close()
    matplotlib.pyplot.close(fig=display.fig)