예제 #1
0
def test_multidataset_plot_tuple():
    obj = arm.read_netcdf(sample_files.EXAMPLE_MET1)
    obj2 = arm.read_netcdf(sample_files.EXAMPLE_SIRS)
    obj = obj.rename({'lat': 'fun_time'})
    obj['fun_time'].attrs['standard_name'] = 'latitude'
    obj = obj.rename({'lon': 'not_so_fun_time'})
    obj['not_so_fun_time'].attrs['standard_name'] = 'longitude'

    # You can use tuples if the datasets in the tuple contain a
    # datastream attribute. This is required in all ARM datasets.
    display = TimeSeriesDisplay((obj, obj2),
                                subplot_shape=(2, ),
                                figsize=(15, 10))
    display.plot('short_direct_normal', 'sgpsirsE13.b1', subplot_index=(0, ))
    display.day_night_background('sgpsirsE13.b1', subplot_index=(0, ))
    display.plot('temp_mean', 'sgpmetE13.b1', subplot_index=(1, ))
    display.day_night_background('sgpmetE13.b1', subplot_index=(1, ))

    ax = act.plotting.common.parse_ax(ax=None)
    ax, fig = act.plotting.common.parse_ax_fig(ax=None, fig=None)
    obj.close()
    obj2.close()

    try:
        return display.fig
    finally:
        matplotlib.pyplot.close(display.fig)
예제 #2
0
def test_assessment_overplot():
    var_name = 'temp_mean'
    files = sample_files.EXAMPLE_MET1
    ds = arm.read_netcdf(files)
    ds.load()
    ds.clean.cleanup()

    ds.qcfilter.set_test(var_name,
                         index=np.arange(100, 300, dtype=int),
                         test_number=2)
    ds.qcfilter.set_test(var_name,
                         index=np.arange(420, 422, dtype=int),
                         test_number=3)
    ds.qcfilter.set_test(var_name,
                         index=np.arange(500, 800, dtype=int),
                         test_number=4)
    ds.qcfilter.set_test(var_name,
                         index=np.arange(900, 901, dtype=int),
                         test_number=4)

    # Plot data
    display = TimeSeriesDisplay(ds, subplot_shape=(1, ), figsize=(10, 6))
    display.plot(var_name, day_night_background=True, assessment_overplot=True)

    ds.close()
    return display.fig
예제 #3
0
def test_plot_barbs_from_u_v2():
    bins = list(np.linspace(0, 1, 10))
    xbins = list(pd.date_range(pd.to_datetime('2020-01-01'), pd.to_datetime('2020-01-02'), 12))
    y_data = np.full([len(xbins), len(bins)], 1.0)
    x_data = np.full([len(xbins), len(bins)], 2.0)
    y_array = xr.DataArray(y_data, dims={'xbins': xbins, 'ybins': bins}, attrs={'units': 'm/s'})
    x_array = xr.DataArray(x_data, dims={'xbins': xbins, 'ybins': bins}, attrs={'units': 'm/s'})
    xbins = xr.DataArray(xbins, dims={'xbins': xbins})
    ybins = xr.DataArray(bins, dims={'ybins': bins})
    fake_obj = xr.Dataset({'xbins': xbins, 'ybins': ybins, 'ydata': y_array, 'xdata': x_array})
    BarbDisplay = TimeSeriesDisplay(fake_obj)
    BarbDisplay.plot_barbs_from_u_v(
        'xdata',
        'ydata',
        None,
        num_barbs_x=20,
        num_barbs_y=20,
        set_title='test plot',
        cmap='jet',
    )
    fake_obj.close()
    try:
        return BarbDisplay.fig
    finally:
        matplotlib.pyplot.close(BarbDisplay.fig)
예제 #4
0
def test_2d_as_1d():
    obj = arm.read_netcdf(sample_files.EXAMPLE_CEIL1)

    display = TimeSeriesDisplay(obj)
    display.plot('backscatter', force_line_plot=True)

    return display.fig
