Skip to content
Merged
Changes from 1 commit
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
16 changes: 8 additions & 8 deletions docs/examples/example_peninsula.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,23 +59,23 @@
x, y = np.meshgrid(La, Wa, sparse=True, indexing="xy")
P = (u0 * R**2 * y / ((x - x0) ** 2 + y**2) - u0 * y) / 1e3

# Set land points to zero
landpoints = P >= 0.0
P[landpoints] = 0.0

if grid_type == "A":
U = u0 - u0 * R**2 * ((x - x0) ** 2 - y**2) / (((x - x0) ** 2 + y**2) ** 2)
V = -2 * u0 * R**2 * ((x - x0) * y) / (((x - x0) ** 2 + y**2) ** 2)
U[landpoints] = 0.0
V[landpoints] = 0.0
elif grid_type == "C":
U = np.zeros(P.shape)
V = np.zeros(P.shape)
V[:, 1:] = P[:, 1:] - P[:, :-1]
U[1:, :] = -(P[1:, :] - P[:-1, :])
V[:, 1:] = (P[:, 1:] - P[:, :-1]) / (La[1] - La[0]) * 1e3
U[1:, :] = -(P[1:, :] - P[:-1, :]) / (Wa[1] - Wa[0]) * 1e3

Check warning on line 75 in docs/examples/example_peninsula.py

View check run for this annotation

Codecov / codecov/patch

docs/examples/example_peninsula.py#L74-L75

Added lines #L74 - L75 were not covered by tests
else:
raise RuntimeError(f"Grid_type {grid_type} is not a valid option")

# Set land points to NaN
landpoints = P >= 0.0
P[landpoints] = np.nan
U[landpoints] = np.nan
V[landpoints] = np.nan

# Convert from m to lat/lon for spherical meshes
lon = La / 1852.0 / 60.0 if mesh == "spherical" else La
lat = Wa / 1852.0 / 60.0 if mesh == "spherical" else Wa
Expand Down
Loading