def CoupledChannel2(C, forcing, dt_f=((30 * 24) * 3600), ocn_mixing_ratio=0, restoring=False, ice_model=True, atm_adv=True, spatial_pattern=None, atm_DA_tendencies=None, ocn_DA_tendencies=None, return_coupled_fluxes=False, random_amp=0.1):
    '\n    This is the main function for the coupled ocean--atm channel model.\n    \n    ## INPUT VARIABLES ##\n    \n    tmax: running time in seconds\n    avep: averaging period for the ouput\n    T0: initial temperature\n    forcing: dimensionless scaling for the heat flux forcing - default strength is 5 W/m2\n    dt_f: timestep of the forcing\n    atm_adv: boolean, advective atmosphere\n    atm_ocn: boolean, advective ocean\n    ocn_mixing: add non-local mixing to ocean\n    ocn_mixing_ratio: 0-1 ratio between advection and mixing (0 only advection; 1 only mixing)\n    \n    '
    nt = int((C['tmax'] / C['dt']))
    nt1 = int((C['tmax'] / C['avep']))
    tau = (float(C['period']) / float(C['dt']))
    rtas = np.random.rand(C['nx'])
    sst = (C['T0'] * np.ones((2, C['nx'])))
    tas = ((C['T0'] * np.ones((2, C['nx']))) + rtas)
    hice = np.zeros((2, C['nx']))
    sst_boundary = (C['T0'] * np.ones(2))
    if np.all((forcing != None)):
        forcing = np.interp(np.arange(0, (len(forcing) * dt_f), C['dt']), np.arange(0, (len(forcing) * dt_f), dt_f), forcing)
    else:
        forcing = np.zeros((nt + 1))
    sst_out = np.zeros((nt1, C['nx']))
    tas_out = np.zeros((nt1, C['nx']))
    hice_out = np.zeros((nt1, C['nx']))
    sflx_f_out = np.zeros((nt1, C['nx']))
    sflx_out = np.zeros((nt1, C['nx']))
    if np.all((spatial_pattern == None)):
        spatial_pattern = np.ones(C['nx'])
    if np.all((atm_DA_tendencies != None)):
        use_atm_tendencies = True
    else:
        use_atm_tendencies = False
    if np.all((ocn_DA_tendencies != None)):
        use_ocn_tendencies = True
    else:
        use_ocn_tendencies = False
    atm_DA_tendencies = np.zeros((nt, C['nx']))
    ocn_DA_tendencies = np.zeros((nt, C['nx']))
    (tas_out, sst_out, hice_out, sflx_out, sflx_f_out, atm_DA_tendencies, ocn_DA_tendencies) = CoupledChannel_time(nt, C['nx'], C['xx'], C['dt'], C['avep'], sst, tas, hice, sst_boundary, sst_out, tas_out, hice_out, sflx_f_out, sflx_out, forcing, spatial_pattern, C['ra'], C['Cp'], C['va'], C['vo'], C['Da'], C['Do'], C['Cs'], C['T0'], C['Tf'], C['emissivity'], C['SW0'], C['SW_anom'], C['H'], C['Hb'], C['Cpo'], C['ro'], C['tau_entrainment'], C['Li'], C['ri'], use_ocn_tendencies, use_atm_tendencies, atm_DA_tendencies, ocn_DA_tendencies, ice_model, atm_adv, return_coupled_fluxes)
    if return_coupled_fluxes:
        return (tas_out, sst_out, hice_out, sflx_out, sflx_f_out, nt1, nt, atm_DA_tendencies, ocn_DA_tendencies)
    else:
        return (tas_out, sst_out, hice_out, sflx_out, sflx_f_out, nt1, nt)
This is the main function for the coupled ocean--atm channel model.

## INPUT VARIABLES ##