예제 #5
0
def test_plot_barbs_from_u_v():
    sonde_ds = arm.read_netcdf(
        sample_files.EXAMPLE_TWP_SONDE_WILDCARD)
    BarbDisplay = TimeSeriesDisplay({'sonde_darwin': sonde_ds})
    BarbDisplay.plot_barbs_from_u_v('u_wind', 'v_wind', 'pres',
                                    num_barbs_x=20)
    sonde_ds.close()
    return BarbDisplay.fig
예제 #6
0
def test_time_plot2():
    files = sample_files.EXAMPLE_MET1
    obj = arm.read_netcdf(files,
                          decode_times=False,
                          cftime_to_datetime64=False)
    display = TimeSeriesDisplay(obj)
    display.plot('time')
    return display.fig
예제 #7
0
def test_2D_timeseries_plot():
    obj = arm.read_netcdf(sample_files.EXAMPLE_CEIL1)
    display = TimeSeriesDisplay(obj)
    display.plot('backscatter', y_rng=[0, 5000], use_var_for_y='range')
    try:
        return display.fig
    finally:
        matplotlib.pyplot.close(display.fig)
예제 #8
0
def test_time_height_scatter():
    sonde_ds = arm.read_netcdf(sample_files.EXAMPLE_SONDE1)

    display = TimeSeriesDisplay({'sgpsondewnpnC1.b1': sonde_ds},
                                figsize=(7, 3))
    display.time_height_scatter('tdry', day_night_background=False)
    sonde_ds.close()

    return display.fig
예제 #9
0
def test_fill_between():
    obj = arm.read_netcdf(sample_files.EXAMPLE_MET_WILDCARD)

    accumulate_precip(obj, 'tbrg_precip_total')

    display = TimeSeriesDisplay(obj)
    display.fill_between('tbrg_precip_total_accumulated',
                         color='gray',
                         alpha=0.2)

    return display.fig
예제 #10
0
def test_y_axis_flag_meanings():
    variable = 'detection_status'
    obj = arm.read_netcdf(
        sample_files.EXAMPLE_CEIL1, keep_variables=[variable, 'lat', 'lon', 'alt']
    )
    obj.clean.clean_arm_state_variables(variable, override_cf_flag=True)

    display = TimeSeriesDisplay(obj, figsize=(12, 8), subplot_shape=(1,))
    display.plot(variable, subplot_index=(0,), day_night_background=True, y_axis_flag_meanings=18)
    display.fig.subplots_adjust(left=0.15, right=0.95, bottom=0.1, top=0.94)

    return display.fig
예제 #11
0
def test_2d_as_1d():
    obj = arm.read_netcdf(sample_files.EXAMPLE_CEIL1)

    display = TimeSeriesDisplay(obj)
    display.plot('backscatter', force_line_plot=True)

    obj.close()
    del obj

    try:
        return display.fig
    finally:
        matplotlib.pyplot.close(display.fig)
예제 #12
0
def test_qc_bar_plot():
    ds_object = arm.read_netcdf(sample_files.EXAMPLE_MET1)
    ds_object.clean.cleanup()
    var_name = 'temp_mean'
    ds_object.qcfilter.set_test(var_name, index=range(100, 600), test_number=2)

    # Testing out when the assessment is not listed
    ds_object.qcfilter.set_test(var_name, index=range(500, 800), test_number=4)
    ds_object['qc_' + var_name].attrs['flag_assessments'][3] = 'Wonky'

    display = TimeSeriesDisplay({'sgpmetE13.b1': ds_object},
                                subplot_shape=(2, ),
                                figsize=(7, 4))
    display.plot(var_name, subplot_index=(0, ), assessment_overplot=True)
    display.day_night_background('sgpmetE13.b1', subplot_index=(0, ))
    color_lookup = {
        'Bad': 'red',
        'Incorrect': 'red',
        'Indeterminate': 'orange',
        'Suspect': 'orange',
        'Missing': 'darkgray',
        'Not Failing': 'green',
        'Acceptable': 'green'
    }
    display.qc_flag_block_plot(var_name,
                               subplot_index=(1, ),
                               assessment_color=color_lookup)

    ds_object.close()

    try:
        return display.fig
    finally:
        matplotlib.pyplot.close(display.fig)
