def sfiles_to_event(sfile_list):
event_list = []<EOL>sort_list = [(readheader(sfile).origins[<NUM_LIT:0>].time, sfile)<EOL>for sfile in sfile_list]<EOL>sort_list.sort(key=lambda tup: tup[<NUM_LIT:0>])<EOL>sfile_list = [sfile[<NUM_LIT:1>] for sfile in sort_list]<EOL>catalog = Catalog()<EOL>for i, sfile in enumerate(sfile_list):<EOL><INDENT>event_list.append((i, sfile))<EOL>catalog.append(readheader(sfile))<EOL><DEDENT>write_event(catalog)<EOL>return event_list<EOL>
Write an event.dat file from a list of Seisan events

:type sfile_list: list
:param sfile_list: List of s-files to sort and put into the database

:returns: List of tuples of event ID (int) and Sfile name