Riverscapes / QRiS

Riverscapes Studio - for QGIS
https://qris.riverscapes.net
GNU General Public License v3.0
2 stars 0 forks source link

Integrated Width Script #19

Closed philipbaileynar closed 3 years ago

philipbaileynar commented 3 years ago

The task is to write an integrated width calculation script:

Pseudo Code

  1. Loop over each polygon
  2. Intersect the polygon with the centerline to retrieve the portion of the centerline that intersects the polygon.
  3. Divide the area of the polygon by the length of the centerline that passes through the poylgon.
  4. Add IWidth attribute to the polygon feature class (what if it exists already?)
  5. Store IWidth values.

Questions

  1. What happens if the user provides and empty centerline or polygon feature class?
  2. What happens if the centerline or polygon feature class are in different projections?
  3. What happens if the centerline doesn't pass through one or more polygons?
  4. What happens if the IWidth field already exists on the polygon feature class?
  5. What happens if the user wants to calculate integrated width for multiple centerlines?
  6. What happens with multiple centerlines (i.e. side channels?)
  7. What happens at top and bottom of reach if the centerline starts or ends partially inside the top or bottom most segment of the channel?
  8. What happens if the polygon has a donut in it?
  9. What happens if the centerline (erroneously) passes outside part of the polygon and re-enters, producing two segments that intersect the polygon?

Resource

joewheaton commented 3 years ago

This is a good exercise... we need to discuss what is coming in from VBET though and/or a user provided segmentation assessment polygon.

In meantime, I think before we do this we should review: Notebaert, Bastiaan, and Herve Piegay. “Multi-Scale Factors Controlling the Pattern of Floodplain Width at a Network Scale: The Case of the Rhone Basin, France.” Geomorphology 200 (October 15, 2013): 155–71. https://doi.org/10.1016/j.geomorph.2013.03.014.

This method is what @KellyMWhitehead emulated in an ealier ArcPy version of GNAT and is what is in the latest versions (Q) of Fluvial Corridor Toolbox.

1-s2.0-S0169555X13001554-main.pdf

nick4rivers commented 3 years ago

@joewheaton and @philipbaileynar

Just let you know I just stumped out the basics of this and it's really just a call to an existing processing tool and adding some attributes. Basics of my script being developed in this repo.

https://github.com/nick4rivers/Q-integrated-width

I'll add in some of the error capture considerations @philipbaileynar mentions above and follow up.

philipbaileynar commented 3 years ago

I think for the purposes of this script, it can assume that the segmented is already complete. Let's keep this script with a single responsibility of calculating integrated width. A separate piece of code will wrestle with segmentation.

nick4rivers commented 3 years ago

@philipbaileynar - you mean don't even segment the line by the valley bottom segments (sausages)? Just stick with the calculation and handling errors/edge cases?

and thanks for the article!

philipbaileynar commented 3 years ago

You will need to "intersect" the centerline with each polygon in the valley bottom featureclass.

Assume the centerline is one or more long lines spanning multiple valley bottom segments. And assume that the valley bottom segments have already been segmented correctly.

nick4rivers commented 3 years ago

Thanks Philip, yup - that's what it's doing. Thanks @philipbaileynar

nick4rivers commented 3 years ago

@philipbaileynar - I'm going to close this one, see this repo for the approach: https://github.com/nick4rivers/Q-integrated-width.

Good learning exercise - and I did go through a handful of the exceptions you specified. However, some of them should be addressed within the context of a riverscapes studio plugin. Also, I don't have the entire script in a function because the QGIS python interpreter has a problem with spaces in code blocks. Pretty crazy for a program built on Python.

The script just segments up a centerline, calculates lengths, areas, and an integrated width.