예제 #13
0
def test_multidataset_plot_dict():
    conn = boto3.resource('s3')
    conn.meta.client.meta.events.register('choose-signer.s3.*',
                                          disable_signing)
    bucket = conn.Bucket('act-tests')
    if not os.path.isdir((os.getcwd() + '/data/')):
        os.makedirs((os.getcwd() + '/data/'))

    for item in bucket.objects.all():
        bucket.download_file(item.key, (os.getcwd() + '/data/' + item.key))

    ceil_ds = arm.read_netcdf('data/sgpceilC1.b1*')
    sonde_ds = arm.read_netcdf(sample_files.EXAMPLE_MET_WILDCARD)
    ceil_ds = ceil.correct_ceil(ceil_ds, fill_value=-9999.)

    display = TimeSeriesDisplay(
        {
            'ceiliometer': ceil_ds,
            'rawinsonde': sonde_ds
        },
        subplot_shape=(2, ),
        figsize=(15, 10))
    display.plot('backscatter', 'ceiliometer', subplot_index=(0, ))
    display.plot('temp_mean', 'rawinsonde', subplot_index=(1, ))
    display.day_night_background('rawinsonde', subplot_index=(1, ))
    ceil_ds.close()
    sonde_ds.close()
    return display.fig
예제 #14
0
def test_multidataset_plot_tuple():
    conn = boto3.resource('s3')
    conn.meta.client.meta.events.register('choose-signer.s3.*',
                                          disable_signing)
    bucket = conn.Bucket('act-tests')
    if not os.path.isdir((os.getcwd() + '/data/')):
        os.makedirs((os.getcwd() + '/data/'))

    for item in bucket.objects.all():
        bucket.download_file(item.key, (os.getcwd() + '/data/' + item.key))

    ceil_ds = arm.read_netcdf('data/sgpceilC1.b1*')
    sonde_ds = arm.read_netcdf(sample_files.EXAMPLE_MET_WILDCARD)
    # Removing fill value of -9999 as it was causing some warnings
    ceil_ds = ceil.correct_ceil(ceil_ds)

    # You can use tuples if the datasets in the tuple contain a
    # datastream attribute. This is required in all ARM datasets.
    display = TimeSeriesDisplay((ceil_ds, sonde_ds),
                                subplot_shape=(2, ),
                                figsize=(15, 10))
    display.plot('backscatter', 'sgpceilC1.b1', subplot_index=(0, ))
    display.plot('temp_mean', 'sgpmetE13.b1', subplot_index=(1, ))
    display.day_night_background('sgpmetE13.b1', subplot_index=(1, ))
    ceil_ds.close()
    sonde_ds.close()
    return display.fig
예제 #15
0
def test_fill_between():
    obj = arm.read_netcdf(sample_files.EXAMPLE_MET_WILDCARD)

    accumulate_precip(obj, 'tbrg_precip_total')

    display = TimeSeriesDisplay(obj)
    display.fill_between('tbrg_precip_total_accumulated', color='gray', alpha=0.2)

    obj.close()
    del obj

    try:
        return display.fig
    finally:
        matplotlib.pyplot.close(display.fig)
