Пример #1
0
def test_collect_daily_humanized():
    """ Test for data collection with real data and humanized column names """

    data = collect_dwd_data(station_ids=[1048],
                            parameter=Parameter.CLIMATE_SUMMARY,
                            time_resolution=TimeResolution.DAILY,
                            period_type=PeriodType.RECENT,
                            humanize_column_names=True)

    assert list(data.columns.values) == [
        'STATION_ID',
        'DATE',
        'QN_3',
        'WIND_GUST_MAX',
        'WIND_VELOCITY',
        'QN_4',
        'PRECIPITATION_HEIGHT',
        'PRECIPITATION_FORM',
        'SUNSHINE_DURATION',
        'SNOW_DEPTH',
        'CLOUD_COVER',
        'VAPOR_PRESSURE',
        'PRESSURE',
        'TEMPERATURE',
        'HUMIDITY',
        'TEMPERATURE_MAX_200',
        'TEMPERATURE_MIN_200',
        'TEMPERATURE_MIN_005',
    ]
Пример #2
0
def test_collect_daily_vanilla():
    """ Test for data collection with real data """

    data = collect_dwd_data(station_ids=[1048],
                            parameter=Parameter.CLIMATE_SUMMARY,
                            time_resolution=TimeResolution.DAILY,
                            period_type=PeriodType.RECENT)

    assert list(data.columns.values) == [
        'STATION_ID',
        'DATE',
        'QN_3',
        'FX',
        'FM',
        'QN_4',
        'RSK',
        'RSKF',
        'SDK',
        'SHK_TAG',
        'NM',
        'VPM',
        'PM',
        'TMK',
        'UPM',
        'TXK',
        'TNK',
        'TGK',
    ]
Пример #3
0
def test_collect_dwd_data_empty():
    """ Test for data collection with no available data """
    """
    1. Scenario
    Test for request where no data is available
    """
    assert collect_dwd_data(station_ids=station_ids,
                            parameter=parameter,
                            time_resolution=time_resolution,
                            period_type=period_type,
                            folder="",
                            prefer_local=True,
                            parallel_download=parallel_download,
                            write_file=False,
                            create_new_file_index=create_new_file_index).empty
Пример #4
0
def test_collect_dwd_data():
    """ Test for data collection """
    """
    1. Scenario
    This scenario makes sure we take fresh data and write it to the given folder, thus we can run
    just another test afterwards as no old data is used
    """
    collect_dwd_data(station_ids=station_ids,
                     parameter=parameter,
                     time_resolution=time_resolution,
                     period_type=period_type,
                     folder=test_folder,
                     prefer_local=False,
                     parallel_download=parallel_download,
                     write_file=True,
                     create_new_file_index=create_new_file_index).equals(file)
    """
    2. Scenario
    This scenario tries to get the data from the given folder. This data was placed by the first test
    and is now restored
    """
    collect_dwd_data(station_ids=station_ids,
                     parameter=parameter,
                     time_resolution=time_resolution,
                     period_type=period_type,
                     folder=test_folder,
                     prefer_local=True,
                     parallel_download=parallel_download,
                     write_file=True,
                     create_new_file_index=create_new_file_index).equals(file)

    # Remove storage folder
    rmtree(test_folder)

    # Have to place an assert afterwards to ensure that above function is executed
    assert True
Пример #5
0
def test_collect_hourly_vanilla():
    """ Test for data collection with real data """

    data = collect_dwd_data(station_ids=[1048],
                            parameter=Parameter.TEMPERATURE_AIR,
                            time_resolution=TimeResolution.HOURLY,
                            period_type=PeriodType.RECENT)

    assert list(data.columns.values) == [
        'STATION_ID',
        'DATE',
        'QN_9',
        'TT_TU',
        'RF_TU',
    ]