-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
test_metaindex.py
62 lines (52 loc) · 1.69 KB
/
test_metaindex.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2021, earthobservations developers.
# Distributed under the MIT License. See LICENSE for more info.
""" tests for file index creation """
import aiohttp
import pytest
import requests
from wetterdienst.metadata.columns import Columns
from wetterdienst.metadata.period import Period
from wetterdienst.metadata.resolution import Resolution
from wetterdienst.provider.dwd.observation import DwdObservationDataset
from wetterdienst.provider.dwd.observation.metaindex import (
create_meta_index_for_climate_observations,
)
@pytest.mark.remote
def test_meta_index_creation():
# Existing combination of parameters
meta_index = create_meta_index_for_climate_observations(
DwdObservationDataset.CLIMATE_SUMMARY,
Resolution.DAILY,
Period.HISTORICAL,
)
assert not meta_index.empty
with pytest.raises(
(requests.exceptions.HTTPError, aiohttp.client_exceptions.ClientResponseError)
):
create_meta_index_for_climate_observations(
DwdObservationDataset.CLIMATE_SUMMARY,
Resolution.MINUTE_1,
Period.HISTORICAL,
)
@pytest.mark.remote
def test_meta_index_1mph_creation():
meta_index_1mph = create_meta_index_for_climate_observations(
DwdObservationDataset.PRECIPITATION,
Resolution.MINUTE_1,
Period.HISTORICAL,
)
assert meta_index_1mph.loc[
meta_index_1mph[Columns.STATION_ID.value] == "00003", :
].values.tolist() == [
[
"00003",
"18910101",
"20120406",
"202.00",
"50.7827",
"6.0941",
"Aachen",
"Nordrhein-Westfalen",
]
]