示例#1
0
文件: main.py 项目: LEONOB2014/pisces
def sac2db_command(**kwargs):
    """
    Scrape SAC files into database tables.

    SAC files may be used to produce the following tables: Wfdisc, Site,
    Sitechan, Origin, Event, Arrival, Assoc, Lastid, and Instrument.  Id
    numbering will follow the Lastid table, if one is found, otherwise it will
    start from 1.

    \b
    Examples
    --------
    # use standard table names to local test.sqlite file
    pisces sac2db sqlite:///test.sqlite datadir/*.sac

    \b
    # prefix all tables in an oracle account with prefix my_, prompt for password
    pisces sac2db --prefix my_ oracle://[email protected]:port/dbname datadir/*.sac

    \b
    # if there are too many SAC files for the shell to handle, use a list:
    find datadir -name "*.sac" -print > saclist.txt
    sac2db.py sqlite:///test.sqlite saclist.txt

    """
    # TODO: make this and mseed2db do more file handling here.  The main functions
    # should really be handling traces if possible, so they can be used more
    # broadly in the main library

    # common local functions
    session = url_connect(kwargs['db'])

    # command-specific funtions
    sac2db.main(session=session, **kwargs)
示例#2
0
文件: main.py 项目: LEONOB2014/pisces
def mseed2db_command(db, files, file_list, prefix, absolute_paths):
    """
    Scrape MSEED files into database tables.

    MSEED files may be used to produce the following tables: Wfdisc, Site,
    Sitechan, and Lastid.  Id numbering will follow the Lastid table,
    if one is found, otherwise it will start from 1.

    \b
    Notes
    -----
    The datatype in the wfdisc table will be "sd", which is _not_ a standard
    datatype.  It will unpack into int32 arrays if pisces.io.readwaveform is used.
    The miniSEED header is very minimal, so it will produce site and sitechan
    entries that are incomplete.  Notably, site will not have coordinates in it.

    """
    session = url_connect(db)
    mseed2db.main(session, files, file_list, prefix, absolute_paths)
示例#3
0
def get_session(options):
	# accept command line arguments, return a database-bound session.
	session = url_connect(options.url)

	return session
示例#4
0
def get_session(options):
    # accept command line arguments, return a database-bound session.
    session = url_connect(options.url)

    return session