#!/bin/bash
## Usage

# module load python/3.6.1
# module load netcdf/4.2

leg_end_date=20050101
leg_start_date=20040101
model=fortran
amip_mode=forcing
amip_interpolate=No
ifs_cmip_fixyear=0

leg_length_sec=$(( $(date -u -d "${leg_end_date}" +%s) - $(date -u -d "${leg_start_date}" +%s) ))
cpl_freq_amip_sec=86400 # Always
leg_start_date_yyyymmdd=$(date -u -d "${leg_start_date}" +%Y%m%d)

if [ $model = fortran ] || [ $model = pythoncompat ]; then
    if [ $amip_mode = forcing ]; then
        #how it is done
        . ./namelist.amip.sh > ./namelist.amip  
        #how will be in YAML
         . ./namelist.amip_yaml.sh > ./namelist.amip.yaml       
        #how will be python
        # python3 yamlUtils.py \ 
        # --file_name namelist_toghether.yaml \
        # --leg_length_sec ${leg_length_sec} \
        # --cpl_freq_amip_sec ${cpl_freq_amip_sec} \
        # --leg_start_date_yyyy ${leg_start_date_yyyymmdd:0:4} \
        # --leg_start_date_mm ${leg_start_date_yyyymmdd:4:2} \
        # --leg_start_date_dd ${leg_start_date_yyyymmdd:6:2} \
        # --ifs_cmip_fixyear ${ifs_cmip_fixyear} \
        # --flist_sst ${flist_sst} \
        # --flist_sic ${flist_sic} \
        # --LDebug No\
        # --LInterpolate ${amip_interpolate} 
    fi
fi
