forked from bpross-52n/quakeledger
-
Notifications
You must be signed in to change notification settings - Fork 1
/
eventdb.py
71 lines (63 loc) · 2.65 KB
/
eventdb.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python3
'''
ORM classes to access the data in the database
'''
from sqlalchemy import Column, Float, Integer, String
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class DeaggregationData(Base):
'''Class for accessing the data for the mean disaggregation'''
__tablename__ = 'mean_disagg'
id = Column('index', Integer, primary_key=True)
sid = Column('sid', Integer)
poe50y = Column('poe50y', Float)
lon = Column('Lon', Float)
lat = Column('Lat', Float)
mag = Column('Mag', Float)
poe = Column('poe', Float)
def __repr__(self):
return '<DisaggData(sid=%d, poe50y=%f, lon=%f, lat=%f, mag=%f, poe=%f)>' % (
self.sid, self.poe50y, self.lon, self.lat, self.mag, self.poe)
class Site(Base):
'''Class to access the data of the sites'''
__tablename__ = 'sites'
id = Column('index', Integer, primary_key=True)
sid = Column('sid', Integer)
lon = Column('lon', Float)
lat = Column('lat', Float)
def __repr__(self):
return '<Site(sid=%d, lon=%f, lat=%f)>' % (
self.sid, self.lon, self.lat)
class Event(Base):
'''Class to access to data of the earth quake events'''
__tablename__ = 'events'
id = Column('index', Integer, primary_key=True)
eventID = Column('eventID', String)
identifier = Column('Identifier', String)
year = Column('year', Integer)
month = Column('month', Float)
day = Column('day', Float)
hour = Column('hour', Float)
minute = Column('minute', Float)
second = Column('second', Float)
timeUncertainty = Column('timeUncertainty', Float)
longitude = Column('longitude', Float)
longitudeUncertainty = Column('longitudeUncertainty', Float)
latitude = Column('latitude', Float)
latitudeUncertainty = Column('latitudeUncertainty', Float)
horizontalUncertainty = Column('horizontalUncertainty', Float)
minHorizontalUncertainty = Column('minHorizontalUncertainty', Float)
maxHorizontalUncertainty = Column('maxHorizontalUncertainty', Float)
azimuthMaxHorizontalUncertainty = Column('azimuthMaxHorizontalUncertainty', Float)
depth = Column('depth', Float)
depthUncertainty = Column('depthUncertainty', Float)
magnitude = Column('magnitude', Float)
magnitudeUncertainty = Column('magnitudeUncertainty', Float)
rake = Column('rake', Float)
rakeUncertainty = Column('rakeUncertainty', Float)
dip = Column('dip', Float)
dipUncertainty = Column('dipUncertainty', Float)
strike = Column('strike', Float)
strikeUncertainty = Column('strikeUncertainty', Float)
type_ = Column('type', String)
probability = Column('probability', Float)