class EDXRFRank(db.Model): __tablename__ = 'ranks' __bind_key__ = 'edxrf' rid = db.Column(db.Integer, db.ForeignKey('KIERZ.rid'), db.ForeignKey('KISUM.rid'), primary_key=True) name = db.Column(db.String(24), unique=True) rank = db.Column(db.Integer)
class station(db.Model): __tablename__ = 'tremor_sta' __bind_key__ = 'tremor' evid = db.Column(db.Integer, db.ForeignKey('tremor_catalog.evid'), primary_key=True) sta = db.Column(db.String(5)) chan = db.Column(db.String(3)) staKey = db.Column(db.Integer, primary_key=True) chanKey = db.Column(db.Integer, primary_key=True) def __repr__(self): return '%d, %s, %s' % (self.evid, self.sta, self.chan)
class HMM(db.Model): __tablename__ = 'HMM' __bind_key__ = 'ash' timestamp = db.Column('j2ksec', db.Float, primary_key=True) accumrate = db.Column(db.Float) percentjuvenile = db.Column(db.Float) tid = db.Column(db.Integer) rid = db.Column(db.Integer, primary_key=True) def __init__(self, time='', ar='', pj=''): self.timestamp = date_to_j2k(time, False) self.accumrate = '%.3f' % float(ar) if ar != '' else None self.percentjuvenile = '%.2f' % float(pj) if pj != '' else None self.tid = 2 self.rid = 1
class catalog(db.Model): __tablename__ = 'tremor_catalog' __bind_key__ = 'tremor' evid = db.Column(db.Integer, primary_key=True) methodid = db.Column(db.Integer) starttime = db.Column(db.DateTime) latitude = db.Column(db.Float) longitude = db.Column(db.Float) depth = db.Column(db.Float) region = db.Column(db.String(2)) iseq = db.Column(db.Integer) stations = db.relationship('station', backref='catalog', viewonly=True) def __repr__(self): return '%s, %f, %f, %f, region=%s, iseq=%d' % ( self.starttime, self.latitude, self.longitude, self.depth, self.region, self.iseq)
class EDXRFBase(object): __bind_key__ = 'edxrf' timestamp = db.Column('j2ksec', db.Float, primary_key=True) rb = db.Column(db.Float) sr = db.Column(db.Float) y = db.Column(db.Float) zr = db.Column(db.Float) nb = db.Column(db.Float) tid = db.Column(db.Integer) rid = db.Column(db.Integer, primary_key=True) @declared_attr def rank(self): return db.relationship('EDXRFRank', uselist=False, viewonly=True) @declared_attr def translation(self): return db.relationship('EDXRFTranslation', uselist=False, viewonly=True)
class EDXRFTranslation(db.Model): __tablename__ = 'translations' __bind_key__ = 'edxrf' tid = db.Column(db.Integer, db.ForeignKey('KIERZ.tid'), db.ForeignKey('KISUM.tid'), primary_key=True) name = db.Column(db.String(255)) crb = db.Column(db.Float) drb = db.Column(db.Float) csr = db.Column(db.Float) dsr = db.Column(db.Float) cy = db.Column(db.Float) dy = db.Column(db.Float) czr = db.Column(db.Float) dzr = db.Column(db.Float) cnb = db.Column(db.Float) dnb = db.Column(db.Float)