In [42]:
import matplotlib.pyplot as plt
import numpy as np
from rockfish2.navigation.ukooa.p190.p190 import P190
from rockfish2.utils.loaders import get_example_file
test_p190_file = get_example_file('MGL1407MCS15.TEST.p190')
print test_p190_file
In [3]:
p190 = P190(input_srid=32619)
p190.read_p190(test_p190_file)
In [4]:
sql = "SELECT line, point, cable_id, chan, DISTANCE(src_pt, rec_pt) AS offset, rec_depth AS depth FROM p190_src_rec_view"
dat = p190.read_sql(sql)
dat.describe()
Out[4]:
In [5]:
dat = p190.read_sql('select * from p190_src_rec_view')
stat = dat.describe()
In [14]:
stat.ix['count']
Out[14]:
In [13]:
fig = plt.figure(figsize=(10, 10))
ax = fig.add_subplot(111)
nrp = p190.read_sql("SELECT X(geom) AS x, Y(geom) AS y FROM p190_coords WHERE record_id='V'")
cos = p190.read_sql("SELECT X(geom) AS x, Y(geom) AS y FROM p190_coords WHERE record_id='S'")
tb = p190.read_sql("SELECT X(geom) AS x, Y(geom) AS y FROM p190_coords WHERE record_id='T'")
mp = p190.read_sql("SELECT X(mid_pt) AS x, Y(mid_pt) AS y FROM p190_src_rec_view")
ax.plot(mp.x, mp.y, '.b')
ax.plot(nrp.x, nrp.y, '.k')
ax.plot(cos.x, cos.y, '.r')
ax.plot(tb.x, tb.y, '.g')
Out[13]:
In [14]:
sql = "SELECT X(rec_pt) - X(src_pt) AS x, Y(rec_pt) - Y(src_pt) AS y FROM p190_src_rec_view"
rel = p190.read_sql(sql)
In [24]:
fig = plt.figure(figsize=(10, 10))
ax = fig.add_subplot(111)
ax.plot(0, 0, '*r', markersize=20)
ax.plot(rel.x, rel.y, '.-k')
plt.xlim(-8500, 8500)
plt.ylim(-8500, 8500)
Out[24]:
In [38]:
sql = "SELECT chan, DISTANCE(src_pt, rec_pt) AS offset FROM p190_src_rec_view"
dat = p190.read_sql(sql)
#sql = "SELECT chan, AVG(DISTANCE(src_pt, rec_pt)) AS offset FROM p190_src_rec_view GROUP BY chan"
#dat_mean = p190.read_sql(sql)
dat.groupby('chan').describe()
Out[38]:
In [35]:
plot(dat.chan, dat.offset, '.k')
plot(dat_mean.chan, dat_mean.offset, '.r')
Out[35]:
In [36]:
dat_mean
Out[36]:
In [39]:
sql = "SELECT chan, DISTANCE(src_pt, rec_pt) AS offset FROM p190_src_rec_view"
dat = p190.read_sql(sql)
In [41]:
dat.boxplot(by='chan')
Out[41]:
In [45]:
sql = "SELECT chan, DISTANCE(src_pt, rec_pt) AS offset FROM p190_src_rec_view ORDER BY chan"
dat = p190.read_sql(sql)
dx = np.diff(dat.offset)
In [48]:
np.median(dx)
Out[48]:
In [ ]: