Newer
Older
Jeremy Auclair
committed
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
# -*- coding: UTF-8 -*-
# Python
"""
07-12-2022
@author: jeremy auclair
"""
# Create class that contains configuration file date
import json # to open config file
class config:
"""
The `Config` class contains input parameters necessary for the Vegetation and Weather parts to run.
It loads all these parameters from the `.json` input file and loads it automatically.
### Attributes
- start_date: `str`
- end_date: `str`
- path_to_config_file: `str`
- shapefile_path: `str`
- download_path: `str`
- era5_path: `str`
- run_name: `str`
- preferred_provider: `str`
- ndvi_overwrite: `bool`
- cloud_cover_limit: `int`
- max_cpu: `int`
"""
# Constructor
def __init__(self, config_file: str) -> None:
# Load json file
with open(config_file, "r") as read_file:
input_data = json.load(read_file)
# Add attributes in new object
for key, value in input_data.items():
setattr(self, key.strip(), value)