Skip to content

Conversation

@wkearn
Copy link
Member

@wkearn wkearn commented Nov 18, 2024

@wschwanghart: Adding the snapshot test is not such a big change, but it did require moving the private functions createAuxiliaryTopo and getPreSillPixels. Let me know if you would prefer to keep those functions private or put them somewhere else.

--

This adds a snapshot test that calls createAuxiliaryTopo on the test DEM and either saves the resulting auxiliary topography or compares it to the saved snapshot. The TopoToolbox/snapshot_data repository will need to be updated manually if this PR is merged.

createAuxiliaryTopo was previously a private function under @FLOWobj/, which means it was not accessible from outside of FLOWobj methods and could not be tested on its own. It is useful to have the snapshot of the auxiliary topography, because it can help distinguish problems in flow routing over the auxiliary topography from problems in generating the auxiliary topography itself, which I think are important to rule out for TopoToolbox/libtopotoolbox#122.

This PR moves createAuxiliaryTopo.m and getPreSillPixels.m to toolbox/internal so they can be accessed from the test. They could also be conceivably be methods on @GRIDobj, but if we do not want users to rely on them, we should probably keep them in internal.

It might also make sense to move getPreSillPixels into identifyflats. libtopotoolbox returns the presills along with the flats and sills in its identifyflats. However, this might complicate how sills are identified for internal drainage basins, so I have left that for future work, especially once we are able to label closed basins in libtopotoolbox's
identifyflats (TopoToolbox/libtopotoolbox#141).

This adds a snapshot test that calls `createAuxiliaryTopo` on the test
DEM and either saves the resulting auxiliary topography or compares it
to the saved snapshot. The TopoToolbox/snapshot_data repository will
need to be updated manually if this PR is merged.

`createAuxiliaryTopo` was previously a private function under
`@FLOWobj/`, which means it was not accessible from outside of
`FLOWobj` methods and could not be tested on its own. It is useful to
have the snapshot of the auxiliary topography, because it can help
distinguish problems in flow routing over the auxiliary topography
from problems in generating the auxiliary topography itself, which I
think are important to rule out for TopoToolbox/libtopotoolbox#122.

This PR moves `createAuxiliaryTopo.m` and `getPreSillPixels.m` to
`toolbox/internal` so they can be accessed from the test. They could
also be conceivably be methods on `@GRIDobj`, but if we do not want
users to rely on them, we should probably keep them in `internal`.

It might also make sense to move `getPreSillPixels` into
`identifyflats`. libtopotoolbox returns the presills along with the
flats and sills in its `identifyflats`. However, this might complicate
how sills are identified for internal drainage basins, so I have left
that for future work, especially once we are able to label closed
basins in libtopotoolbox's
`identifyflats` (TopoToolbox/libtopotoolbox#141).
@wschwanghart wschwanghart merged commit 5c8a56c into TopoToolbox:main Nov 18, 2024
3 checks passed
wkearn added a commit to wkearn/snapshot_data that referenced this pull request Dec 2, 2024
These snapshots were produced using the topotoolbox3 snapshots as of
TopoToolbox/topotoolbox3#39 (5c8a56c7f1ddbcfaa0980bbbb2376aec58f717b4).
wkearn added a commit to TopoToolbox/snapshot_data that referenced this pull request Dec 2, 2024
These snapshots were produced using the topotoolbox3 snapshots as of
TopoToolbox/topotoolbox3#39 (5c8a56c7f1ddbcfaa0980bbbb2376aec58f717b4).
@wkearn wkearn added the test Testing label Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants