Skip to content

Commit

Permalink
Edits required by lint
Browse files Browse the repository at this point in the history
A few edits required by nox lint
  • Loading branch information
angelmons authored and mcflugen committed Dec 4, 2024
1 parent aefd5c6 commit f4d9ef6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from landlab import RasterModelGrid\n",
"from landlab.components import RiverFlowDynamics # Note: Using updated CamelCase naming\n",
"from landlab.io import read_esri_ascii\n",
"from landlab.plot.imshow import imshow_grid"
]
},
Expand Down Expand Up @@ -312,7 +312,7 @@
"outputs": [],
"source": [
"plt.figure(figsize=(12, 4))\n",
"plt.plot(flow_depth, label='Simulated')\n",
"plt.plot(flow_depth, label=\"Simulated\")\n",
"plt.title(\"Flow Depth Along Channel Centerline\")\n",
"plt.xlabel(\"Distance (cells)\")\n",
"plt.ylabel(\"Depth (m)\")\n",
Expand All @@ -338,7 +338,7 @@
"flow_velocity = grid[\"link\"][\"surface_water__velocity\"][linksAtCenter]\n",
"\n",
"plt.figure(figsize=(12, 4))\n",
"plt.plot(flow_velocity, label='Simulated')\n",
"plt.plot(flow_velocity, label=\"Simulated\")\n",
"plt.title(\"Flow Velocity Along Channel Centerline\")\n",
"plt.xlabel(\"Distance (cells)\")\n",
"plt.ylabel(\"Velocity (m/s)\")\n",
Expand Down
10 changes: 8 additions & 2 deletions tests/components/river_flow_dynamics/test_river_flow_dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,14 @@ def create_test_grid():
)
final_depths.append(grid_test.at_node["surface_water__depth"].copy())

except AssertionError:
raise AssertionError(f"Instability detected with dt={dt}")
except AssertionError as err:
raise AssertionError(f"Instability detected with dt={dt}") from err

depth_variations = [
np.max(np.abs(d1 - d2)) for d1, d2 in zip(final_depths[:-1], final_depths[1:])
]
assert np.all(np.array(depth_variations) < 0.1)
assert np.all(np.array(max_velocities) < 10.0)

depth_variations = [
np.max(np.abs(d1 - d2)) for d1, d2 in zip(final_depths[:-1], final_depths[1:])
Expand Down

0 comments on commit f4d9ef6

Please sign in to comment.