r-barnes / faster-unmixer

A faster implementation of the sediment inverse/unmixing scheme proposed in Lipp et al (2021).
6 stars 1 forks source link

D8 boundary conditions #43

Closed AlexLipp closed 1 year ago

AlexLipp commented 1 year ago

Currently, to build the sample network in faster-unmixer.cpp we iterate from sink nodes, upstream into the headwaters and label any sample nodes we discover as we go. This assumes that every cell in the domain drains into a sink node within the domain. If this is not the case an exception is raised indicating that the network area is not equal to the area of the domain. This means that in practise we often require the input D8 raster to have a boundary condition of sink nodes.

This PR makes this data assumption explicit. faster-unmixer.cpp now raises an exception if there are any boundary nodes which are not sinks. Additionally, it updates the data input assumptions in the read-me file to reflect this boundary condition assumption (and corrects mistakes in the data assumption about the coordinates)

This patches issue #42 but longer term we may wish to restructure the network building procedure to not require this boundary condition.