%matplotlib inline import matplotlib.pyplot as plt import arrow import datetime import pandas as pd from salishsea_tools import tidetools from salishsea_tools import stormtools import numpy as np yr=2014 stations = {'PointAtkinson': 7795, 'Victoria': 7120, 'PatriciaBay': 7277, 'CampbellRiver': 8074} s = '30-Nov-' + str(2013) #start date e= '02-Dec-' + str(2014) #end date tidetools.get_dfo_wlev(stations['CampbellRiver'],s,e) tfile='Point Atkinson_t_tide_compare8_31-Dec-2013_02-Jan-2015.csv' ttide1,msl= stormtools.load_tidal_predictions(tfile) tfile='Point Atkinson_t_tide_compare8_31-Dec-2013_02-Dec-2015.csv' ttide2,msl= stormtools.load_tidal_predictions(tfile) %matplotlib inline fig,ax=plt.subplots(1,1,figsize=(10,6)) ax.plot(ttide2.time,ttide2.pred_all) ax.plot(ttide1.time,ttide1.pred_all) ax.set_xlim([datetime.datetime(2014,8,14),datetime.datetime(2014,8,16)]) subtide=np.array(ttide2.pred_all) subtime=np.array(ttide2.time) time1=np.array(ttide1.time) tide1=np.array(ttide1.pred_all) indices=np.where(np.logical_and(subtime<=time1[-1],subtime>=time1[0])) subtide=subtide[indices] subtime=subtime[indices] diff= subtide-tide1; print np.max(diff), subtime[np.argmax(diff)] print np.mean(diff) print np.min(diff), subtime[np.argmin(diff)] print subtime[0],time1[0] print subtime[-1],time1[-1] fig,ax=plt.subplots(1,1,figsize=(10,6)) ax.plot(subtime, diff) ax.set_xlim([datetime.datetime(2014,8,14),datetime.datetime(2014,8,16)])