def write_gwosc_string(config, ifos, outdir):
    """
        Write command string to execute bajes_read_gwosc.py
        given a config file
    """

    read_string = 'bajes_read_gwosc.py --outdir {} '.format(outdir)
    
    try:
        read_string += '--event {} '.format(config['gw-data']['event'])
    except Exception:
        pass

    try:
        read_string += '--version {} '.format(config['gw-data']['version'])
    except Exception:
        pass

    for ifo in ifos:
        read_string += '--ifo {} '.format(ifo)

    read_string += '--seglen {} '.format(config['gw-data']['seglen'])
    read_string += '--srate {} '.format(config['gw-data']['srate'])
    read_string += '--t-gps {} '.format(config['gw-data']['t-gps'])

    return read_string