Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/ampang.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
4 changes: 2 additions & 2 deletions scripts/analyse_tides.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion scripts/create_rasters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions scripts/plot_tidal_gauges.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -95,15 +95,15 @@ 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.
for name in tg_order:
# 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"])))
Expand Down
2 changes: 1 addition & 1 deletion sims/base_case/tidal_forcing_tpxo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 4 additions & 3 deletions sims/base_case/tidal_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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)
Expand Down