예제 #16
0
def test_multidataset_plot_dict():

    obj = arm.read_netcdf(sample_files.EXAMPLE_MET1)
    obj2 = arm.read_netcdf(sample_files.EXAMPLE_SIRS)

    # You can use tuples if the datasets in the tuple contain a
    # datastream attribute. This is required in all ARM datasets.
    display = TimeSeriesDisplay(
        {'sirs': obj2, 'met': obj},
        subplot_shape=(2,), figsize=(15, 10))
    display.plot('short_direct_normal', 'sirs', subplot_index=(0,))
    display.day_night_background('sirs', subplot_index=(0,))
    display.plot('temp_mean', 'met', subplot_index=(1,))
    display.day_night_background('met', subplot_index=(1,))
    obj.close()
    obj2.close()

    return display.fig
예제 #17
0
def test_colorbar_labels():
    variable = 'cloud_phase_hsrl'
    obj = arm.read_netcdf(sample_files.EXAMPLE_CLOUDPHASE)
    obj.clean.clean_arm_state_variables(variable)

    display = TimeSeriesDisplay(obj, figsize=(12, 8), subplot_shape=(1,))

    y_axis_labels = {}
    flag_colors = ['white', 'green', 'blue', 'red', 'cyan', 'orange', 'yellow', 'black', 'gray']
    for value, meaning, color in zip(
        obj[variable].attrs['flag_values'], obj[variable].attrs['flag_meanings'], flag_colors
    ):
        y_axis_labels[value] = {'text': meaning, 'color': color}

    display.plot(variable, subplot_index=(0,), colorbar_labels=y_axis_labels, cbar_h_adjust=0)
    display.fig.subplots_adjust(left=0.08, right=0.88, bottom=0.1, top=0.94)

    return display.fig
예제 #18
0
def test_plot():
    # Process MET data to get simple LCL
    files = sample_files.EXAMPLE_SONDE_WILDCARD
    met = arm.read_netcdf(files)
    met_temp = met.temp_mean
    met_rh = met.rh_mean
    met_lcl = (20. + met_temp / 5.) * (100. - met_rh) / 1000.
    met['met_lcl'] = met_lcl * 1000.
    met['met_lcl'].attrs['units'] = 'm'
    met['met_lcl'].attrs['long_name'] = 'LCL Calculated from SGP MET E13'

    # Plot data
    # Plot data
    display = TimeSeriesDisplay(met)
    display.add_subplots((3, ), figsize=(15, 10))
    display.plot('wspd_vec_mean', subplot_index=(0, ))
    display.plot('temp_mean', subplot_index=(1, ))
    display.plot('rh_mean', subplot_index=(2, ))

    return display.fig
예제 #19
0
def test_assessment_overplot_multi():
    var_name1, var_name2 = 'wspd_arith_mean', 'wspd_vec_mean'
    files = sample_files.EXAMPLE_MET1
    ds = arm.read_netcdf(files)
    ds.load()
    ds.clean.cleanup()

    ds.qcfilter.set_test(var_name1,
                         index=np.arange(100, 200, dtype=int),
                         test_number=2)
    ds.qcfilter.set_test(var_name1,
                         index=np.arange(500, 600, dtype=int),
                         test_number=4)
    ds.qcfilter.set_test(var_name2,
                         index=np.arange(300, 400, dtype=int),
                         test_number=4)

    # Plot data
    display = TimeSeriesDisplay(ds, subplot_shape=(1, ), figsize=(10, 6))
    display.plot(var_name1,
                 label=var_name1,
                 assessment_overplot=True,
                 overplot_behind=True)
    display.plot(var_name2,
                 day_night_background=True,
                 color='green',
                 label=var_name2,
                 assessment_overplot=True)

    ds.close()
    return display.fig
예제 #20
0
def test_qc_bar_plot():
    ds_object = arm.read_netcdf(sample_files.EXAMPLE_MET1)
    ds_object.clean.cleanup()
    var_name = 'temp_mean'
    ds_object.qcfilter.set_test(var_name, index=range(100, 600), test_number=2)

    display = TimeSeriesDisplay({'sgpmetE13.b1': ds_object},
                                subplot_shape=(2, ),
                                figsize=(7, 4))
    display.plot(var_name, subplot_index=(0, ), assessment_overplot=True)
    display.day_night_background('sgpmetE13.b1', subplot_index=(0, ))
    display.qc_flag_block_plot(var_name, subplot_index=(1, ))

    return display.fig
