# 5.1.1.1. eqcorrscan.utils.archive_read.read_data

`eqcorrscan.utils.archive_read.``read_data`(archive, arc_type, day, stachans, length=86400)

  Function to read the appropriate data from an archive for a day.

  Parameters: | archive (str) 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. arc_type (str) The type of archive, can be: seishub, FDSN, day_volumes day (datetime.date) Date to retrieve data for stachans (list) List of tuples of Stations and channels to try and get, will not fail if stations are not available, but will warn. length (float) Data length to extract in seconds, defaults to 1 day.
  Returns: | Stream of data
  Return type: | 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.

  Example

      >>> from eqcorrscan.utils.archive_read import read_data
      >>> 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

  Example, missing data

      >>> from eqcorrscan.utils.archive_read import read_data
      >>> from obspy import UTCDateTime
      >>> 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

  Example, local day-volumes

      >>> from eqcorrscan.utils.archive_read import read_data
      >>> from obspy import UTCDateTime
      >>> t1 = UTCDateTime(2012, 3, 26)
      >>> stachans = [('WHYM', 'SHZ'), ('EORO', 'SHZ')]
      >>> st = read_data('eqcorrscan/tests/test_data/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