# 5.15.1.2. eqcorrscan.utils.sfile_util.eventtosfile

`eqcorrscan.utils.sfile_util.``eventtosfile`(event, userID, evtype, outdir, wavefiles, explosion=False, overwrite=False)

  Write an obspy.event to a nordic formatted s-file.

  Parameters: | event (obspy.core.event.Event) A single obspy event userID (str) Up to 4 character user ID evtype (str) Single character string to describe the event, either L, R or D. outdir (str) Path to directory to write to wavefiles (list) Waveforms to associate the sfile with explosion (bool) Note if the event is an explosion, will be marked by an E. overwrite (bool) force to overwrite old files, defaults to False
  Returns: | str: name of sfile written

  Note

  Seisan can find waveforms either by their relative or absolute path, or by looking for the file recursively in directories within the WAV directory in your seisan install. Because all lines need to be less than 79 ccharacterslong (fortran hangover) in the s-files, you will need to determine whether the full-path is okay or not.

      >>> import obspy
      >>> # Note that this example shows how to download from GeoNet which
      >>> # doesn't have full fdsn capability.
      >>> if int(obspy.__version__.split('.')[0]) >= 1:
      ...    from obspy.clients.fdsn import Client
      ...    from obspy import read_events
      ... else:
      ...    from obspy.fdsn import Client
      ...    from obspy import readEvents as read_events
      >>> client = Client('GEONET')
      >>> data_stream = client._download('http://quakeml.geonet.org.nz/' +
      ...                                'quakeml/1.2/2016p008122')
      >>> close = data_stream.seek(0, 0)
      >>> catalog = read_events(data_stream, format="quakeml")
      >>> data_stream.close()
      >>> eventtosfile(catalog[0], 'TEST', 'R', '.', ['DUMMY'], overwrite=True)
      '04-0007-55R.S201601'