import datetime import time import math from pylab import * # Brett Miller 9th October 2015. # This program reads Harmonics for Fort Denison as provided by BOM on the 9th October 2015 # # NOT FOR DISTRIBUTION # the predictions from this code have been cross checked against some daily predictions but # not against all. # USE AT YOUR OWN CAUTION. NO GAURENTEE MADE THAT THESE PREDICTIONS ARE CORRECT. # # The x-tide method for calculating tides is:- # z(t,y,site)= MWL(site) + sum[c=1,N](nodefactor(c,y).amp(c,site).cos( speed(c).t + eqarg(c,y) - kappa(c,site) )) # where # t is the time since the beginning of the year # y is the year # site is the site of interest # N is the number of consituents being included # nodefactor is an amplitude adjustment for each constituent for each year # eqarg is a phase adjustment for each site for each year # amp is the amplitude of each constituent for the site # kappa is the phase adjustment for each constituent for the site # # the harmonics included below in the python code were provided directly to WRL from BOM. harm={} speed=0 amp=1 lag=2 def readlinenocomm(F): l=F.readline() while l[0]=='#': l=F.readline() return l # H=open("HARMONIC","r") l=readlinenocomm(H) numconstits=int(l) print("Number of Constituents = ",numconstits) # Read in the constituent speeds constitspeed={} i=0 while i