tmax: running time in seconds
avep: averaging period for the ouput
T0: initial temperature
forcing: dimensionless scaling for the heat flux forcing - default strength is 5 W/m2
dt_f: timestep of the forcing
atm_adv: boolean, advective atmosphere
atm_ocn: boolean, advective ocean
ocn_mixing: add non-local mixing to ocean
ocn_mixing_ratio: 0-1 ratio between advection and mixing (0 only advection; 1 only mixing)
def CoupledChannel2(C, forcing, dt_f=((30 * 24) * 3600), ocn_mixing_ratio=0, restoring=False, ice_model=True, atm_adv=True, spatial_pattern=None, atm_DA_tendencies=None, ocn_DA_tendencies=None, return_coupled_fluxes=False, random_amp=0.1):
    '\n    This is the main function for the coupled ocean--atm channel model.\n    \n    ## INPUT VARIABLES ##\n    \n    tmax: running time in seconds\n    avep: averaging period for the ouput\n    T0: initial temperature\n    forcing: dimensionless scaling for the heat flux forcing - default strength is 5 W/m2\n    dt_f: timestep of the forcing\n    atm_adv: boolean, advective atmosphere\n    atm_ocn: boolean, advective ocean\n    ocn_mixing: add non-local mixing to ocean\n    ocn_mixing_ratio: 0-1 ratio between advection and mixing (0 only advection; 1 only mixing)\n    \n    '
    nt = int((C['tmax'] / C['dt']))
    nt1 = int((C['tmax'] / C['avep']))
    tau = (float(C['period']) / float(C['dt']))
    rtas = np.random.rand(C['nx'])
    sst = (C['T0'] * np.ones((2, C['nx'])))
    tas = ((C['T0'] * np.ones((2, C['nx']))) + rtas)
    hice = np.zeros((2, C['nx']))
    sst_boundary = (C['T0'] * np.ones(2))
    if np.all((forcing != None)):
        forcing = np.interp(np.arange(0, (len(forcing) * dt_f), C['dt']), np.arange(0, (len(forcing) * dt_f), dt_f), forcing)
    else:
        forcing = np.zeros((nt + 1))
    sst_out = np.zeros((nt1, C['nx']))
    tas_out = np.zeros((nt1, C['nx']))
    hice_out = np.zeros((nt1, C['nx']))
    sflx_f_out = np.zeros((nt1, C['nx']))
    sflx_out = np.zeros((nt1, C['nx']))
    if np.all((spatial_pattern == None)):
        spatial_pattern = np.ones(C['nx'])
    if np.all((atm_DA_tendencies != None)):
        use_atm_tendencies = True
    else:
        use_atm_tendencies = False
    if np.all((ocn_DA_tendencies != None)):
        use_ocn_tendencies = True
    else:
        use_ocn_tendencies = False
    atm_DA_tendencies = np.zeros((nt, C['nx']))
    ocn_DA_tendencies = np.zeros((nt, C['nx']))
    (tas_out, sst_out, hice_out, sflx_out, sflx_f_out, atm_DA_tendencies, ocn_DA_tendencies) = CoupledChannel_time(nt, C['nx'], C['xx'], C['dt'], C['avep'], sst, tas, hice, sst_boundary, sst_out, tas_out, hice_out, sflx_f_out, sflx_out, forcing, spatial_pattern, C['ra'], C['Cp'], C['va'], C['vo'], C['Da'], C['Do'], C['Cs'], C['T0'], C['Tf'], C['emissivity'], C['SW0'], C['SW_anom'], C['H'], C['Hb'], C['Cpo'], C['ro'], C['tau_entrainment'], C['Li'], C['ri'], use_ocn_tendencies, use_atm_tendencies, atm_DA_tendencies, ocn_DA_tendencies, ice_model, atm_adv, return_coupled_fluxes)
    if return_coupled_fluxes:
        return (tas_out, sst_out, hice_out, sflx_out, sflx_f_out, nt1, nt, atm_DA_tendencies, ocn_DA_tendencies)
    else:
        return (tas_out, sst_out, hice_out, sflx_out, sflx_f_out, nt1, nt)