Skip to content
Snippets Groups Projects
config.py 1.01 KiB
Newer Older
# -*- 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)