diff --git a/sydney_tides.py b/sydney_tides.py index 041febc..b4b2a5a 100644 --- a/sydney_tides.py +++ b/sydney_tides.py @@ -24,6 +24,10 @@ import math # # the harmonics included below in the python code were provided directly to WRL from BOM. +START_TIME = '2020-01-01' +END_TIME = '2020-12-31' +OUTPUT_NAME = 'levels.csv' + harm = {} speed = 0 amp = 1 @@ -225,24 +229,24 @@ MSL = 0.9952 # Now do the maths -start_time = datetime.datetime(2019, 11, 29, 0, 0, 0) -end_time = datetime.datetime(2019, 12, 5, 0, 0, 0) +start_time = datetime.datetime.strptime(START_TIME, '%Y-%m-%d') +end_time = datetime.datetime.strptime(END_TIME, '%Y-%m-%d') time_step = datetime.timedelta(minutes=15) x = [] y = [] -F = open("tide.out", "w") +F = open(OUTPUT_NAME, "w") t = start_time while (t < end_time): offset = t - datetime.datetime(t.year, 1, 1, 0, 0, 0) - yr = t.year - sy + year_idx = t.year - sy t1 = (offset.days) * 24.0 + offset.seconds / 3600.0 z = MSL for constit in harm.keys(): if constit in node_factor: - nf = node_factor[constit][yr] - ea = equalibrium_arg[constit][yr] + nf = node_factor[constit][year_idx] + ea = equalibrium_arg[constit][year_idx] else: nf = 1.0 ea = 0.0