#! /usr/bin/env python # # obspy antelope module # by Mark Williams 2012.013 # Oregon State University # # Contains basic functions to interect with (read) data from Antelope # Datascope database tables into ObsPy using the Antelope Python interface. from numpy import array from obspy.core import read, Stream, UTCDateTime from obspy_ext.antelope.utils import add_antelope_path from obspy_ext.antelope.dbobjects import Dbrecord, DbrecordList # Antelope path to python tools not added by default install add_antelope_path() # adds path if not there from antelope.datascope import * # all is necessary for db query variables def db2object(dbv): """ Port of Antelope MATLAB toolbox 'db2struct' function. Returns a list-like object, this is the function version of calling DbrecordList() directly. :type dbv: antelope.datascope.Dbptr :param dbv: Open pointer to an Antelope database view or table :rtype: :class:`~obspy.antelope.Dbview` :return: Dbview of Dbrecord objeccts """
# dbobjptrs.py # # obspy antelope database object pointers module # by Mark Williams 2012.013 # Oregon State University # # Contains basic classes to interect with data from Antelope # Datascope database tables using the Antelope Python interface. # # These do NOT depend on ObsPy, one can use them with only the Antleope API # However they hold database pointers (Dbptrs) which must point to open # databases for the classes to work properly. The advantage is speed and # memory footprint when working with large database tables. from obspy_ext.antelope.utils import add_antelope_path add_antelope_path() from antelope.datascope import * # all is necessary for db query variables from numpy import array class DbrecordPtr(dict, object): """ Holds the pointer to a db record, NOT the data, can access the same as Dbrecord, but the pointer must remain open Useful for large datasets that may have trouble in memory Only stores the pointer, not contents, all attributes are returned by querying the open db using the pointer. """ # Only holds one thing in Python namespace, Dbptr object: Ptr = Dbptr()
#! /usr/bin/env python # # obspy antelope module # by Mark Williams 2012.013 # Oregon State University # # Contains basic functions to interect with (read) data from Antelope # Datascope database tables into ObsPy using the Antelope Python interface. from numpy import array from obspy.core import read, Stream, UTCDateTime from obspy_ext.antelope.utils import add_antelope_path from obspy_ext.antelope.dbobjects import Dbrecord, DbrecordList # Antelope path to python tools not added by default install add_antelope_path() # adds path if not there from antelope.datascope import * # all is necessary for db query variables def db2object(dbv): """ Port of Antelope MATLAB toolbox 'db2struct' function. Returns a list-like object, this is the function version of calling DbrecordList() directly. :type dbv: antelope.datascope.Dbptr :param dbv: Open pointer to an Antelope database view or table :rtype: :class:`~obspy.antelope.Dbview` :return: Dbview of Dbrecord objeccts """ if isinstance(dbv, Dbptr):