示例#1
0
 def __init__(self, segy, *args, **kwargs):
     self.TRACE_TABLE = kwargs.pop('trace_table', TRACE_TABLE)
     self.TRACE_FIELDS = kwargs.pop('trace_fields', TRACE_FIELDS)
     if 'database' not in kwargs:
         database = ':memory:'
     else:
         database = kwargs['database']
     RockfishDatabaseConnection.__init__(self, database)
     # add header values to the database
     self.init_header_database(segy)
示例#2
0
    def __init__(self, filename=None, database=':memory:', *args, **kwargs):
        """
        Class for working with UKOOA P1/90 data.

        :param filename: Optional. Filename of a P1/90 file to read data from.
            Default is to create an empty P190 class instance.
        :param database: Optional. Filename of a SQLite database to store P1/90
            data in. Default is to create a temporary database in memory.
        :param *args: Optional.  Arguments to pass to
            :class:`sqlite3.Connection`
        :param *kwargs: Optional.  Keyword arguments to pass to
            :class:`sqlite3.Connection`
        """
        RockfishDatabaseConnection.__init__(self, database, *args, **kwargs)
        self.HEADER_TABLE = HEADER_TABLE
        self.COORDINATE_TABLE = COORDINATE_TABLE
        self.RECEIVER_TABLE = RECEIVER_TABLE
        self._create_tables()

        if filename: 
            self.filename = filename
            self.read()
示例#3
0
 def __init__(self, database, *args, **kwargs):
     # pull key words from kwargs that apply to this init only
     if 'extra_pick_fields' in kwargs:
         extra_pick_fields = kwargs.pop('extra_pick_fields')
     else:
         extra_pick_fields = None
     if 'extra_trace_fields' in kwargs:
         extra_trace_fields = kwargs.pop('extra_trace_fields')
     else:
         extra_trace_fields = None
     if 'extra_event_fields' in kwargs:
         extra_event_fields = kwargs.pop('extra_event_fields')
     else:
         extra_event_fields = None
     # tell user that this is a new database
     if not os.path.isfile(database):
         print "Creating new database: {:}".format(database)
     # create the base instance
     RockfishDatabaseConnection.__init__(self, database, *args, **kwargs)
     # build tables
     self.PICK_TABLE = PICK_TABLE
     self.PICK_FIELDS = PICK_FIELDS
     self.create_pick_table(extra_fields=extra_pick_fields)
     self.EVENT_TABLE = EVENT_TABLE
     self.EVENT_FIELDS = EVENT_FIELDS
     self.create_event_table(extra_fields=extra_event_fields)
     self.TRACE_TABLE = TRACE_TABLE
     self.TRACE_FIELDS = TRACE_FIELDS
     self.create_trace_table(extra_fields=extra_trace_fields)
     # create views
     self.MASTER_VIEW = MASTER_VIEW
     self.VMTOMO_PICK_VIEW = VMTOMO_PICK_VIEW
     self.VMTOMO_PICK_FIELDS = VMTOMO_PICK_FIELDS
     self.VMTOMO_SHOT_VIEW = VMTOMO_SHOT_VIEW
     self.VMTOMO_SHOT_FIELDS = VMTOMO_SHOT_FIELDS
     self.VMTOMO_INSTRUMENT_VIEW = VMTOMO_INSTRUMENT_VIEW
     self.VMTOMO_INSTRUMENT_FIELDS = VMTOMO_INSTRUMENT_FIELDS
     self.create_views()