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)) 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() 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 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"]))) 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" 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)