Experimenting with reading in PA observations from Scott Tinis.
import datetime
import pandas as pd
from dateutil import tz
def dateParse(s1,s2,s3,s4):
s=s1+s2+s3+s4
unaware =datetime.datetime.strptime(s, '%Y%m%d%H:%M')
aware = unaware.replace(tzinfo=tz.tzutc())
return aware
filename = '/data/nsoontie/MEOPAR/analysis/Nancy/tides/PA_observations/ptatkin_rt.dat'
obs = pd.read_csv(filename, delimiter=' ',parse_dates=[[0,1,2,3]],header=None,date_parser=dateParse)
obs=obs.rename(columns={'0_1_2_3':'time',4:'wlev'})
print obs
time wlev 0 2014-12-02 18:00:00+00:00 3.373 1 2014-12-02 18:01:00+00:00 3.382 2 2014-12-02 18:02:00+00:00 3.389 3 2014-12-02 18:03:00+00:00 3.397 4 2014-12-02 18:04:00+00:00 3.406 5 2014-12-02 18:05:00+00:00 3.413 6 2014-12-02 18:06:00+00:00 3.420 7 2014-12-02 18:07:00+00:00 3.427 8 2014-12-02 18:08:00+00:00 3.435 9 2014-12-02 18:09:00+00:00 3.443 10 2014-12-02 18:10:00+00:00 3.449 11 2014-12-02 18:11:00+00:00 3.458 12 2014-12-02 18:12:00+00:00 3.465 13 2014-12-02 18:13:00+00:00 3.471 14 2014-12-02 18:14:00+00:00 3.480 15 2014-12-02 18:15:00+00:00 3.488 16 2014-12-02 18:16:00+00:00 3.496 17 2014-12-02 18:17:00+00:00 3.502 18 2014-12-02 18:18:00+00:00 3.509 19 2014-12-02 18:19:00+00:00 3.517 20 2014-12-02 18:20:00+00:00 3.525 21 2014-12-02 18:21:00+00:00 3.533 22 2014-12-02 18:22:00+00:00 3.541 23 2014-12-02 18:23:00+00:00 3.548 24 2014-12-02 18:24:00+00:00 3.554 25 2014-12-02 18:25:00+00:00 3.561 26 2014-12-02 18:26:00+00:00 3.568 27 2014-12-02 18:27:00+00:00 3.574 28 2014-12-02 18:28:00+00:00 3.580 29 2014-12-02 18:29:00+00:00 3.587 ... ... ... 10004 2014-12-09 16:44:00+00:00 5.381 10005 2014-12-09 16:45:00+00:00 5.366 10006 2014-12-09 16:46:00+00:00 5.349 10007 2014-12-09 16:47:00+00:00 5.365 10008 2014-12-09 16:48:00+00:00 5.348 10009 2014-12-09 16:49:00+00:00 5.333 10010 2014-12-09 16:50:00+00:00 5.343 10011 2014-12-09 16:51:00+00:00 5.349 10012 2014-12-09 16:52:00+00:00 5.337 10013 2014-12-09 16:53:00+00:00 5.322 10014 2014-12-09 16:54:00+00:00 5.327 10015 2014-12-09 16:55:00+00:00 5.347 10016 2014-12-09 16:56:00+00:00 5.337 10017 2014-12-09 16:57:00+00:00 5.298 10018 2014-12-09 16:58:00+00:00 5.287 10019 2014-12-09 16:59:00+00:00 5.340 10020 2014-12-09 17:00:00+00:00 5.300 10021 2014-12-09 17:01:00+00:00 5.251 10022 2014-12-09 17:02:00+00:00 5.286 10023 2014-12-09 17:03:00+00:00 5.313 10024 2014-12-09 17:04:00+00:00 5.293 10025 2014-12-09 17:05:00+00:00 5.278 10026 2014-12-09 17:06:00+00:00 5.284 10027 2014-12-09 17:07:00+00:00 5.254 10028 2014-12-09 17:08:00+00:00 5.253 10029 2014-12-09 17:09:00+00:00 5.303 10030 2014-12-09 17:10:00+00:00 5.254 10031 2014-12-09 17:11:00+00:00 5.231 10032 2014-12-09 17:12:00+00:00 5.243 10033 2014-12-09 17:13:00+00:00 5.254 [10034 rows x 2 columns]
import matplotlib.pylab as plt
%matplotlib inline
plt.plot(obs.time,obs.wlev)
[<matplotlib.lines.Line2D at 0x7facfb211490>]