-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement decaying D8 flow accumulation #389
Implement decaying D8 flow accumulation #389
Conversation
…/386-add-decaying-flow-accumulation Conflicts: HISTORY.rst
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @phargogh, sorry for the LONG delay here. This looks solid to me, I just had a few questions related to consistency.
cdef struct DecayingValue: | ||
double decayed_value # The value, which will be progressively updated as it decays | ||
double min_value # The minimum value before the Decaying Value should be ignored. | ||
|
||
cdef struct WeightedFlowPixelType: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed the other struct
definitions have a few comments above to describe them. Should these follow that same convention?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, great catch! Patched in 4f0e062
int xi | ||
int yi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other struct
definitions use unsigned int
for pixel location, any reason not to do that here as well for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope! In fact they really should be unsigned int
s for consistency with the way indexes are used elsewhere in the function. Patched in d645b70
# Search the block for root pixels. | ||
# A root pixel is a flow direction pixel that is nodata, which means it | ||
# may be a drain just off the edge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
double decayed_value # The value, which will be progressively updated as it decays | ||
double min_value # The minimum value before the Decaying Value should be ignored. | ||
|
||
cdef struct WeightedFlowPixelType: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this replaces ALL instances of FlowPixelType
. Should we remove that struct definition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly, I'm still seeing FlowPixelType
used in flow_accumulation_mfd
, so I think it makes sense to leave it here for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This PR copies the modifications to D8 flow accumulation implemented for the NCI Water Quality project that allow for pixel loads to decay as they pass over the landscape. You could think of like a pollutant flowing across the landscape, where some fraction is absorbed due to landcover or some other factor.
Tests have been implemented and runtime should only trivially be affected when decaying accumulation is not in use. When decaying accumulation is used, there is an extra cost in memory and in iteration over the pollutant contributions to the pixel.
Fixes #386