Riverscapes / pyBRAT

pyBRAT - Beaver Restoration Assessment Tool (Python)
http://brat.riverscapes.xyz
GNU General Public License v3.0
10 stars 10 forks source link

oPBRC_UI Canal Distance #280

Closed bangen closed 5 years ago

bangen commented 5 years ago

@wally-mac @banderson1618

Quick question. This pertains to the oPBRC_UI calculation in the default conservation restoration model code. The block I have a question about is the first el_if statement. If distance to canals (ipc_canal) is <= 20 meters the reach is classified as 'Considerable Risk'. However, the comments say 'if canals are within 30 meters'. Is 20 meters correct or should we be using 30 meters as a threshold? Let me know and I'll update the code or comments to reflect the correct value.

Code snippet:

    # 'oPBRC_UI' (Areas beavers can build dams, but could be undesireable impacts)
    with arcpy.da.UpdateCursor(out_network, fields) as cursor:
        for row in cursor:

            curr_dams = row[6]
            infrastructure_dist = row[11]
            landuse = row[12]
            ipc_canal = row[17]

            if curr_dams <= 0:
                # if capacity is none risk is negligible
                row[0] = "Negligible Risk"
            elif ipc_canal <= 20:
                # if canals are within 30 meters (usually means canal is on the reach)
                row[0] = "Considerable Risk"
            else:
                # if infrastructure within 30 m or land use is high
                # if capacity is frequent or pervasive risk is considerable
                # if capaicty is rare or ocassional risk is some
                if infrastructure_dist <= 30 or landuse >= 0.66:
                    if curr_dams >= 5.0:
                        row[0] = "Considerable Risk"
                    else:
                        row[0] = "Some Risk"
                # if infrastructure within 30 to 100 m
                # if capacity is frequent or pervasive risk is some
                # if capaicty is rare or ocassional risk is minor
                elif infrastructure_dist <= 100:
                    if curr_dams >= 5.0:
                        row[0] = "Some Risk"
                    else:
                        row[0] = "Minor Risk"
                # if infrastructure within 100 to 300 m or land use is 0.33 to 0.66 risk is minor
                elif infrastructure_dist <= 300 or landuse >= 0.33:
                    row[0] = "Minor Risk"
                else:
                    row[0] = "Negligible Risk"

            cursor.updateRow(row)
wally-mac commented 5 years ago

As far as I know, it should be 30 m. Braden do you concur?

On Tue, Apr 16, 2019 at 10:37 AM bangen notifications@github.com wrote:

@wally-mac https://github.com/wally-mac @banderson1618 https://github.com/banderson1618

Quick question. This pertains to the oPBRC_UI calculation in the default conservation restoration model code. The block I have a question about is the first el_if statement. If distance to canals (ipc_canal) is <= 20 meters the reach is classified as 'Considerable Risk'. However, the comments say 'if canals are within 30 meters'. Is 20 meters correct or should we be using 30 meters as a threshold? Let me know and I'll update the code or comments to reflect the correct value.

Code snippet:

# 'oPBRC_UI' (Areas beavers can build dams, but could be undesireable impacts)
with arcpy.da.UpdateCursor(out_network, fields) as cursor:
    for row in cursor:

        curr_dams = row[6]
        infrastructure_dist = row[11]
        landuse = row[12]
        ipc_canal = row[17]

        if curr_dams <= 0:
            # if capacity is none risk is negligible
            row[0] = "Negligible Risk"
        elif ipc_canal <= 20:
            # if canals are within 30 meters (usually means canal is on the reach)
            row[0] = "Considerable Risk"
        else:
            # if infrastructure within 30 m or land use is high
            # if capacity is frequent or pervasive risk is considerable
            # if capaicty is rare or ocassional risk is some
            if infrastructure_dist <= 30 or landuse >= 0.66:
                if curr_dams >= 5.0:
                    row[0] = "Considerable Risk"
                else:
                    row[0] = "Some Risk"
            # if infrastructure within 30 to 100 m
            # if capacity is frequent or pervasive risk is some
            # if capaicty is rare or ocassional risk is minor
            elif infrastructure_dist <= 100:
                if curr_dams >= 5.0:
                    row[0] = "Some Risk"
                else:
                    row[0] = "Minor Risk"
            # if infrastructure within 100 to 300 m or land use is 0.33 to 0.66 risk is minor
            elif infrastructure_dist <= 300 or landuse >= 0.33:
                row[0] = "Minor Risk"
            else:
                row[0] = "Negligible Risk"

        cursor.updateRow(row)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Riverscapes/pyBRAT/issues/280, or mute the thread https://github.com/notifications/unsubscribe-auth/AU-QUkzYd7o4Kmx_zq6MRb4gfHs6MdMVks5vhfxggaJpZM4cy-bz .

-- Wally Macfarlane 435.512.1839

banderson1618 commented 5 years ago

@bangen I looked at the git blame for that line of code, and it looks like it was inserted in commit 25ac235 by @mhallerud. Might make sense to ask her what she intended.

Wally, I'm not sure, but 30m is what we use normally for buffer widths, so that seems more likely to me.

mhallerud commented 5 years ago

@bangen @banderson1618 My apologies, that comment has the wrong distance. The intent was to flag all canals as 'Considerable Risk' as suggested by the Jordan managers' feedback. Some canals don't exactly coincide with a reach, hence the 20 meter maximum distance from canal. I double checked it on three watersheds and it grabbed all reaches including canals using that 20 meter distance.

bangen commented 5 years ago

Finishing documentation for this issue. @mhallerud did extensive testing on this issue and determined a distance threshold of 20 meters is appropriate. Updated comments in code to reflect the correct values (i.e., 20 m not 30 m).