Skip to content

Commit

Permalink
fixing typos in stereo-video example
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Pelaez-Zapata committed Dec 4, 2024
1 parent b534bb0 commit b53fcb2
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions docs/gallery/plot_stereo_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@
# Computing directional wave spectra
# ----------------------------------
#
# Now, we are going to download the netCDF4 containing the streo-images data.
# The the file will be downloaded and place into the data folder. This might
# take a few minutes.
# Now, we are going to download the netCDF4 containing the streo-images data and
# place it into the data folder. This might take a few minutes.

# check if the file is already cached
if not os.path.exists(LOCAL_VIDEO_FILE):
Expand Down Expand Up @@ -106,12 +105,14 @@
# loop for each configuration
for indices, title in zip((indices1, indices2, indices3, indices4), titles):

# pick the elevation time series from the image
x = np.array([nc_obj["X"][i,j] for i,j in indices])
y = np.array([nc_obj["Y"][i,j] for i,j in indices])
eta = np.array([nc_obj["Z"][:8192,i,j] for i,j in indices])
time = nc.num2date(nc_obj['time'][:8192], units=nc_obj["time"].units)
elements = np.arange(len(x))

# create input dataset
dataset = xr.Dataset(
data_vars = {
"surface_elevation": (["time", "element"], eta.T),
Expand All @@ -121,14 +122,14 @@
coords = {"time": time, "element": elements},
attrs = {"sampling_rate": 10}
)
print(dataset)

# run the ewdm.Arrays code and obtain the directional spectrum
spec = ewdm.Arrays(dataset)
output = spec.compute(
cross_wavelet=True, solver="least-squares", kappa=36
)
print(output)

# plot the results
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(8,3.5))
plot_directional_spectrum(
output.directional_spectrum, ax=ax2, levels=None, colorbar=True,
Expand All @@ -141,3 +142,8 @@
)
ax1.plot(x, y, "o", mec="indigo", mfc="w")
ax1.set_title(title)

# %%
# There are clearly some differences between the chosen configuration. However,
# the main wave direction is consistet the the reports of Guimaraes et al
# (2020).

0 comments on commit b53fcb2

Please sign in to comment.