def read_data(archive, arc_type, day, stachans, length=<NUM_LIT>):
st = []<EOL>available_stations = _check_available_data(archive, arc_type, day)<EOL>for station in stachans:<EOL><INDENT>if len(station[<NUM_LIT:1>]) == <NUM_LIT:2>:<EOL><INDENT>station_map = (station[<NUM_LIT:0>], station[<NUM_LIT:1>][<NUM_LIT:0>] + '<STR_LIT:*>' + station[<NUM_LIT:1>][<NUM_LIT:1>])<EOL>available_stations_map = [(sta[<NUM_LIT:0>], sta[<NUM_LIT:1>][<NUM_LIT:0>] + '<STR_LIT:*>' + sta[<NUM_LIT:1>][-<NUM_LIT:1>])<EOL>for sta in available_stations]<EOL><DEDENT>else:<EOL><INDENT>station_map = station<EOL>available_stations_map = available_stations<EOL><DEDENT>if station_map not in available_stations_map:<EOL><INDENT>msg = '<STR_LIT:U+0020>'.join([station[<NUM_LIT:0>], station_map[<NUM_LIT:1>], '<STR_LIT>',<EOL>day.strftime('<STR_LIT>')])<EOL>warnings.warn(msg)<EOL>continue<EOL><DEDENT>if arc_type.lower() == '<STR_LIT>':<EOL><INDENT>client = SeishubClient(archive)<EOL>st += client.get_waveforms(<EOL>network='<STR_LIT:*>', station=station_map[<NUM_LIT:0>], location='<STR_LIT:*>',<EOL>channel=station_map[<NUM_LIT:1>], starttime=UTCDateTime(day),<EOL>endtime=UTCDateTime(day) + length)<EOL><DEDENT>elif arc_type.upper() == "<STR_LIT>":<EOL><INDENT>client = FDSNClient(archive)<EOL>try:<EOL><INDENT>st += client.get_waveforms(<EOL>network='<STR_LIT:*>', station=station_map[<NUM_LIT:0>], location='<STR_LIT:*>',<EOL>channel=station_map[<NUM_LIT:1>], starttime=UTCDateTime(day),<EOL>endtime=UTCDateTime(day) + length)<EOL><DEDENT>except FDSNException:<EOL><INDENT>warnings.warn('<STR_LIT>' +<EOL>'<STR_LIT>')<EOL>continue<EOL><DEDENT><DEDENT>elif arc_type.lower() == '<STR_LIT>':<EOL><INDENT>wavfiles = _get_station_file(os.path.join(<EOL>archive, day.strftime('<STR_LIT>' + os.sep + '<STR_LIT>')),<EOL>station_map[<NUM_LIT:0>], station_map[<NUM_LIT:1>])<EOL>for wavfile in wavfiles:<EOL><INDENT>st += read(wavfile, starttime=day, endtime=day + length)<EOL><DEDENT><DEDENT><DEDENT>st = Stream(st)<EOL>return st<EOL>
Function to read the appropriate data from an archive for a day.

    :type archive: str
    :param archive:
        The archive source - if arc_type is seishub, this should be a url,
        if the arc_type is FDSN then this can be either a url or a known obspy
        client.  If arc_type is day_vols, then this is the path to the top
        directory.
    :type arc_type: str
    :param arc_type: The type of archive, can be: seishub, FDSN, day_volumes
    :type day: datetime.date
    :param day: Date to retrieve data for
    :type stachans: list
    :param stachans: List of tuples of Stations and channels to try and get,
        will not fail if stations are not available, but will warn.
    :type length: float
    :param length: Data length to extract in seconds, defaults to 1 day.

    :returns: Stream of data
    :rtype: obspy.core.stream.Stream

    .. note:: A note on arc_types, if arc_type is day_vols, then this will \
        look for directories labelled in the IRIS DMC conventions of \
        Yyyyy/Rjjj.01/... where yyyy is the year and jjj is the julian day. \
        Data within these files directories should be stored as day-long, \
        single-channel files.  This is not implemented in the fasted way \
        possible to allow for a more general situation.  If you require more \
        speed you will need to re-write this.

    .. rubric:: Example

    >>> from obspy import UTCDateTime
    >>> t1 = UTCDateTime(2012, 3, 26)
    >>> stachans = [('JCNB', 'SP1')]
    >>> st = read_data('NCEDC', 'FDSN', t1, stachans)
    >>> print(st)
    1 Trace(s) in Stream:
    BP.JCNB.40.SP1 | 2012-03-26T00:00:00.000000Z - 2012-03-26T23:59:59.\
950000Z | 20.0 Hz, 1728000 samples

    .. rubric:: Example, missing data

    >>> t1 = UTCDateTime(2012, 3, 26)
    >>> stachans = [('JCNB', 'SP1'), ('GCSZ', 'HHZ')]
    >>> st = read_data('NCEDC', 'FDSN', t1, stachans)
    >>> print(st)
    1 Trace(s) in Stream:
    BP.JCNB.40.SP1 | 2012-03-26T00:00:00.000000Z - 2012-03-26T23:59:59.\
950000Z | 20.0 Hz, 1728000 samples


    .. rubric:: Example, local day-volumes

    >>> # Get the path to the test data
    >>> import eqcorrscan
    >>> TEST_PATH = os.path.dirname(eqcorrscan.__file__) + '/tests/test_data'
    >>> t1 = UTCDateTime(2012, 3, 26)
    >>> stachans = [('WHYM', 'SHZ'), ('EORO', 'SHZ')]
    >>> st = read_data(TEST_PATH + '/day_vols', 'day_vols',
    ...                t1, stachans)
    >>> print(st)
    2 Trace(s) in Stream:
    AF.WHYM..SHZ | 2012-03-26T00:00:00.000000Z - 2012-03-26T23:59:59.000000Z \
| 1.0 Hz, 86400 samples
    AF.EORO..SHZ | 2012-03-26T00:00:00.000000Z - 2012-03-26T23:59:59.000000Z \
| 1.0 Hz, 86400 samples