#!/usr/bin/env python3
# Copyright 2022 - Barcelona Supercomputing Center
# Authors: Etienne Tourigny, Rodrigo Martín Posada
# MIT License

from DataCoupler import DataCoupler

# Constants
NAMELIST_FILE_NAME = 'namelist.amip'
NAMELIST_SECTION = 'NAMAMIP'
LOG_FILE_NAME = 'amip.log'
CPLNG_COMP_NAME = 'AMIPFORC'

if __name__ == '__main__':
    # Setup
    amip = DataCoupler(NAMELIST_FILE_NAME, NAMELIST_SECTION, LOG_FILE_NAME)
    amip.setup_data_coupler()
    amip.setup_oasis(CPLNG_COMP_NAME, write_grid=True, write_grid_mask=True,
                     write_grid_corners= True, write_grid_areas = True)
    # Time loop
    amip.run_time_loop()
    # Finalize
    amip.finalise_data_coupler()

