Skip to content

Commit

Permalink
add one test for calc_net_face_flux_at_cell
Browse files Browse the repository at this point in the history
  • Loading branch information
mcflugen committed Mar 21, 2024
1 parent 19cf57c commit 1142d1c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/grid/test_raster_divergence.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,28 @@
from landlab import RasterModelGrid
from landlab.grid.divergence import calc_flux_div_at_node as calc_flux_div_at_node_slow
from landlab.grid.raster_divergence import calc_flux_div_at_node
from landlab.grid.raster_divergence import calc_net_face_flux_at_cell


def test_calc_net_face_flux_at_cell():
grid = RasterModelGrid((4, 5), xy_spacing=(1.0, 2.0))

unit_flux_at_face = (
*(0.0, 0.0, 0.0),
*(1.0, 0.0, 0.0, 0.0),
*(0.0, 0.0, 0.0),
*(1.0, 0.0, 0.0, 0.0),
*(0.0, 0.0, 0.0),
)

out = calc_net_face_flux_at_cell(grid, unit_flux_at_face)

expected = (
*(2.0, 0.0, 0.0),
*(2.0, 0.0, 0.0),
)

assert_array_almost_equal(out, expected)


@pytest.mark.benchmark(group="small")
Expand Down

0 comments on commit 1142d1c

Please sign in to comment.