예제 #21
0
def test_barb_sounding_plot():
    sonde_ds = arm.read_netcdf(sample_files.EXAMPLE_TWP_SONDE_WILDCARD)
    BarbDisplay = TimeSeriesDisplay({'sonde_darwin': sonde_ds})
    BarbDisplay.plot_time_height_xsection_from_1d_data('rh',
                                                       'pres',
                                                       cmap='coolwarm_r',
                                                       vmin=0,
                                                       vmax=100,
                                                       num_time_periods=25)
    BarbDisplay.plot_barbs_from_spd_dir('deg', 'wspd', 'pres', num_barbs_x=20)
    sonde_ds.close()
    return BarbDisplay.fig
예제 #22
0
def test_qc_flag_block_plot():
    obj = arm.read_netcdf(sample_files.EXAMPLE_SURFSPECALB1MLAWER)

    display = TimeSeriesDisplay(obj, subplot_shape=(2, ), figsize=(8, 2 * 4))

    display.plot('surface_albedo_mfr_narrowband_10m', force_line_plot=True, labels=True)

    display.qc_flag_block_plot('surface_albedo_mfr_narrowband_10m', subplot_index=(1, ))

    obj.close()
    del obj

    return display.fig
예제 #23
0
def test_qc_bar_plot():
    ds_object = arm.read_netcdf(sample_files.EXAMPLE_MET1)
    ds_object.clean.cleanup()
    var_name = 'temp_mean'
    ds_object.qcfilter.set_test(var_name, index=range(100, 600), test_number=2)

    # Testing out when the assessment is not listed
    ds_object.qcfilter.set_test(var_name, index=range(500, 800), test_number=4)
    ds_object['qc_' + var_name].attrs['flag_assessments'][3] = 'Wonky'

    display = TimeSeriesDisplay({'sgpmetE13.b1': ds_object},
                                subplot_shape=(2, ),
                                figsize=(7, 4))
    display.plot(var_name, subplot_index=(0, ), assessment_overplot=True)
    display.day_night_background('sgpmetE13.b1', subplot_index=(0, ))
    display.qc_flag_block_plot(var_name, subplot_index=(1, ))

    ds_object.close()

    return display.fig
예제 #24
0
files.sort()

# Read in data. This will read in one or more files and do a bit of work
# updating the variable attributes with units, long_name and quality
# control variables.
ds_obj = read_gml(files)

# Change variable units from degree C to degree F. Can specify specific variables.
# Or list no variables and will attempt to change all variables to the desired
# unit if the units are conicially matching.
ds_obj = ds_obj.utils.change_units(variables='air_temperature_10m',
                                   desired_unit='degF')

# Set up plotting ACT object to contain data to plot and other configurations
my_disp = TimeSeriesDisplay({'noaa_gml_brw': ds_obj},
                            subplot_shape=(2, ),
                            figsize=(15, 10))

# Plot two variables on one plot and set the plot axes title. Also color
# background to indicate when sun is shining and local solar noon time.
my_disp.plot('downwelling_global_solar',
             subplot_index=(0, ),
             label='Downwelling')
my_disp.plot('upwelling_global_solar',
             subplot_index=(0, ),
             label='Upwelling',
             set_title=f"NOAA GML {ds_obj.attrs['location']} Global Solar",
             day_night_background=True)

