Coverage for mlair/configuration/toar_data_v2_settings.py: 85%

9 statements  

« prev     ^ index     » next       coverage.py v6.4.2, created at 2023-06-30 10:22 +0000

1"""Settings to access https://toar-data.fz-juelich.de""" 

2from typing import Tuple, Dict 

3 

4 

5def toar_data_v2_settings(sampling="daily") -> Tuple[str, Dict]: 

6 """ 

7 Set url for toar-data and required headers. Headers information is not required for now. 

8 

9 :param sampling: temporal resolution to access. 

10 :return: Service url and optional headers 

11 """ 

12 if sampling == "daily": # pragma: no branch 

13 TOAR_SERVICE_URL = "https://toar-data.fz-juelich.de/api/v2/analysis/statistics/" 

14 headers = {} 

15 elif sampling == "hourly" or sampling == "meta": 15 ↛ 19line 15 didn't jump to line 19, because the condition on line 15 was never false

16 TOAR_SERVICE_URL = "https://toar-data.fz-juelich.de/api/v2/" 

17 headers = {} 

18 else: 

19 raise NameError(f"Given sampling {sampling} is not supported, choose from either daily or hourly sampling.") 

20 return TOAR_SERVICE_URL, headers