pisces.commands#

Subpackage in support of the Pisces command line.

Submodules#

Command Line Interface#

pisces#

Pisces command-line interface.

Commonly-used functionality is exposed as subcommands of this top-level function. See “Commands” for things you can do. Common ARGS are described below.

Arguments:
DB SQLAlchemy-compatible database URI string.
e.g. sqlite:///localdb.sqlite
oracle://user[:password]@server:port/database
(leave out password blank for prompt)
May also be defined as an environmental variable PISCESDB.
pisces [OPTIONS] COMMAND [ARGS]...

Options

-V, --version#

Show the version and exit.

create#

Create core tables.

Not yet implemented.

pisces create [OPTIONS] DB

Arguments

DB#

Required argument

drop#

Drop core tables.

Not yet implemented.

pisces drop [OPTIONS] DB

Arguments

DB#

Required argument

mseed2db#

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.

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.
pisces mseed2db [OPTIONS] DB [FILES]...

Options

-p, --prefix <prefix>#

Target tables using ‘account.prefix naming. e.g. myaccount.test_ will target tables like myaccount.test_origin, myaccount.test_sitechan.

-A, --absolute_paths#

If set, write database ‘dir’ directory entries as absolute paths, not relative.

-l, --file_list <file_list>#

A list file, one file name per line.

Arguments

DB#

Required argument

FILES#

Optional argument(s)

Environment variables

PISCESDB

Provide a default for DB

sac2db#

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.

Examples
——–
# use standard table names to local test.sqlite file
pisces sac2db sqlite:///test.sqlite datadir/*.sac
# prefix all tables in an oracle account with prefix my_, prompt for password
pisces sac2db –prefix my_ oracle://user@server.domain.com:port/dbname datadir/*.sac
# 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
pisces sac2db [OPTIONS] DB [FILES]...

Options

-p, --prefix <prefix>#

Target tables using ‘account.prefix naming. e.g. myaccount.test_ will target tables like myaccount.test_origin, myaccount.test_sitechan.

-A, --absolute_paths#

If set, write database ‘dir’ directory entries as absolute paths, not relative.

--bbfk#

If set, get site.deast and dnorth from SAC user7 & user8 header fields.

-l, --file_list <file_list>#

A list file, one file name per line.

Arguments

DB#

Required argument

FILES#

Optional argument(s)

Environment variables

PISCESDB

Provide a default for DB