# Add second plot of air temperature. Use variable long name for plot axes title
# and add background color to indicate when sun is shining and solar noon.
예제 #25
0
def test_plot():
    # Process MET data to get simple LCL
    files = sample_files.EXAMPLE_MET_WILDCARD
    met = arm.read_netcdf(files)
    met_temp = met.temp_mean
    met_rh = met.rh_mean
    met_lcl = (20. + met_temp / 5.) * (100. - met_rh) / 1000.
    met['met_lcl'] = met_lcl * 1000.
    met['met_lcl'].attrs['units'] = 'm'
    met['met_lcl'].attrs['long_name'] = 'LCL Calculated from SGP MET E13'

    # Plot data
    display = TimeSeriesDisplay(met)
    display.add_subplots((2, 2), figsize=(15, 10))
    display.plot('wspd_vec_mean', subplot_index=(0, 0))
    display.plot('temp_mean', subplot_index=(1, 0))
    display.plot('rh_mean', subplot_index=(0, 1))

    windrose = WindRoseDisplay(met)
    display.put_display_in_subplot(windrose, subplot_index=(1, 1))
    windrose.plot('wdir_vec_mean',
                  'wspd_vec_mean',
                  spd_bins=np.linspace(0, 10, 4))
    windrose.axes[0].legend(loc='best')
    met.close()
    return display.fig
예제 #26
0
# Reduce met data from full month to one day
met_obj = met_obj.sel(
    time=slice(rad_obj['time'].values[0], rad_obj['time'].values[-1]))

# MET and Ozone do not have location variables in the file. Add location variables
# from rad_obj to allow day/night background plotting.
for var_name in ['lat', 'lon', 'alt']:
    ozone_obj[var_name] = rad_obj[var_name]
    met_obj[var_name] = rad_obj[var_name]

# Create dictionary of all data objects to allow plotting from different
# Xarray Datasets.
location = "Barrow"
plot_obj = {'met': met_obj, 'rad': rad_obj, 'ozone': ozone_obj}
my_disp = TimeSeriesDisplay(plot_obj, subplot_shape=(3, ), figsize=(10, 8))

# Create first plot of two variables from Radiation file.
my_disp.plot('downwelling_global_solar',
             dsname='rad',
             subplot_index=(0, ),
             label='Downwelling')
my_disp.plot('upwelling_global_solar',
             dsname='rad',
             subplot_index=(0, ),
             label='Upwelling',
             set_title=f"NOAA GML {location} Global Solar",
             day_night_background=True)

# Add second plot of Ozone. Use variable long name for plot axes title
# and add background color to indicate when sun is shining and solar noon.
예제 #27
0
def test_time_plot():
    files = sample_files.EXAMPLE_MET1
    obj = arm.read_netcdf(files)
    display = TimeSeriesDisplay(obj)
    display.plot('time')
    return display.fig
import re

filename = Path('data', 'pocketLab_aqi_2021-05-18_082549.csv')
ds = read_csv(filename, parse_dates={'time': [0,1]})

ds['time'].values = ds['time'].values + np.timedelta64(5, 'h')
ds = ds.assign_coords(time=ds['time'])
ds = ds.swap_dims({'index': 'time'})
ds = ds.drop('index')
ds = ds.rename({'Latitude': 'latitude', 'Longitude': 'longitude'})

var_names = list(set(ds.keys()) - set(['time', 'Elapsed Seconds', 'latitude', 'longitude']))
var_names = [ii for ii in var_names if 'Avg.' not in ii]
var_names.sort()

my_disp = TimeSeriesDisplay({'pocketLab': ds}, subplot_shape=(int(len(var_names)/2), 2),
                            figsize=(8*2, 2*len(var_names)/2))

row=0
col=0
for plot_num, var_name in enumerate(var_names):
    match = re.match(r".+\(([\S]+)\).*", var_name)
    units = '(1)'
    if match is not None:
        units = f"({match.groups()[0]})"
    axes = my_disp.plot(var_name, subplot_index=(row, col), day_night_background=True)
    axes.set_ylabel(units)

    row += 1
    if plot_num == 4:
        col += 1
        row = 0
