def survey_cadence_arrays(log, surveyCadenceSettings, pathToOutputDirectory,
    pathToOutputPlotDirectory, plot=False):
    """
    *Generate the survey cadence arrays for each filter*

    **Key Arguments:**
        - ``log`` -- logger
        - ``surveyCadenceSettings`` -- the survey cadence parameters as set in the simulation settings file
        - ``pathToOutputDirectory`` -- path to the output directory (provided by the user)
        - ``pathToOutputPlotDirectory`` -- path to add plots to
        - ``plot`` -- generate plot?

    **Return:**
        - ``cadenceDictionary`` -- a dictionary of { band : observedDayList }
    """
    import numpy as np
    import matplotlib.pyplot as plt
    lunarMonth = 29.3
    surveyYear = 12.0 * lunarMonth
    cadenceDictionary = {}
    obsFraction = surveyCadenceSettings['Observable Fraction of Year']
    lossFraction = surveyCadenceSettings['Fraction of Year Lost to Weather etc'
        ]
    for thisFilter in surveyCadenceSettings['Filters']:
        band = thisFilter['band']
        firstDay = thisFilter['day of year of first scheduled observation']
        repeatEvery = thisFilter['repeat every ? days']
        moonFraction = thisFilter['Fraction of Lunar Month Lost to Moon']
        finalObsDayOfMonth = lunarMonth * (1.0 - moonFraction)
        monthCount = 0
        day = 1
        monthDay = 1
        moonDayList = []
        while day < surveyYear:
            while monthDay < int(lunarMonth):
                if monthDay <= finalObsDayOfMonth:
                    moonDayList.append(day)
                monthDay += 1
                day += 1
            monthCount += 1
            day = int(lunarMonth * monthCount)
            monthDay = 0
        day = firstDay
        nextObs = firstDay
        obsDaysList = []
        finalObsDayOfYear = obsFraction * surveyYear
        while day <= finalObsDayOfYear:
            randNum = np.random.rand()
            if day == nextObs:
                if day in moonDayList and randNum > lossFraction:
                    obsDaysList.append(day)
                nextObs = day + repeatEvery
            day += 1
        cadenceDictionary[band] = obsDaysList
    if plot:
        fig = plt.figure(num=None, figsize=(8, 8), dpi=600, facecolor=None,
            edgecolor=None, frameon=True)
        ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True, frameon=False)
        ax.set_ylim(0, 12)
        for k, v in cadenceDictionary.iteritems():
            x = 2 * np.pi * np.array(v) / surveyYear
            y = np.ones(len(x)) * 10.0
            if k in ['g', 'B']:
                color = '#268bd2'
            elif k in ['r', 'V']:
                color = '#859900'
            elif k in ['R', 'i']:
                color = '#cb4b16'
            elif k in ['I', 'z']:
                color = '#dc322f'
            else:
                color = '#b58900'
            plt.scatter(x, y, s=50, c=color, marker='o', cmap=None, norm=
                None, vmin=None, vmax=None, alpha=0.5, linewidths=None,
                edgecolor='w', verts=None, hold=True)
        circleTicks = np.arange(0, 350, 30)
        tickLabels = []
        for tick in circleTicks:
            tickLabels.append('%s days' % (tick,))
        plt.xticks(2 * np.pi * circleTicks / surveyYear, tickLabels)
        plt.yticks([])
        title = 'Cadence Wheel for Simulated Survey'
        plt.title(title)
        fileName = pathToOutputPlotDirectory + title.replace(' ', '_') + '.png'
        plt.savefig(fileName)
        plt.clf()
    return cadenceDictionary
