def test_download_asos_data():
    """Test downloading ASOS data."""
    # Setup
    url = meteogram.build_asos_request_url('AMW')

    # Exercise
    df = meteogram.download_asos_data(url)

    # Verify
    first_row_truth = mtesting.pd.Series({
        'station_id':
        'AMW',
        'station_name':
        'Ames',
        'latitude_deg':
        41.990439,
        'longitude_deg':
        -93.618515,
        'UTC':
        mtesting.pd.Timestamp('2018-03-25 12:00:00'),
        'temperature_degF':
        29,
        'dewpoint_degF':
        24,
        'wind_speed_knots':
        8,
        'wind_direction_degrees':
        113
    })

    mtesting.assert_dataseries_equal(df.iloc[0], first_row_truth)
def load_example_asos():
    """
    Fixture to load example data from a csv file for testing
    """
    example_data_path = Path(
        __file__).resolve().parent / '..' / '..' / 'staticdata'
    data_path = example_data_path / 'AMW_example_data.csv'
    return meteogram.download_asos_data(data_path)
Beispiel #3
0
def load_example_asos():
    """
    Fixture to load example data
    :return downloaded_data: example data in Pandas.DataFrame
    """
    example_data_path = Path(
        __file__).resolve().parent / '..' / '..' / 'staticdata'
    data_path = example_data_path / "AMW_example_data.csv"
    downloaded_data = meteogram.download_asos_data(data_path)
    return downloaded_data
def load_example_asos() -> DataFrame:
    """
    Fixture to load example data
    """
    example_data_path = os.path.abspath(
        os.path.join(os.path.dirname(__file__), os.pardir, os.pardir,
                     "staticdata"))

    data_path = os.path.join(example_data_path, "AMW_example_data.csv")
    return meteogram.download_asos_data(data_path)
def test_plotting_meteogram_defaults():
    # setup
    url = meteogram.build_asos_request_url('AMW',\
        start_date=datetime(2018,3,26),\
        end_date=datetime(2018,3,27))

    df = meteogram.download_asos_data(url)

    # print(df)
    if df.empty == False:
        # exersize
        fig, _, _, _ = meteogram.plot_meteogram(df)

        # verify - needs to return image to
        return fig
    else:
        Exception("No dataframe received from download_asos_data")
Beispiel #6
0
def test_plotting_meteogram_defaults():
    """
    Test default meteogram plotting
    :return fig: matplotlib.figure.Figure, matplotlib.axes._subplots.AxesSubplot,
    """
    # Setup
    url = meteogram.build_asos_request_url("AMW",
                                           start_date=datetime(2018, 3, 26),
                                           end_date=datetime(2018, 3, 27))

    df = meteogram.download_asos_data(url)  # this will hit the web server

    # Exercise
    fig, _, _, _ = meteogram.plot_meteogram(df)

    # Verify - done elsewhere

    # Cleanup - none necessary

    return fig