__author__ = "Lukas Leufen"
__date__ = '2019-11-14'

import argparse

from mlair.workflows import DefaultWorkflow
from mlair.data_handler.data_handler_mixed_sampling import DataHandlerMixedSampling, DataHandlerMixedSamplingWithFilter, \
    DataHandlerSeparationOfScales

stats = {'o3': 'dma8eu', 'no': 'dma8eu', 'no2': 'dma8eu',
         'relhum': 'average_values', 'u': 'average_values', 'v': 'average_values',
         'cloudcover': 'average_values', 'pblheight': 'maximum',
         'temp': 'maximum'}
data_origin = {'o3': '', 'no': '', 'no2': '',
               'relhum': 'REA', 'u': 'REA', 'v': 'REA',
               'cloudcover': 'REA', 'pblheight': 'REA',
               'temp': 'REA'}


def main(parser_args):
    args = dict(stations=["DEBW107", "DEBW013"],
                network="UBA",
                evaluate_bootstraps=False, plot_list=[],
                data_origin=data_origin, data_handler=DataHandlerMixedSampling,
                interpolation_limit=(3, 1), overwrite_local_data=False,
                sampling=("hourly", "daily"),
                statistics_per_var=stats,
                create_new_model=True, train_model=False, epochs=1,
                window_history_size=6 * 24 + 16,
                window_history_offset=16,
                kz_filter_length=[100 * 24, 15 * 24],
                kz_filter_iter=[4, 5],
                start="2006-01-01",
                train_start="2006-01-01",
                end="2011-12-31",
                test_end="2011-12-31",
                **parser_args.__dict__,
                )
    workflow = DefaultWorkflow(**args, start_script=__file__)
    workflow.run()


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument('--experiment_date', metavar='--exp_date', type=str, default=None,
                        help="set experiment date as string")
    args = parser.parse_args(["--experiment_date", "testrun"])
    main(args)