#!/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.co2box'
NAMELIST_SECTION = 'NAMCO2BOX'
LOG_FILE_NAME = 'co2box.log'
CPLNG_COMP_NAME = 'CO2BOX'

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

