In [30]:
import h5py
import matplotlib.pyplot as plt
import os
import numpy as np

In [17]:
%matplotlib inline

In [8]:
data_path = '/Volumes/wjlee_apl_2/ooi_zplsc_all_h5/'
fname = 'CE04OSPS_201708.h5'

In [9]:
f = h5py.File(os.path.join(data_path,fname),'r')

In [11]:
f['Sv'].shape


Out[11]:
(3, 1072, 526829)

In [ ]:
idx_jump = 1000
ping_idx = range(0,10000,idx_jump)

In [ ]:


In [ ]:


In [58]:
plt.figure(figsize=(12,6))
plt.imshow(f['Sv'][0,:,range(10000)],aspect='auto',vmin=-90,vmax=-30)


Out[58]:
<matplotlib.image.AxesImage at 0x11e39ffd0>

In [37]:
plt.plot(f['data_times'][idx])


Out[37]:
[<matplotlib.lines.Line2D at 0x112afa110>]

In [25]:
from matplotlib.dates import date2num, num2date

In [36]:
num2date(f['data_times'][0:20])


Out[36]:
[datetime.datetime(2017, 8, 10, 20, 52, 55, 497504, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 52, 57, 507511, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 52, 58, 510503, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 52, 59, 513505, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 0, 516507, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 1, 520505, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 2, 524503, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 3, 526509, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 4, 529511, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 5, 532503, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 6, 536501, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 7, 538507, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 8, 542505, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 9, 544511, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 10, 547503, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 11, 551511, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 12, 553507, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 13, 556509, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 14, 560507, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>),
 datetime.datetime(2017, 8, 10, 20, 53, 15, 563509, tzinfo=<matplotlib.dates._UTC object at 0x10ae4c190>)]

In [39]:
[num2date(f['data_times'][x])-num2date(f['data_times'][x-1]) for x in range(1,10)]


Out[39]:
[datetime.timedelta(0, 2, 10007),
 datetime.timedelta(0, 1, 2992),
 datetime.timedelta(0, 1, 3002),
 datetime.timedelta(0, 1, 3002),
 datetime.timedelta(0, 1, 3998),
 datetime.timedelta(0, 1, 3998),
 datetime.timedelta(0, 1, 2006),
 datetime.timedelta(0, 1, 3002),
 datetime.timedelta(0, 1, 2992)]

In [51]:
a=num2date(f['data_times'][1])-num2date(f['data_times'][0])
a


Out[51]:
datetime.timedelta(0, 2, 10007)

In [54]:
(a.days,a.seconds,a.microseconds)


Out[54]:
(0, 2, 10007)

In [ ]:


In [ ]:


In [ ]: