# imports %matplotlib inline import matplotlib.pylab as plt import numpy as np import netCDF4 as NC from scipy.optimize import curve_fit from salishsea_tools import tidetools from salishsea_tools import viz_tools from salishsea_tools import bathy_tools import collections import pandas as pd import csv import math from __future__ import division # pathname for data - all of the tide runs are stored in this directory path = '/data/nsoontie/MEOPAR/SalishSea/results/tides/' #path = '../../myResults/' #the run we want to analyze runname = 'corr15' #joining the two string together name = path +runname +'/' print name # pathname for data - path2 = '/ocean/sallen/allen/research/MEOPAR/SalishSea/topog/' #path = '../../myResults/' #the run we want to analyze runname2 = 'try3' #joining the two string together name2 = path2 +runname2 +'/' print name2 stations = ['PortRenfrew','SheringhamPoint','PedderBay', 'Esquimalt', 'Victoria','CloverPoint','FinnertyCove', 'FulfordHarbour', 'TumboChannel','PatosIsland','WhalerBay', 'Tsawwassen', 'Sandheads', 'PointGrey','PointAtkinson','GibsonsLanding', 'WinchelseaIs', 'HalfmoonBay','IrvinesLanding','PowellRiver', 'LittleRiver', 'Lund', 'TwinIslets','CampbellRiver','MaudeIslandE', 'NympheCove', 'SeymourNarrows','BrownBay','ChathamPoint','KelseyBay','YorkeIsland'] fig, ax = plt.subplots(1,1,figsize=(12,5)) for stn in (4,4): print stations[stn] fT1 = NC.Dataset(name+stations[stn]+'.nc','r') time = fT1.variables["time_counter"][:]/3600. # want hours not seconds ssh = fT1.variables["sossheig"][:,0,0] ax.plot(time-4248,ssh,'+-') fT2 = NC.Dataset(name2+'1h_'+stations[stn]+'.nc','r') time2 = fT2.variables["time_counter"][:]/3600. # want hours not seconds ssh2 = fT2.variables["sossheig"][:,0,0] ax.plot(time2,ssh2,'x-') ax.set_xlim((15,25)) fig, ax = plt.subplots(1,1,figsize=(12,5)) for stn in (14,14): print stations[stn] fT1 = NC.Dataset(name+stations[stn]+'.nc','r') time = fT1.variables["time_counter"][:]/3600. # want hours not seconds ssh = fT1.variables["sossheig"][:,0,0] ax.plot(time-4248,ssh,'+-') fT2 = NC.Dataset(name2+'1h_'+stations[stn]+'.nc','r') time2 = fT2.variables["time_counter"][:]/3600. # want hours not seconds ssh2 = fT2.variables["sossheig"][:,0,0] ax.plot(time2,ssh2,'x-') ax.set_xlim((15,25)) 0.5/12.4*360.