From f5358faf2a789bf21ccd97173f38f297f0b41e00 Mon Sep 17 00:00:00 2001 From: Holly Smith <148814807+has2301@users.noreply.github.com> Date: Thu, 1 Feb 2024 14:38:27 +0000 Subject: [PATCH 1/6] Update tidal_forcing_tpxo.py Added "params" to (start_datetime) on line 12 --- sims/base_case/tidal_forcing_tpxo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sims/base_case/tidal_forcing_tpxo.py b/sims/base_case/tidal_forcing_tpxo.py index fc3bc41..433abe5 100644 --- a/sims/base_case/tidal_forcing_tpxo.py +++ b/sims/base_case/tidal_forcing_tpxo.py @@ -9,7 +9,7 @@ constituents = params.constituents tide = uptide.Tides(constituents) # set your start date and time -tide.set_initial_time(start_datetime) +tide.set_initial_time(params.start_datetime) # point me at your TPXO files (grid and h_ data) grid_file_name = "../../data/grid_tpxo9.nc" From 2bc62f7e983445715ada1d26478d5de32f8dcc16 Mon Sep 17 00:00:00 2001 From: Holly Smith <148814807+has2301@users.noreply.github.com> Date: Thu, 1 Feb 2024 14:43:29 +0000 Subject: [PATCH 2/6] Update tidal_model.py --- sims/base_case/tidal_model.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sims/base_case/tidal_model.py b/sims/base_case/tidal_model.py index 5565813..0350f96 100644 --- a/sims/base_case/tidal_model.py +++ b/sims/base_case/tidal_model.py @@ -15,9 +15,10 @@ t_end = params.end_time output_dir = params.output_dir utm_zone = params.utm_zone -utm_band=params.utm_band +utm_band = params.utm_band cent_lat = params.cent_lat cent_lon = params.cent_lon +t_start = 0 # read bathymetry code chk = CheckpointFile('bathymetry.h5', 'r') @@ -59,8 +60,8 @@ def coriolis(mesh, lat, lon): sim_tz = timezone.pytz.utc tau = Function(CG_2d_vec, name="tau") pressure = Function(CG_2d, name="pressure") -tau_file = File(outputdir + '/tau.pvd') -pressure_file = File(outputdir + '/pressure.pvd') +tau_file = File(output_dir + '/Wind/tau.pvd') +pressure_file = File(output_dir + '/Pressure/pressure.pvd') coord_system = coordsys.UTMCoordinateSystem(utm_zone=30, south=True) start_datetime = datetime.datetime(2020,2,14,0,0,0,tzinfo=sim_tz) From 9851728f2856cc7cdafb63c0c860fad80bfc25fb Mon Sep 17 00:00:00 2001 From: Holly Smith <148814807+has2301@users.noreply.github.com> Date: Thu, 1 Feb 2024 14:45:22 +0000 Subject: [PATCH 3/6] Update ampang.py --- scripts/ampang.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ampang.py b/scripts/ampang.py index 83625b2..dead6b8 100644 --- a/scripts/ampang.py +++ b/scripts/ampang.py @@ -35,8 +35,8 @@ def __init__(self, reff=1.0, fig=None, rect=111, label='_', amprange=[0, 1.5],am self.reff = reff # Reference standard deviation self.amprange = amprange self.phsrange = phsrange - idv = np.int( ( ampthck[1]+0.0000001 - ampthck[0] ) / ampthck[2] )+1 - jdv = np.int( ( phsthck[1]+0.0000001 - phsthck[0] ) / phsthck[2] )+1 + idv = np.int_( ( ampthck[1]+0.0000001 - ampthck[0] ) / ampthck[2] )+1 + jdv = np.int_( ( phsthck[1]+0.0000001 - phsthck[0] ) / phsthck[2] )+1 tr = PolarAxes.PolarTransform() degree_ticks = lambda d: (d*np.pi/180, "%d$^\\circ$"%(d)) From 13991fe7c8e311562aa7be70f55524186f7fd722 Mon Sep 17 00:00:00 2001 From: Holly Smith <148814807+has2301@users.noreply.github.com> Date: Thu, 1 Feb 2024 14:48:14 +0000 Subject: [PATCH 4/6] Update analyse_tides.py --- scripts/analyse_tides.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/analyse_tides.py b/scripts/analyse_tides.py index c1521b6..8890034 100644 --- a/scripts/analyse_tides.py +++ b/scripts/analyse_tides.py @@ -67,12 +67,12 @@ ignore = [] model_data = {} -thetis_times = np.arange(params.spin_up, params.end_time, params.output_time) +thetis_times = np.arange(params.spin_up, params.end_time+params.output_time, params.output_time) df = pd.read_csv(model_input, header=None) for name in tg_order: # pull amplitude - idx = tg_order.index(name) + idx = tg_order.index(name)+1 # Subtract mean thetis_elev = df.iloc[:, idx] thetis_elev = thetis_elev - thetis_elev.mean() From 3b910e8588cb31141738d1f5ce0d92ac4d704e3b Mon Sep 17 00:00:00 2001 From: Holly Smith <148814807+has2301@users.noreply.github.com> Date: Thu, 1 Feb 2024 14:58:48 +0000 Subject: [PATCH 5/6] Update create_rasters.sh --- scripts/create_rasters.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/create_rasters.sh b/scripts/create_rasters.sh index 7c47b95..abdccf5 100755 --- a/scripts/create_rasters.sh +++ b/scripts/create_rasters.sh @@ -23,7 +23,7 @@ function process_file { # loop over variables with counter echo " Rasterising ${var}" # create the raster ov the vtu - mpiexec -n ${ncore} python h5_2_raster.py --resolution ${resolution} ${file} ${mesh} temp --func ${var} + python h5_2_raster.py --resolution ${resolution} ${file} ${mesh} temp --func ${var} # create a filename filename="${directory}/${var}".nc #mask it From 485593c62839a22e197c327bf97e995138a45b1c Mon Sep 17 00:00:00 2001 From: Holly Smith <148814807+has2301@users.noreply.github.com> Date: Thu, 1 Feb 2024 15:04:49 +0000 Subject: [PATCH 6/6] Update plot_tidal_gauges.py --- scripts/plot_tidal_gauges.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/plot_tidal_gauges.py b/scripts/plot_tidal_gauges.py index d43fa94..e1d4576 100644 --- a/scripts/plot_tidal_gauges.py +++ b/scripts/plot_tidal_gauges.py @@ -40,7 +40,7 @@ def tex_escape(text): constituents = params.constituents tide = uptide.Tides(constituents) # select which constituents to use -tide.set_initial_time(params.start_datetime) +tide.set_initial_time(params.start_datetime + datetime.timedelta(hours=10)) t_start = params.spin_up t_export = params.output_time @@ -73,7 +73,7 @@ def tex_escape(text): tg_order = [] # we need to do things in order, so this helps keep track try: with open(tide_gauges, 'r') as csvfile: - # need to read in a couple of lines, rather thana set of bytes + # need to read in a couple of lines, rather than a set of bytes # for sniffer to work properly temp_lines = csvfile.readline() + '\n' + csvfile.readline() dialect = csv.Sniffer().sniff(temp_lines, delimiters=",\t") @@ -95,7 +95,7 @@ def tex_escape(text): sys.exit(1) # list which gauges want plotting -model_times = np.arange(t_start,t_end,t_export) +model_times = np.arange(t_start,t_end+t_export,t_export) df = pd.read_csv(model_input, header=None) # now loop over tide gauges and plot them. @@ -103,7 +103,7 @@ def tex_escape(text): # pull amplitude obs_amps = [] obs_phases = [] - idx = tg_order.index(name) + idx = tg_order.index(name) + 1 for t in constituents: obs_amps.append(float(tide_gauge_data[name][t+" amp"])) obs_phases.append(np.radians(float(tide_gauge_data[name][t+" phase"])))