예제 #29
0
def test_errors():
    files = sample_files.EXAMPLE_MET_WILDCARD
    obj = arm.read_netcdf(files)

    display = TimeSeriesDisplay(obj)
    display.axes = None
    with np.testing.assert_raises(RuntimeError):
        display.day_night_background()

    display = TimeSeriesDisplay({'met': obj, 'met2': obj})
    with np.testing.assert_raises(ValueError):
        display.plot('temp_mean')
    with np.testing.assert_raises(ValueError):
        display.qc_flag_block_plot('qc_temp_mean')
    with np.testing.assert_raises(ValueError):
        display.plot_barbs_from_spd_dir('wdir_vec_mean', 'wspd_vec_mean')
    with np.testing.assert_raises(ValueError):
        display.plot_barbs_from_u_v('wdir_vec_mean', 'wspd_vec_mean')

    del obj.attrs['_file_dates']

    data = np.empty(len(obj['time'])) * np.nan
    lat = obj['lat'].values
    lon = obj['lon'].values
    obj['lat'].values = data
    obj['lon'].values = data

    display = TimeSeriesDisplay(obj)
    display.plot('temp_mean')
    display.set_yrng([0, 0])
    with np.testing.assert_warns(RuntimeWarning):
        display.day_night_background()
    obj['lat'].values = lat
    with np.testing.assert_warns(RuntimeWarning):
        display.day_night_background()
    obj['lon'].values = lon * 100.
    with np.testing.assert_warns(RuntimeWarning):
        display.day_night_background()
    obj['lat'].values = lat * 100.
    with np.testing.assert_warns(RuntimeWarning):
        display.day_night_background()

    obj.close()

    # Test some of the other errors
    obj = arm.read_netcdf(files)
    del obj['temp_mean'].attrs['units']
    display = TimeSeriesDisplay(obj)
    display.axes = None
    with np.testing.assert_raises(RuntimeError):
        display.set_yrng([0, 10])
    with np.testing.assert_raises(RuntimeError):
        display.set_xrng([0, 10])
    display.fig = None
    display.plot('temp_mean', add_nan=True)

    assert display.fig is not None
    assert display.axes is not None

    with np.testing.assert_raises(AttributeError):
        display = TimeSeriesDisplay([])

    fig, ax = matplotlib.pyplot.subplots()
    display = TimeSeriesDisplay(obj)
    display.add_subplots((2, 2), figsize=(15, 10))
    display.assign_to_figure_axis(fig, ax)
    assert display.fig is not None
    assert display.axes is not None

    obj = arm.read_netcdf(files)
    display = TimeSeriesDisplay(obj)
    obj.clean.cleanup()
    display.axes = None
    display.fig = None
    display.qc_flag_block_plot('atmos_pressure')
    assert display.fig is not None
    assert display.axes is not None

    matplotlib.pyplot.close(fig=display.fig)
예제 #30
0
from act.io.armfiles import read_netcdf
from act.plotting import TimeSeriesDisplay
from act.tests import EXAMPLE_SURFSPECALB1MLAWER

# Read a data file that has a 2D DataArray of multiple 1D data.
# The corresponding quality control DataArray is also read in and
# will be used to make a summary plot of quality control infomation
# of each assessment category.
obj = read_netcdf(EXAMPLE_SURFSPECALB1MLAWER)

# The name of the data variable we wish to plot
var_name = 'surface_albedo_mfr_narrowband_10m'

# Create the ACT display object used for plotting. This will have two
# vertical plots of 800 by 400 pixels.
display = TimeSeriesDisplay(obj, subplot_shape=(2, ), figsize=(8, 2 * 4))

# Create the top plot of data using the force_line_plot option.
# This will force the plotting to not assume the data are 2D data that
# would normally be plotted as a 2D plot. Rather for each index into the
# filter dimention plot a 1D time series plot. Setting labels=True
# will create a legend using the filter dimention DataArray.
display.plot(var_name, force_line_plot=True, labels=True)

# Create the bottom plot of summarized quality control by assessment
# cateory.
display.qc_flag_block_plot(var_name, subplot_index=(1, ))

# Show the plot in a new window.
plt.show()