Coverage for mlair/configuration/era5_settings.py: 38%

6 statements  

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

1"""Settings to access not public era5 data.""" 

2 

3from typing import Tuple 

4 

5 

6def era5_settings(sampling="daily", era5_data_path=None, era5_file_names=None) -> Tuple[str, str]: 

7 """ 

8 Check for sampling as only hourly resolution is supported by era5 and return path on HPC systems. 

9 

10 :param sampling: temporal resolution to load data for, only hourly supported (default "daily") 

11 

12 :return: HPC path 

13 """ 

14 if sampling == "hourly": # pragma: no branch 

15 ERA5_DATA_PATH = era5_data_path or "." 

16 FILE_NAMES = era5_file_names or "*.nc" 

17 else: 

18 raise NameError(f"Given sampling {sampling} is not supported, only hourly sampling can be used.") 

19 return ERA5_DATA_PATH, FILE_NAMES