Migrate to python 3

master
Dan Howe 5 years ago
parent e6a1bdda32
commit 68389565be

@ -6,14 +6,14 @@ from pylab import *
# Brett Miller 9th October 2015. # Brett Miller 9th October 2015.
# This program reads Harmonics for Fort Denison as provided by BOM on the 9th October 2015 # This program reads Harmonics for Fort Denison as provided by BOM on the 9th October 2015
# #
# NOT FOR DISTRIBUTION # NOT FOR DISTRIBUTION
# the predictions from this code have been cross checked against some daily predictions but # the predictions from this code have been cross checked against some daily predictions but
# not against all. # not against all.
# USE AT YOUR OWN CAUTION. NO GAURENTEE MADE THAT THESE PREDICTIONS ARE CORRECT. # USE AT YOUR OWN CAUTION. NO GAURENTEE MADE THAT THESE PREDICTIONS ARE CORRECT.
# #
# The x-tide method for calculating tides is:- # 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) )) # 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 # where
# t is the time since the beginning of the year # t is the time since the beginning of the year
# y is the year # y is the year
# site is the site of interest # site is the site of interest
@ -42,7 +42,7 @@ H=open("HARMONIC","r")
l=readlinenocomm(H) l=readlinenocomm(H)
numconstits=int(l) numconstits=int(l)
print "Number of Constituents = ",numconstits print("Number of Constituents = ",numconstits)
# Read in the constituent speeds # Read in the constituent speeds
@ -53,7 +53,7 @@ while i<numconstits:
ll=l.split() ll=l.split()
constitspeed[ll[0]]=float(ll[1]) constitspeed[ll[0]]=float(ll[1])
i=i+1 i=i+1
l=readlinenocomm(H) l=readlinenocomm(H)
sy=int(l) sy=int(l)
l=readlinenocomm(H) l=readlinenocomm(H)
@ -77,13 +77,13 @@ while i<numconstits:
j=j+1 j=j+1
equalibrium_arg[constit]=v equalibrium_arg[constit]=v
i=i+1 i=i+1
l=readlinenocomm(H) l=readlinenocomm(H)
if l[0:5]<>'*END*': if l[0:5]!='*END*':
print "Error, expected end after eq args. Got: ",l print("Error, expected end after eq args. Got: ",l)
# Read in the node factors # Read in the node factors
l=readlinenocomm(H) l=readlinenocomm(H)
numyears=int(l) numyears=int(l)
@ -103,10 +103,10 @@ while i<numconstits:
j=j+1 j=j+1
node_factor[constit]=v node_factor[constit]=v
i=i+1 i=i+1
l=readlinenocomm(H) l=readlinenocomm(H)
if l[0:5]<>'*END*': if l[0:5]!='*END*':
print "Error, expected end after node factors. Got: ",l print("Error, expected end after node factors. Got: ",l)
harm['sa']=[0.0410686,0.04,44.3373] harm['sa']=[0.0410686,0.04,44.3373]
harm['ssa']=[0.0821373,0.0233,140.8642] harm['ssa']=[0.0821373,0.0233,140.8642]
@ -222,13 +222,13 @@ harm['MSO5']=[72.9271398,0.0001,247.7639]
harm['MSK5']=[74.0251729,0.0002,189.3859] harm['MSK5']=[74.0251729,0.0002,189.3859]
MSL=0.9952 MSL=0.9952
# Now do the maths # Now do the maths
start_time=datetime.datetime(2016,07,29,0,0,0) start_time=datetime.datetime(2016,7,29,0,0,0)
end_time=datetime.datetime(2016,07,30,0,0,0) end_time=datetime.datetime(2016,7,30,0,0,0)
time_step=datetime.timedelta(minutes=15) time_step=datetime.timedelta(minutes=15)
x=[] x=[]
y=[] y=[]
@ -259,6 +259,3 @@ plt.figure()
plot(x,y,c='g',label='Sample') plot(x,y,c='g',label='Sample')
plt.gcf().autofmt_xdate() plt.gcf().autofmt_xdate()
show() show()

Loading…
Cancel
Save