예제 #1
0
def test_contour2():
    files = glob.glob(sample_files.EXAMPLE_MET_CONTOUR)
    time = '2019-05-08T04:00:00.000000000'
    data = {}
    fields = {}
    wind_fields = {}
    station_fields = {}
    for f in files:
        obj = arm.read_netcdf(f)
        data.update({f: obj})
        fields.update({f: ['lon', 'lat', 'temp_mean']})
        wind_fields.update(
            {f: ['lon', 'lat', 'wspd_vec_mean', 'wdir_vec_mean']})
        station_fields.update({f: ['lon', 'lat', 'atmos_pressure']})

    display = ContourDisplay(data, figsize=(8, 8))
    display.create_contour(fields=fields,
                           time=time,
                           levels=50,
                           contour='contour',
                           cmap='viridis')
    display.plot_vectors_from_spd_dir(fields=wind_fields,
                                      time=time,
                                      mesh=False,
                                      grid_delta=(0.1, 0.1))
    display.plot_station(fields=station_fields,
                         time=time,
                         markersize=7,
                         color='pink')

    try:
        return display.fig
    finally:
        matplotlib.pyplot.close(display.fig)
예제 #2
0
def test_contour():
    files = glob.glob(sample_files.EXAMPLE_MET_CONTOUR)
    time = '2019-05-08T04:00:00.000000000'
    data = {}
    fields = {}
    for f in files:
        obj = arm.read_netcdf(f)
        data.update({f: obj})
        fields.update({f: ['lon', 'lat', 'temp_mean']})

    display = ContourDisplay(data, figsize=(8, 8))
    display.create_contour(fields=fields, time=time, levels=50)

    return display.fig