#Preamble
%matplotlib inline
import csv
import datetime
from itertools import islice
import numpy as np
import matplotlib.pyplot as plt
import netCDF4 as NC
from matplotlib import pylab
from salishsea_tools import tidetools
from math import radians, cos, sin, asin, sqrt, pi
#enter the name of the run you want to compare to measured data
runname = '50s_22-25Sep'
FROM DOUG:
It looks to me like the crucial step is submitting the form on http://www.meds-sdmm.dfo-mpo.gc.ca/isdm-gdsi/twl-mne/inventory-inventaire/interval-intervalle-eng.asp?user=isdm-gdsi%C2%AEion=PAC&tst=1&no=7795. I think that the submit action there is causing a script to run on the server that puts the results in a temporary file and then shows you a page with the link to that file on it. So you need to mimic that in code - send a POST request with the dates and hourly, then do the GET request to download it.
There were a couple of more tricks to getting this to work.
The name of the script that handles the POST request is in the action
attribute of the form
tag - form_handler
below.
That gets appended to the URL of the base part of the URL of the page that the form is on.
I factored out that base URL part because it's common to both requests.
It's pretty unconventional that the form handler uses both query string parameters
(the key-value pairs separated by &
characters after the ?
)
and POST
data,
but that's old-school web programming for you...
I experimented with moving the query string parameters from form_handler
into sitedata
but that doesn't work.
The other trick is that the response from the POST
request includes a cookie that has to be sent back with the GET
request that contains the csv
file name.
I guessed that was going to be the case because going directly to the last link was failing,
and that suggested that there was some "state" information connecting the 2 requests.
"State" often means cookies,
especially in old-school web programming.
I confirmed my guess by looking at the headers
and cookies
attributes of the request.Response
object from the POST
request.
Wrapping the 2 requests in a requests.Session()
context is an easy,
elegant way to manage the cookie.
The %5C
strings in data_provider
encoded back-slashes.
The first 2 can be changed back to \
characters,
but if the 3rd one is the request fails,
so I just left them encoded.
The Size
parameter at the end of data_provider
struck me as problematic
and indeed results in truncation is it is incorrect.
Fortunately,
it appear that it is not required.
#go to directory and get the modelled water level data
import glob
filetest = glob.glob('/data/dlatorne/MEOPAR/SalishSea/results/'+runname+'/*_grid_T.nc')
fT = NC.Dataset(filetest[0],'r')
#adjust the water level data to Chart Datum (CD)
eta = fT.variables['sossheig'][:,:,:]+3.1
#get the start time from the netcdf
model_start_time = datetime.datetime.strptime(fT.variables['time_counter'].time_origin,' %Y-%b-%d %H:%S:%M')
#interval_write is in seconds, change it to hours
timestep = fT.variables['time_counter'][:]/(60*60)
#create list of dates
dateList = [model_start_time + datetime.timedelta(hours=x) for x in timestep ]
model_end_time = dateList[len(timestep)-1]
#model time is in UTC, make sure the times are aware of this
import pytz
for x in np.arange(0,len(timestep)):
dateList[x] = dateList[x].replace(tzinfo=pytz.timezone('UTC'))
#these times are in UTC.... but DFO site needs PST... but since the DFO site only needs a date, this should be OK
end_date = model_end_time.strftime('%d-%b-%Y')
start_date = model_start_time.strftime('%d-%b-%Y')
print start_date, end_date
#download the data from the DFO site
r = tidetools.get_dfo_wlev(7795,start_date.upper(),end_date.upper(),'wlev_timeseries.csv')
#allocate it to appropriate variables
dates, wlev, stat_name, stat_num, stat_lat, stat_lon = tidetools.read_dfo_wlev_file('wlev_timeseries.csv')
15-Sep-2002 25-Sep-2002 Results saved here: wlev_timeseries.csv 2002-09-15 08:00:00-08:00 2002-09-15 16:00:00+00:00 2002-09-15 09:00:00-08:00 2002-09-15 17:00:00+00:00 2002-09-15 10:00:00-08:00 2002-09-15 18:00:00+00:00 2002-09-15 11:00:00-08:00 2002-09-15 19:00:00+00:00 2002-09-15 12:00:00-08:00 2002-09-15 20:00:00+00:00 2002-09-15 13:00:00-08:00 2002-09-15 21:00:00+00:00 2002-09-15 14:00:00-08:00 2002-09-15 22:00:00+00:00 2002-09-15 15:00:00-08:00 2002-09-15 23:00:00+00:00 2002-09-15 16:00:00-08:00 2002-09-16 00:00:00+00:00 2002-09-15 17:00:00-08:00 2002-09-16 01:00:00+00:00 2002-09-15 18:00:00-08:00 2002-09-16 02:00:00+00:00 2002-09-15 19:00:00-08:00 2002-09-16 03:00:00+00:00 2002-09-15 20:00:00-08:00 2002-09-16 04:00:00+00:00 2002-09-15 21:00:00-08:00 2002-09-16 05:00:00+00:00 2002-09-15 22:00:00-08:00 2002-09-16 06:00:00+00:00 2002-09-15 23:00:00-08:00 2002-09-16 07:00:00+00:00 2002-09-16 00:00:00-08:00 2002-09-16 08:00:00+00:00 2002-09-16 01:00:00-08:00 2002-09-16 09:00:00+00:00 2002-09-16 02:00:00-08:00 2002-09-16 10:00:00+00:00 2002-09-16 03:00:00-08:00 2002-09-16 11:00:00+00:00 2002-09-16 04:00:00-08:00 2002-09-16 12:00:00+00:00 2002-09-16 05:00:00-08:00 2002-09-16 13:00:00+00:00 2002-09-16 06:00:00-08:00 2002-09-16 14:00:00+00:00 2002-09-16 07:00:00-08:00 2002-09-16 15:00:00+00:00 2002-09-16 08:00:00-08:00 2002-09-16 16:00:00+00:00 2002-09-16 09:00:00-08:00 2002-09-16 17:00:00+00:00 2002-09-16 10:00:00-08:00 2002-09-16 18:00:00+00:00 2002-09-16 11:00:00-08:00 2002-09-16 19:00:00+00:00 2002-09-16 12:00:00-08:00 2002-09-16 20:00:00+00:00 2002-09-16 13:00:00-08:00 2002-09-16 21:00:00+00:00 2002-09-16 14:00:00-08:00 2002-09-16 22:00:00+00:00 2002-09-16 15:00:00-08:00 2002-09-16 23:00:00+00:00 2002-09-16 16:00:00-08:00 2002-09-17 00:00:00+00:00 2002-09-16 17:00:00-08:00 2002-09-17 01:00:00+00:00 2002-09-16 18:00:00-08:00 2002-09-17 02:00:00+00:00 2002-09-16 19:00:00-08:00 2002-09-17 03:00:00+00:00 2002-09-16 20:00:00-08:00 2002-09-17 04:00:00+00:00 2002-09-16 21:00:00-08:00 2002-09-17 05:00:00+00:00 2002-09-16 22:00:00-08:00 2002-09-17 06:00:00+00:00 2002-09-16 23:00:00-08:00 2002-09-17 07:00:00+00:00 2002-09-17 00:00:00-08:00 2002-09-17 08:00:00+00:00 2002-09-17 01:00:00-08:00 2002-09-17 09:00:00+00:00 2002-09-17 02:00:00-08:00 2002-09-17 10:00:00+00:00 2002-09-17 03:00:00-08:00 2002-09-17 11:00:00+00:00 2002-09-17 04:00:00-08:00 2002-09-17 12:00:00+00:00 2002-09-17 05:00:00-08:00 2002-09-17 13:00:00+00:00 2002-09-17 06:00:00-08:00 2002-09-17 14:00:00+00:00 2002-09-17 07:00:00-08:00 2002-09-17 15:00:00+00:00 2002-09-17 08:00:00-08:00 2002-09-17 16:00:00+00:00 2002-09-17 09:00:00-08:00 2002-09-17 17:00:00+00:00 2002-09-17 10:00:00-08:00 2002-09-17 18:00:00+00:00 2002-09-17 11:00:00-08:00 2002-09-17 19:00:00+00:00 2002-09-17 12:00:00-08:00 2002-09-17 20:00:00+00:00 2002-09-17 13:00:00-08:00 2002-09-17 21:00:00+00:00 2002-09-17 14:00:00-08:00 2002-09-17 22:00:00+00:00 2002-09-17 15:00:00-08:00 2002-09-17 23:00:00+00:00 2002-09-17 16:00:00-08:00 2002-09-18 00:00:00+00:00 2002-09-17 17:00:00-08:00 2002-09-18 01:00:00+00:00 2002-09-17 18:00:00-08:00 2002-09-18 02:00:00+00:00 2002-09-17 19:00:00-08:00 2002-09-18 03:00:00+00:00 2002-09-17 20:00:00-08:00 2002-09-18 04:00:00+00:00 2002-09-17 21:00:00-08:00 2002-09-18 05:00:00+00:00 2002-09-17 22:00:00-08:00 2002-09-18 06:00:00+00:00 2002-09-17 23:00:00-08:00 2002-09-18 07:00:00+00:00 2002-09-18 00:00:00-08:00 2002-09-18 08:00:00+00:00 2002-09-18 01:00:00-08:00 2002-09-18 09:00:00+00:00 2002-09-18 02:00:00-08:00 2002-09-18 10:00:00+00:00 2002-09-18 03:00:00-08:00 2002-09-18 11:00:00+00:00 2002-09-18 04:00:00-08:00 2002-09-18 12:00:00+00:00 2002-09-18 05:00:00-08:00 2002-09-18 13:00:00+00:00 2002-09-18 06:00:00-08:00 2002-09-18 14:00:00+00:00 2002-09-18 07:00:00-08:00 2002-09-18 15:00:00+00:00 2002-09-18 08:00:00-08:00 2002-09-18 16:00:00+00:00 2002-09-18 09:00:00-08:00 2002-09-18 17:00:00+00:00 2002-09-18 10:00:00-08:00 2002-09-18 18:00:00+00:00 2002-09-18 11:00:00-08:00 2002-09-18 19:00:00+00:00 2002-09-18 12:00:00-08:00 2002-09-18 20:00:00+00:00 2002-09-18 13:00:00-08:00 2002-09-18 21:00:00+00:00 2002-09-18 14:00:00-08:00 2002-09-18 22:00:00+00:00 2002-09-18 15:00:00-08:00 2002-09-18 23:00:00+00:00 2002-09-18 16:00:00-08:00 2002-09-19 00:00:00+00:00 2002-09-18 17:00:00-08:00 2002-09-19 01:00:00+00:00 2002-09-18 18:00:00-08:00 2002-09-19 02:00:00+00:00 2002-09-18 19:00:00-08:00 2002-09-19 03:00:00+00:00 2002-09-18 20:00:00-08:00 2002-09-19 04:00:00+00:00 2002-09-18 21:00:00-08:00 2002-09-19 05:00:00+00:00 2002-09-18 22:00:00-08:00 2002-09-19 06:00:00+00:00 2002-09-18 23:00:00-08:00 2002-09-19 07:00:00+00:00 2002-09-19 00:00:00-08:00 2002-09-19 08:00:00+00:00 2002-09-19 01:00:00-08:00 2002-09-19 09:00:00+00:00 2002-09-19 02:00:00-08:00 2002-09-19 10:00:00+00:00 2002-09-19 03:00:00-08:00 2002-09-19 11:00:00+00:00 2002-09-19 04:00:00-08:00 2002-09-19 12:00:00+00:00 2002-09-19 05:00:00-08:00 2002-09-19 13:00:00+00:00 2002-09-19 06:00:00-08:00 2002-09-19 14:00:00+00:00 2002-09-19 07:00:00-08:00 2002-09-19 15:00:00+00:00 2002-09-19 08:00:00-08:00 2002-09-19 16:00:00+00:00 2002-09-19 09:00:00-08:00 2002-09-19 17:00:00+00:00 2002-09-19 10:00:00-08:00 2002-09-19 18:00:00+00:00 2002-09-19 11:00:00-08:00 2002-09-19 19:00:00+00:00 2002-09-19 12:00:00-08:00 2002-09-19 20:00:00+00:00 2002-09-19 13:00:00-08:00 2002-09-19 21:00:00+00:00 2002-09-19 14:00:00-08:00 2002-09-19 22:00:00+00:00 2002-09-19 15:00:00-08:00 2002-09-19 23:00:00+00:00 2002-09-19 16:00:00-08:00 2002-09-20 00:00:00+00:00 2002-09-19 17:00:00-08:00 2002-09-20 01:00:00+00:00 2002-09-19 18:00:00-08:00 2002-09-20 02:00:00+00:00 2002-09-19 19:00:00-08:00 2002-09-20 03:00:00+00:00 2002-09-19 20:00:00-08:00 2002-09-20 04:00:00+00:00 2002-09-19 21:00:00-08:00 2002-09-20 05:00:00+00:00 2002-09-19 22:00:00-08:00 2002-09-20 06:00:00+00:00 2002-09-19 23:00:00-08:00 2002-09-20 07:00:00+00:00 2002-09-20 00:00:00-08:00 2002-09-20 08:00:00+00:00 2002-09-20 01:00:00-08:00 2002-09-20 09:00:00+00:00 2002-09-20 02:00:00-08:00 2002-09-20 10:00:00+00:00 2002-09-20 03:00:00-08:00 2002-09-20 11:00:00+00:00 2002-09-20 04:00:00-08:00 2002-09-20 12:00:00+00:00 2002-09-20 05:00:00-08:00 2002-09-20 13:00:00+00:00 2002-09-20 06:00:00-08:00 2002-09-20 14:00:00+00:00 2002-09-20 07:00:00-08:00 2002-09-20 15:00:00+00:00 2002-09-20 08:00:00-08:00 2002-09-20 16:00:00+00:00 2002-09-20 09:00:00-08:00 2002-09-20 17:00:00+00:00 2002-09-20 10:00:00-08:00 2002-09-20 18:00:00+00:00 2002-09-20 11:00:00-08:00 2002-09-20 19:00:00+00:00 2002-09-20 12:00:00-08:00 2002-09-20 20:00:00+00:00 2002-09-20 13:00:00-08:00 2002-09-20 21:00:00+00:00 2002-09-20 14:00:00-08:00 2002-09-20 22:00:00+00:00 2002-09-20 15:00:00-08:00 2002-09-20 23:00:00+00:00 2002-09-20 16:00:00-08:00 2002-09-21 00:00:00+00:00 2002-09-20 17:00:00-08:00 2002-09-21 01:00:00+00:00 2002-09-20 18:00:00-08:00 2002-09-21 02:00:00+00:00 2002-09-20 19:00:00-08:00 2002-09-21 03:00:00+00:00 2002-09-20 20:00:00-08:00 2002-09-21 04:00:00+00:00 2002-09-20 21:00:00-08:00 2002-09-21 05:00:00+00:00 2002-09-20 22:00:00-08:00 2002-09-21 06:00:00+00:00 2002-09-20 23:00:00-08:00 2002-09-21 07:00:00+00:00 2002-09-21 00:00:00-08:00 2002-09-21 08:00:00+00:00 2002-09-21 01:00:00-08:00 2002-09-21 09:00:00+00:00 2002-09-21 02:00:00-08:00 2002-09-21 10:00:00+00:00 2002-09-21 03:00:00-08:00 2002-09-21 11:00:00+00:00 2002-09-21 04:00:00-08:00 2002-09-21 12:00:00+00:00 2002-09-21 05:00:00-08:00 2002-09-21 13:00:00+00:00 2002-09-21 06:00:00-08:00 2002-09-21 14:00:00+00:00 2002-09-21 07:00:00-08:00 2002-09-21 15:00:00+00:00 2002-09-21 08:00:00-08:00 2002-09-21 16:00:00+00:00 2002-09-21 09:00:00-08:00 2002-09-21 17:00:00+00:00 2002-09-21 10:00:00-08:00 2002-09-21 18:00:00+00:00 2002-09-21 11:00:00-08:00 2002-09-21 19:00:00+00:00 2002-09-21 12:00:00-08:00 2002-09-21 20:00:00+00:00 2002-09-21 13:00:00-08:00 2002-09-21 21:00:00+00:00 2002-09-21 14:00:00-08:00 2002-09-21 22:00:00+00:00 2002-09-21 15:00:00-08:00 2002-09-21 23:00:00+00:00 2002-09-21 16:00:00-08:00 2002-09-22 00:00:00+00:00 2002-09-21 17:00:00-08:00 2002-09-22 01:00:00+00:00 2002-09-21 18:00:00-08:00 2002-09-22 02:00:00+00:00 2002-09-21 19:00:00-08:00 2002-09-22 03:00:00+00:00 2002-09-21 20:00:00-08:00 2002-09-22 04:00:00+00:00 2002-09-21 21:00:00-08:00 2002-09-22 05:00:00+00:00 2002-09-21 22:00:00-08:00 2002-09-22 06:00:00+00:00 2002-09-21 23:00:00-08:00 2002-09-22 07:00:00+00:00 2002-09-22 00:00:00-08:00 2002-09-22 08:00:00+00:00 2002-09-22 01:00:00-08:00 2002-09-22 09:00:00+00:00 2002-09-22 02:00:00-08:00 2002-09-22 10:00:00+00:00 2002-09-22 03:00:00-08:00 2002-09-22 11:00:00+00:00 2002-09-22 04:00:00-08:00 2002-09-22 12:00:00+00:00 2002-09-22 05:00:00-08:00 2002-09-22 13:00:00+00:00 2002-09-22 06:00:00-08:00 2002-09-22 14:00:00+00:00 2002-09-22 07:00:00-08:00 2002-09-22 15:00:00+00:00 2002-09-22 08:00:00-08:00 2002-09-22 16:00:00+00:00 2002-09-22 09:00:00-08:00 2002-09-22 17:00:00+00:00 2002-09-22 10:00:00-08:00 2002-09-22 18:00:00+00:00 2002-09-22 11:00:00-08:00 2002-09-22 19:00:00+00:00 2002-09-22 12:00:00-08:00 2002-09-22 20:00:00+00:00 2002-09-22 13:00:00-08:00 2002-09-22 21:00:00+00:00 2002-09-22 14:00:00-08:00 2002-09-22 22:00:00+00:00 2002-09-22 15:00:00-08:00 2002-09-22 23:00:00+00:00 2002-09-22 16:00:00-08:00 2002-09-23 00:00:00+00:00 2002-09-22 17:00:00-08:00 2002-09-23 01:00:00+00:00 2002-09-22 18:00:00-08:00 2002-09-23 02:00:00+00:00 2002-09-22 19:00:00-08:00 2002-09-23 03:00:00+00:00 2002-09-22 20:00:00-08:00 2002-09-23 04:00:00+00:00 2002-09-22 21:00:00-08:00 2002-09-23 05:00:00+00:00 2002-09-22 22:00:00-08:00 2002-09-23 06:00:00+00:00 2002-09-22 23:00:00-08:00 2002-09-23 07:00:00+00:00 2002-09-23 00:00:00-08:00 2002-09-23 08:00:00+00:00 2002-09-23 01:00:00-08:00 2002-09-23 09:00:00+00:00 2002-09-23 02:00:00-08:00 2002-09-23 10:00:00+00:00 2002-09-23 03:00:00-08:00 2002-09-23 11:00:00+00:00 2002-09-23 04:00:00-08:00 2002-09-23 12:00:00+00:00 2002-09-23 05:00:00-08:00 2002-09-23 13:00:00+00:00 2002-09-23 06:00:00-08:00 2002-09-23 14:00:00+00:00 2002-09-23 07:00:00-08:00 2002-09-23 15:00:00+00:00 2002-09-23 08:00:00-08:00 2002-09-23 16:00:00+00:00 2002-09-23 09:00:00-08:00 2002-09-23 17:00:00+00:00 2002-09-23 10:00:00-08:00 2002-09-23 18:00:00+00:00 2002-09-23 11:00:00-08:00 2002-09-23 19:00:00+00:00 2002-09-23 12:00:00-08:00 2002-09-23 20:00:00+00:00 2002-09-23 13:00:00-08:00 2002-09-23 21:00:00+00:00 2002-09-23 14:00:00-08:00 2002-09-23 22:00:00+00:00 2002-09-23 15:00:00-08:00 2002-09-23 23:00:00+00:00 2002-09-23 16:00:00-08:00 2002-09-24 00:00:00+00:00 2002-09-23 17:00:00-08:00 2002-09-24 01:00:00+00:00 2002-09-23 18:00:00-08:00 2002-09-24 02:00:00+00:00 2002-09-23 19:00:00-08:00 2002-09-24 03:00:00+00:00 2002-09-23 20:00:00-08:00 2002-09-24 04:00:00+00:00 2002-09-23 21:00:00-08:00 2002-09-24 05:00:00+00:00 2002-09-23 22:00:00-08:00 2002-09-24 06:00:00+00:00 2002-09-23 23:00:00-08:00 2002-09-24 07:00:00+00:00 2002-09-24 00:00:00-08:00 2002-09-24 08:00:00+00:00 2002-09-24 01:00:00-08:00 2002-09-24 09:00:00+00:00 2002-09-24 02:00:00-08:00 2002-09-24 10:00:00+00:00 2002-09-24 03:00:00-08:00 2002-09-24 11:00:00+00:00 2002-09-24 04:00:00-08:00 2002-09-24 12:00:00+00:00 2002-09-24 05:00:00-08:00 2002-09-24 13:00:00+00:00 2002-09-24 06:00:00-08:00 2002-09-24 14:00:00+00:00 2002-09-24 07:00:00-08:00 2002-09-24 15:00:00+00:00 2002-09-24 08:00:00-08:00 2002-09-24 16:00:00+00:00 2002-09-24 09:00:00-08:00 2002-09-24 17:00:00+00:00 2002-09-24 10:00:00-08:00 2002-09-24 18:00:00+00:00 2002-09-24 11:00:00-08:00 2002-09-24 19:00:00+00:00 2002-09-24 12:00:00-08:00 2002-09-24 20:00:00+00:00 2002-09-24 13:00:00-08:00 2002-09-24 21:00:00+00:00 2002-09-24 14:00:00-08:00 2002-09-24 22:00:00+00:00 2002-09-24 15:00:00-08:00 2002-09-24 23:00:00+00:00 2002-09-24 16:00:00-08:00 2002-09-25 00:00:00+00:00 2002-09-24 17:00:00-08:00 2002-09-25 01:00:00+00:00 2002-09-24 18:00:00-08:00 2002-09-25 02:00:00+00:00 2002-09-24 19:00:00-08:00 2002-09-25 03:00:00+00:00 2002-09-24 20:00:00-08:00 2002-09-25 04:00:00+00:00 2002-09-24 21:00:00-08:00 2002-09-25 05:00:00+00:00 2002-09-24 22:00:00-08:00 2002-09-25 06:00:00+00:00 2002-09-24 23:00:00-08:00 2002-09-25 07:00:00+00:00 2002-09-25 00:00:00-08:00 2002-09-25 08:00:00+00:00 2002-09-25 01:00:00-08:00 2002-09-25 09:00:00+00:00 2002-09-25 02:00:00-08:00 2002-09-25 10:00:00+00:00 2002-09-25 03:00:00-08:00 2002-09-25 11:00:00+00:00 2002-09-25 04:00:00-08:00 2002-09-25 12:00:00+00:00 2002-09-25 05:00:00-08:00 2002-09-25 13:00:00+00:00 2002-09-25 06:00:00-08:00 2002-09-25 14:00:00+00:00 2002-09-25 07:00:00-08:00 2002-09-25 15:00:00+00:00 2002-09-25 08:00:00-08:00 2002-09-25 16:00:00+00:00
#allocate it to appropriate variables
reload(tidetools)
dates, wlev, stat_name, stat_num, stat_lat, stat_lon = tidetools.read_dfo_wlev_file('wlev_timeseries.csv')
2002-09-15 08:00:00-08:00 2002-09-15 16:00:00+00:00 2002-09-15 09:00:00-08:00 2002-09-15 17:00:00+00:00 2002-09-15 10:00:00-08:00 2002-09-15 18:00:00+00:00 2002-09-15 11:00:00-08:00 2002-09-15 19:00:00+00:00 2002-09-15 12:00:00-08:00 2002-09-15 20:00:00+00:00 2002-09-15 13:00:00-08:00 2002-09-15 21:00:00+00:00 2002-09-15 14:00:00-08:00 2002-09-15 22:00:00+00:00 2002-09-15 15:00:00-08:00 2002-09-15 23:00:00+00:00 2002-09-15 16:00:00-08:00 2002-09-16 00:00:00+00:00 2002-09-15 17:00:00-08:00 2002-09-16 01:00:00+00:00 2002-09-15 18:00:00-08:00 2002-09-16 02:00:00+00:00 2002-09-15 19:00:00-08:00 2002-09-16 03:00:00+00:00 2002-09-15 20:00:00-08:00 2002-09-16 04:00:00+00:00 2002-09-15 21:00:00-08:00 2002-09-16 05:00:00+00:00 2002-09-15 22:00:00-08:00 2002-09-16 06:00:00+00:00 2002-09-15 23:00:00-08:00 2002-09-16 07:00:00+00:00 2002-09-16 00:00:00-08:00 2002-09-16 08:00:00+00:00 2002-09-16 01:00:00-08:00 2002-09-16 09:00:00+00:00 2002-09-16 02:00:00-08:00 2002-09-16 10:00:00+00:00 2002-09-16 03:00:00-08:00 2002-09-16 11:00:00+00:00 2002-09-16 04:00:00-08:00 2002-09-16 12:00:00+00:00 2002-09-16 05:00:00-08:00 2002-09-16 13:00:00+00:00 2002-09-16 06:00:00-08:00 2002-09-16 14:00:00+00:00 2002-09-16 07:00:00-08:00 2002-09-16 15:00:00+00:00 2002-09-16 08:00:00-08:00 2002-09-16 16:00:00+00:00 2002-09-16 09:00:00-08:00 2002-09-16 17:00:00+00:00 2002-09-16 10:00:00-08:00 2002-09-16 18:00:00+00:00 2002-09-16 11:00:00-08:00 2002-09-16 19:00:00+00:00 2002-09-16 12:00:00-08:00 2002-09-16 20:00:00+00:00 2002-09-16 13:00:00-08:00 2002-09-16 21:00:00+00:00 2002-09-16 14:00:00-08:00 2002-09-16 22:00:00+00:00 2002-09-16 15:00:00-08:00 2002-09-16 23:00:00+00:00 2002-09-16 16:00:00-08:00 2002-09-17 00:00:00+00:00 2002-09-16 17:00:00-08:00 2002-09-17 01:00:00+00:00 2002-09-16 18:00:00-08:00 2002-09-17 02:00:00+00:00 2002-09-16 19:00:00-08:00 2002-09-17 03:00:00+00:00 2002-09-16 20:00:00-08:00 2002-09-17 04:00:00+00:00 2002-09-16 21:00:00-08:00 2002-09-17 05:00:00+00:00 2002-09-16 22:00:00-08:00 2002-09-17 06:00:00+00:00 2002-09-16 23:00:00-08:00 2002-09-17 07:00:00+00:00 2002-09-17 00:00:00-08:00 2002-09-17 08:00:00+00:00 2002-09-17 01:00:00-08:00 2002-09-17 09:00:00+00:00 2002-09-17 02:00:00-08:00 2002-09-17 10:00:00+00:00 2002-09-17 03:00:00-08:00 2002-09-17 11:00:00+00:00 2002-09-17 04:00:00-08:00 2002-09-17 12:00:00+00:00 2002-09-17 05:00:00-08:00 2002-09-17 13:00:00+00:00 2002-09-17 06:00:00-08:00 2002-09-17 14:00:00+00:00 2002-09-17 07:00:00-08:00 2002-09-17 15:00:00+00:00 2002-09-17 08:00:00-08:00 2002-09-17 16:00:00+00:00 2002-09-17 09:00:00-08:00 2002-09-17 17:00:00+00:00 2002-09-17 10:00:00-08:00 2002-09-17 18:00:00+00:00 2002-09-17 11:00:00-08:00 2002-09-17 19:00:00+00:00 2002-09-17 12:00:00-08:00 2002-09-17 20:00:00+00:00 2002-09-17 13:00:00-08:00 2002-09-17 21:00:00+00:00 2002-09-17 14:00:00-08:00 2002-09-17 22:00:00+00:00 2002-09-17 15:00:00-08:00 2002-09-17 23:00:00+00:00 2002-09-17 16:00:00-08:00 2002-09-18 00:00:00+00:00 2002-09-17 17:00:00-08:00 2002-09-18 01:00:00+00:00 2002-09-17 18:00:00-08:00 2002-09-18 02:00:00+00:00 2002-09-17 19:00:00-08:00 2002-09-18 03:00:00+00:00 2002-09-17 20:00:00-08:00 2002-09-18 04:00:00+00:00 2002-09-17 21:00:00-08:00 2002-09-18 05:00:00+00:00 2002-09-17 22:00:00-08:00 2002-09-18 06:00:00+00:00 2002-09-17 23:00:00-08:00 2002-09-18 07:00:00+00:00 2002-09-18 00:00:00-08:00 2002-09-18 08:00:00+00:00 2002-09-18 01:00:00-08:00 2002-09-18 09:00:00+00:00 2002-09-18 02:00:00-08:00 2002-09-18 10:00:00+00:00 2002-09-18 03:00:00-08:00 2002-09-18 11:00:00+00:00 2002-09-18 04:00:00-08:00 2002-09-18 12:00:00+00:00 2002-09-18 05:00:00-08:00 2002-09-18 13:00:00+00:00 2002-09-18 06:00:00-08:00 2002-09-18 14:00:00+00:00 2002-09-18 07:00:00-08:00 2002-09-18 15:00:00+00:00 2002-09-18 08:00:00-08:00 2002-09-18 16:00:00+00:00 2002-09-18 09:00:00-08:00 2002-09-18 17:00:00+00:00 2002-09-18 10:00:00-08:00 2002-09-18 18:00:00+00:00 2002-09-18 11:00:00-08:00 2002-09-18 19:00:00+00:00 2002-09-18 12:00:00-08:00 2002-09-18 20:00:00+00:00 2002-09-18 13:00:00-08:00 2002-09-18 21:00:00+00:00 2002-09-18 14:00:00-08:00 2002-09-18 22:00:00+00:00 2002-09-18 15:00:00-08:00 2002-09-18 23:00:00+00:00 2002-09-18 16:00:00-08:00 2002-09-19 00:00:00+00:00 2002-09-18 17:00:00-08:00 2002-09-19 01:00:00+00:00 2002-09-18 18:00:00-08:00 2002-09-19 02:00:00+00:00 2002-09-18 19:00:00-08:00 2002-09-19 03:00:00+00:00 2002-09-18 20:00:00-08:00 2002-09-19 04:00:00+00:00 2002-09-18 21:00:00-08:00 2002-09-19 05:00:00+00:00 2002-09-18 22:00:00-08:00 2002-09-19 06:00:00+00:00 2002-09-18 23:00:00-08:00 2002-09-19 07:00:00+00:00 2002-09-19 00:00:00-08:00 2002-09-19 08:00:00+00:00 2002-09-19 01:00:00-08:00 2002-09-19 09:00:00+00:00 2002-09-19 02:00:00-08:00 2002-09-19 10:00:00+00:00 2002-09-19 03:00:00-08:00 2002-09-19 11:00:00+00:00 2002-09-19 04:00:00-08:00 2002-09-19 12:00:00+00:00 2002-09-19 05:00:00-08:00 2002-09-19 13:00:00+00:00 2002-09-19 06:00:00-08:00 2002-09-19 14:00:00+00:00 2002-09-19 07:00:00-08:00 2002-09-19 15:00:00+00:00 2002-09-19 08:00:00-08:00 2002-09-19 16:00:00+00:00 2002-09-19 09:00:00-08:00 2002-09-19 17:00:00+00:00 2002-09-19 10:00:00-08:00 2002-09-19 18:00:00+00:00 2002-09-19 11:00:00-08:00 2002-09-19 19:00:00+00:00 2002-09-19 12:00:00-08:00 2002-09-19 20:00:00+00:00 2002-09-19 13:00:00-08:00 2002-09-19 21:00:00+00:00 2002-09-19 14:00:00-08:00 2002-09-19 22:00:00+00:00 2002-09-19 15:00:00-08:00 2002-09-19 23:00:00+00:00 2002-09-19 16:00:00-08:00 2002-09-20 00:00:00+00:00 2002-09-19 17:00:00-08:00 2002-09-20 01:00:00+00:00 2002-09-19 18:00:00-08:00 2002-09-20 02:00:00+00:00 2002-09-19 19:00:00-08:00 2002-09-20 03:00:00+00:00 2002-09-19 20:00:00-08:00 2002-09-20 04:00:00+00:00 2002-09-19 21:00:00-08:00 2002-09-20 05:00:00+00:00 2002-09-19 22:00:00-08:00 2002-09-20 06:00:00+00:00 2002-09-19 23:00:00-08:00 2002-09-20 07:00:00+00:00 2002-09-20 00:00:00-08:00 2002-09-20 08:00:00+00:00 2002-09-20 01:00:00-08:00 2002-09-20 09:00:00+00:00 2002-09-20 02:00:00-08:00 2002-09-20 10:00:00+00:00 2002-09-20 03:00:00-08:00 2002-09-20 11:00:00+00:00 2002-09-20 04:00:00-08:00 2002-09-20 12:00:00+00:00 2002-09-20 05:00:00-08:00 2002-09-20 13:00:00+00:00 2002-09-20 06:00:00-08:00 2002-09-20 14:00:00+00:00 2002-09-20 07:00:00-08:00 2002-09-20 15:00:00+00:00 2002-09-20 08:00:00-08:00 2002-09-20 16:00:00+00:00 2002-09-20 09:00:00-08:00 2002-09-20 17:00:00+00:00 2002-09-20 10:00:00-08:00 2002-09-20 18:00:00+00:00 2002-09-20 11:00:00-08:00 2002-09-20 19:00:00+00:00 2002-09-20 12:00:00-08:00 2002-09-20 20:00:00+00:00 2002-09-20 13:00:00-08:00 2002-09-20 21:00:00+00:00 2002-09-20 14:00:00-08:00 2002-09-20 22:00:00+00:00 2002-09-20 15:00:00-08:00 2002-09-20 23:00:00+00:00 2002-09-20 16:00:00-08:00 2002-09-21 00:00:00+00:00 2002-09-20 17:00:00-08:00 2002-09-21 01:00:00+00:00 2002-09-20 18:00:00-08:00 2002-09-21 02:00:00+00:00 2002-09-20 19:00:00-08:00 2002-09-21 03:00:00+00:00 2002-09-20 20:00:00-08:00 2002-09-21 04:00:00+00:00 2002-09-20 21:00:00-08:00 2002-09-21 05:00:00+00:00 2002-09-20 22:00:00-08:00 2002-09-21 06:00:00+00:00 2002-09-20 23:00:00-08:00 2002-09-21 07:00:00+00:00 2002-09-21 00:00:00-08:00 2002-09-21 08:00:00+00:00 2002-09-21 01:00:00-08:00 2002-09-21 09:00:00+00:00 2002-09-21 02:00:00-08:00 2002-09-21 10:00:00+00:00 2002-09-21 03:00:00-08:00 2002-09-21 11:00:00+00:00 2002-09-21 04:00:00-08:00 2002-09-21 12:00:00+00:00 2002-09-21 05:00:00-08:00 2002-09-21 13:00:00+00:00 2002-09-21 06:00:00-08:00 2002-09-21 14:00:00+00:00 2002-09-21 07:00:00-08:00 2002-09-21 15:00:00+00:00 2002-09-21 08:00:00-08:00 2002-09-21 16:00:00+00:00 2002-09-21 09:00:00-08:00 2002-09-21 17:00:00+00:00 2002-09-21 10:00:00-08:00 2002-09-21 18:00:00+00:00 2002-09-21 11:00:00-08:00 2002-09-21 19:00:00+00:00 2002-09-21 12:00:00-08:00 2002-09-21 20:00:00+00:00 2002-09-21 13:00:00-08:00 2002-09-21 21:00:00+00:00 2002-09-21 14:00:00-08:00 2002-09-21 22:00:00+00:00 2002-09-21 15:00:00-08:00 2002-09-21 23:00:00+00:00 2002-09-21 16:00:00-08:00 2002-09-22 00:00:00+00:00 2002-09-21 17:00:00-08:00 2002-09-22 01:00:00+00:00 2002-09-21 18:00:00-08:00 2002-09-22 02:00:00+00:00 2002-09-21 19:00:00-08:00 2002-09-22 03:00:00+00:00 2002-09-21 20:00:00-08:00 2002-09-22 04:00:00+00:00 2002-09-21 21:00:00-08:00 2002-09-22 05:00:00+00:00 2002-09-21 22:00:00-08:00 2002-09-22 06:00:00+00:00 2002-09-21 23:00:00-08:00 2002-09-22 07:00:00+00:00 2002-09-22 00:00:00-08:00 2002-09-22 08:00:00+00:00 2002-09-22 01:00:00-08:00 2002-09-22 09:00:00+00:00 2002-09-22 02:00:00-08:00 2002-09-22 10:00:00+00:00 2002-09-22 03:00:00-08:00 2002-09-22 11:00:00+00:00 2002-09-22 04:00:00-08:00 2002-09-22 12:00:00+00:00 2002-09-22 05:00:00-08:00 2002-09-22 13:00:00+00:00 2002-09-22 06:00:00-08:00 2002-09-22 14:00:00+00:00 2002-09-22 07:00:00-08:00 2002-09-22 15:00:00+00:00 2002-09-22 08:00:00-08:00 2002-09-22 16:00:00+00:00 2002-09-22 09:00:00-08:00 2002-09-22 17:00:00+00:00 2002-09-22 10:00:00-08:00 2002-09-22 18:00:00+00:00 2002-09-22 11:00:00-08:00 2002-09-22 19:00:00+00:00 2002-09-22 12:00:00-08:00 2002-09-22 20:00:00+00:00 2002-09-22 13:00:00-08:00 2002-09-22 21:00:00+00:00 2002-09-22 14:00:00-08:00 2002-09-22 22:00:00+00:00 2002-09-22 15:00:00-08:00 2002-09-22 23:00:00+00:00 2002-09-22 16:00:00-08:00 2002-09-23 00:00:00+00:00 2002-09-22 17:00:00-08:00 2002-09-23 01:00:00+00:00 2002-09-22 18:00:00-08:00 2002-09-23 02:00:00+00:00 2002-09-22 19:00:00-08:00 2002-09-23 03:00:00+00:00 2002-09-22 20:00:00-08:00 2002-09-23 04:00:00+00:00 2002-09-22 21:00:00-08:00 2002-09-23 05:00:00+00:00 2002-09-22 22:00:00-08:00 2002-09-23 06:00:00+00:00 2002-09-22 23:00:00-08:00 2002-09-23 07:00:00+00:00 2002-09-23 00:00:00-08:00 2002-09-23 08:00:00+00:00 2002-09-23 01:00:00-08:00 2002-09-23 09:00:00+00:00 2002-09-23 02:00:00-08:00 2002-09-23 10:00:00+00:00 2002-09-23 03:00:00-08:00 2002-09-23 11:00:00+00:00 2002-09-23 04:00:00-08:00 2002-09-23 12:00:00+00:00 2002-09-23 05:00:00-08:00 2002-09-23 13:00:00+00:00 2002-09-23 06:00:00-08:00 2002-09-23 14:00:00+00:00 2002-09-23 07:00:00-08:00 2002-09-23 15:00:00+00:00 2002-09-23 08:00:00-08:00 2002-09-23 16:00:00+00:00 2002-09-23 09:00:00-08:00 2002-09-23 17:00:00+00:00 2002-09-23 10:00:00-08:00 2002-09-23 18:00:00+00:00 2002-09-23 11:00:00-08:00 2002-09-23 19:00:00+00:00 2002-09-23 12:00:00-08:00 2002-09-23 20:00:00+00:00 2002-09-23 13:00:00-08:00 2002-09-23 21:00:00+00:00 2002-09-23 14:00:00-08:00 2002-09-23 22:00:00+00:00 2002-09-23 15:00:00-08:00 2002-09-23 23:00:00+00:00 2002-09-23 16:00:00-08:00 2002-09-24 00:00:00+00:00 2002-09-23 17:00:00-08:00 2002-09-24 01:00:00+00:00 2002-09-23 18:00:00-08:00 2002-09-24 02:00:00+00:00 2002-09-23 19:00:00-08:00 2002-09-24 03:00:00+00:00 2002-09-23 20:00:00-08:00 2002-09-24 04:00:00+00:00 2002-09-23 21:00:00-08:00 2002-09-24 05:00:00+00:00 2002-09-23 22:00:00-08:00 2002-09-24 06:00:00+00:00 2002-09-23 23:00:00-08:00 2002-09-24 07:00:00+00:00 2002-09-24 00:00:00-08:00 2002-09-24 08:00:00+00:00 2002-09-24 01:00:00-08:00 2002-09-24 09:00:00+00:00 2002-09-24 02:00:00-08:00 2002-09-24 10:00:00+00:00 2002-09-24 03:00:00-08:00 2002-09-24 11:00:00+00:00 2002-09-24 04:00:00-08:00 2002-09-24 12:00:00+00:00 2002-09-24 05:00:00-08:00 2002-09-24 13:00:00+00:00 2002-09-24 06:00:00-08:00 2002-09-24 14:00:00+00:00 2002-09-24 07:00:00-08:00 2002-09-24 15:00:00+00:00 2002-09-24 08:00:00-08:00 2002-09-24 16:00:00+00:00 2002-09-24 09:00:00-08:00 2002-09-24 17:00:00+00:00 2002-09-24 10:00:00-08:00 2002-09-24 18:00:00+00:00 2002-09-24 11:00:00-08:00 2002-09-24 19:00:00+00:00 2002-09-24 12:00:00-08:00 2002-09-24 20:00:00+00:00 2002-09-24 13:00:00-08:00 2002-09-24 21:00:00+00:00 2002-09-24 14:00:00-08:00 2002-09-24 22:00:00+00:00 2002-09-24 15:00:00-08:00 2002-09-24 23:00:00+00:00 2002-09-24 16:00:00-08:00 2002-09-25 00:00:00+00:00 2002-09-24 17:00:00-08:00 2002-09-25 01:00:00+00:00 2002-09-24 18:00:00-08:00 2002-09-25 02:00:00+00:00 2002-09-24 19:00:00-08:00 2002-09-25 03:00:00+00:00 2002-09-24 20:00:00-08:00 2002-09-25 04:00:00+00:00 2002-09-24 21:00:00-08:00 2002-09-25 05:00:00+00:00 2002-09-24 22:00:00-08:00 2002-09-25 06:00:00+00:00 2002-09-24 23:00:00-08:00 2002-09-25 07:00:00+00:00 2002-09-25 00:00:00-08:00 2002-09-25 08:00:00+00:00 2002-09-25 01:00:00-08:00 2002-09-25 09:00:00+00:00 2002-09-25 02:00:00-08:00 2002-09-25 10:00:00+00:00 2002-09-25 03:00:00-08:00 2002-09-25 11:00:00+00:00 2002-09-25 04:00:00-08:00 2002-09-25 12:00:00+00:00 2002-09-25 05:00:00-08:00 2002-09-25 13:00:00+00:00 2002-09-25 06:00:00-08:00 2002-09-25 14:00:00+00:00 2002-09-25 07:00:00-08:00 2002-09-25 15:00:00+00:00 2002-09-25 08:00:00-08:00 2002-09-25 16:00:00+00:00
#get the bathy data
if runname == 'concepts110' or runname == 'jpp72':
bathy, X, Y = tidetools.get_subdomain_bathy_data()
else:
bathy, X, Y = tidetools.get_SS_bathy_data()
#find the closest model point
x1, y1 = tidetools.find_closest_model_point(-float(stat_lon),float(stat_lat),X,Y,bathy)
#Plot locations
tidetools.plot_meas_mod_locations(-float(stat_lon),float(stat_lat),X[x1,y1],Y[x1,y1],X,Y,bathy)
print dateList[0].tzinfo
print dates[0].tzinfo
UTC UTC
#plot measured and modelled timeseries and harmonic data
fig = plt.figure(figsize=(9,9))
plt.plot(dateList,eta[:,x1,y1],label='Model Time Series')
plt.plot(dates,wlev,label='Measured Time Series')
plt.ylabel('Water level (m CD)')
plt.xlabel('Time')
plt.title('Water level at '+stat_name+' (station '+str(stat_num)+')')
plt.legend(bbox_to_anchor=(1.05, 1), loc=2)
fig.autofmt_xdate()