{"action":"created","issue":{"url":"https://api.github.com/repos/Riverscapes/pyBRAT/issues/109","repository_url":"https://api.github.com/repos/Riverscapes/pyBRAT","labels_url":"https://api.github.com/repos/Riverscapes/pyBRAT/issues/109/labels{/name}","comments_url":"https://api.github.com/repos/Riverscapes/pyBRAT/issues/109/comments","events_url":"https://api.github.com/repos/Riverscapes/pyBRAT/issues/109/events","html_url":"https://github.com/Riverscapes/pyBRAT/issues/109","id":338736554,"node_id":"MDU6SXNzdWUzMzg3MzY1NTQ=","number":109,"title":"Error when creating BRAT table","user":{"login":"kbartelt","id":39836333,"node_id":"MDQ6VXNlcjM5ODM2MzMz","avatar_url":"https://avatars0.githubusercontent.com/u/39836333?v=4","gravatar_id":"","url":"https://api.github.com/users/kbartelt","html_url":"https://github.com/kbartelt","followers_url":"https://api.github.com/users/kbartelt/followers","following_url":"https://api.github.com/users/kbartelt/following{/other_user}","gists_url":"https://api.github.com/users/kbartelt/gists{/gist_id}","starred_url":"https://api.github.com/users/kbartelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kbartelt/subscriptions","organizations_url":"https://api.github.com/users/kbartelt/orgs","repos_url":"https://api.github.com/users/kbartelt/repos","events_url":"https://api.github.com/users/kbartelt/events{/privacy}","received_events_url":"https://api.github.com/users/kbartelt/received_events","type":"User","site_admin":false},"labels":[{"id":656553203,"node_id":"MDU6TGFiZWw2NTY1NTMyMDM=","url":"https://api.github.com/repos/Riverscapes/pyBRAT/labels/help%20wanted","name":"help wanted","color":"128A0C","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-05T21:47:12Z","updated_at":"2018-07-05T21:58:40Z","closed_at":null,"author_association":"COLLABORATOR","body":"I am coming across the following error when running BRAT Step 2 to create the BRAT Table for the Salmon watershed (18010210) for #97 \r\n\r\nI have tried restarting arcMap and my computer. Matt looked the files over for any obvious issues and tried running it on his computer which yielded the same error. @bangen @banderson1618 do you have any suggestions for how to resolve this? Thanks!\r\n`Executing: BRAT_table_tool C:\\Users\\A02295870\\Documents\\FHC\\Salmon_18010210\\BRAT PrelimRun01 18010210 Salmon C:\\Users\\A02295870\\Documents\\FHC\\Salmon_18010210\\BRAT\\Inputs\\02_Network\\Network_1\\NHD_24k_300mReaches.shp C:\\Users\\A02295870\\Documents\\FHC\\Salmon_18010210\\BRAT\\Inputs\\03_Topography\\DEM_1\\NED_DEM_10m.tif # C:\\Users\\A02295870\\Documents\\FHC\\Salmon_18010210\\BRAT\\Inputs\\01_Vegetation\\01_ExistingVegetation\\Ex_Veg_1\\LANDFIRE_140EVT.tif C:\\Users\\A02295870\\Documents\\FHC\\Salmon_18010210\\BRAT\\Inputs\\01_Vegetation\\02_HistoricVegetation\\Hist_Veg_1\\LANDFIRE_140BPS.tif C:\\Users\\A02295870\\Documents\\FHC\\Salmon_18010210\\BRAT\\Inputs\\04_Conflict\\01_ValleyBottom\\Valley_1\\ValleyBottom_Reaches_300m.shp C:\\Users\\A02295870\\Documents\\FHC\\Salmon_18010210\\BRAT\\Inputs\\04_Conflict\\02_Roads\\Roads_1\\tl_2017_county_roads.shp C:\\Users\\A02295870\\Documents\\FHC\\Salmon_18010210\\BRAT\\Inputs\\04_Conflict\\03_Railroads\\Railroads_1\\tl_2017_rails.shp C:\\Users\\A02295870\\Documents\\FHC\\Salmon_18010210\\BRAT\\Inputs\\04_Conflict\\04_Canals\\Canals_1\\NHDCanals.shp C:\\Users\\A02295870\\Documents\\FHC\\Salmon_18010210\\BRAT\\Inputs\\04_Conflict\\05_LandUse\\Land_Use_1\\LANDFIRE_140EVT.tif BRAT_Table true #\r\nStart Time: Thu Jul 05 15:31:20 2018\r\nRunning script BRAT_table_tool...\r\nAdding \"iGeo\" attributes to network\r\ncalculating drainage area\r\nAdding \"iVeg\" attributes to network\r\nAdding \"iPC\" attributes to network\r\n\r\nTraceback (most recent call last):\r\n  File \"<string>\", line 321, in execute\r\n  File \"C:\\Users\\A02295870\\Documents\\FHC\\pyBRAT\\BRAT_table.py\", line 120, in main\r\n    ipc_attributes(seg_network_copy, road, railroad, canal, valley_bottom, buf_30m, buf_100m, landuse, scratch, projPath)\r\n  File \"C:\\Users\\A02295870\\Documents\\FHC\\pyBRAT\\BRAT_table.py\", line 605, in ipc_attributes\r\n    for row in cursor:\r\nRuntimeError: A column was specified that does not exist.\r\n\r\nFailed to execute (BRAT_table_tool).\r\nFailed at Thu Jul 05 15:39:57 2018 (Elapsed Time: 8 minutes 36 seconds)`\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Riverscapes/pyBRAT/issues/comments/402865093","html_url":"https://github.com/Riverscapes/pyBRAT/issues/109#issuecomment-402865093","issue_url":"https://api.github.com/repos/Riverscapes/pyBRAT/issues/109","id":402865093,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjg2NTA5Mw==","user":{"login":"banderson1618","id":21353496,"node_id":"MDQ6VXNlcjIxMzUzNDk2","avatar_url":"https://avatars3.githubusercontent.com/u/21353496?v=4","gravatar_id":"","url":"https://api.github.com/users/banderson1618","html_url":"https://github.com/banderson1618","followers_url":"https://api.github.com/users/banderson1618/followers","following_url":"https://api.github.com/users/banderson1618/following{/other_user}","gists_url":"https://api.github.com/users/banderson1618/gists{/gist_id}","starred_url":"https://api.github.com/users/banderson1618/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/banderson1618/subscriptions","organizations_url":"https://api.github.com/users/banderson1618/orgs","repos_url":"https://api.github.com/users/banderson1618/repos","events_url":"https://api.github.com/users/banderson1618/events{/privacy}","received_events_url":"https://api.github.com/users/banderson1618/received_events","type":"User","site_admin":false},"created_at":"2018-07-05T21:58:39Z","updated_at":"2018-07-05T21:58:39Z","author_association":"COLLABORATOR","body":"I've looked at it, and from what I can tell, it looks like there's something going wrong with the following segment of code:\r\n\r\n```\r\nif \"LUI_Class\" in fields:\r\n    buf_fields = [f.name for f in arcpy.ListFields(buf_100m)]\r\n    if 'oArea' not in buf_fields:\r\n        arcpy.AddField_management(buf_100m, 'oArea', 'DOUBLE')\r\n        with arcpy.da.UpdateCursor(buf_100m, ['SHAPE@AREA', 'oArea']) as cursor:\r\n            for row in cursor:\r\n                row[1] = row[0]\r\n                cursor.updateRow(row)\r\n    landuse_poly = arcpy.RasterToPolygon_conversion(landuse, os.path.join(scratch, 'landuse_poly'), 'NO_SIMPLIFY', \"LUI_Class\")\r\n    landuse_int = arcpy.Intersect_analysis([landuse_poly, buf_100m], os.path.join(scratch, 'landuse_int'))\r\n    arcpy.AddField_management(landuse_int, 'propArea', 'DOUBLE')\r\n    with arcpy.da.UpdateCursor(landuse_int, ['SHAPE@AREA', 'oArea', 'propArea']) as cursor:\r\n        for row in cursor:\r\n            row[2] = row[0]/row[1]\r\n            cursor.updateRow(row)\r\n    areaTbl = arcpy.Statistics_analysis(landuse_int, os.path.join(scratch, 'areaTbl'), [['propArea', 'SUM']], ['ReachID', 'LUI_CLASS'])\r\n    areaPivTbl = arcpy.PivotTable_management(areaTbl, ['ReachID'], 'LUI_CLASS', 'SUM_propArea', os.path.join(scratch, 'areaPivTbl'))\r\n\r\n    # create empty dictionary to hold input table field values\r\n    tblDict = {}\r\n    # add values to dictionary\r\n    with arcpy.da.SearchCursor(areaPivTbl, ['ReachID', 'VeryLow', 'Low', 'Moderate', 'High']) as cursor:\r\n        for row in cursor:\r\n            tblDict[row[0]] = [row[1], row[2], row[3], row[4]]\r\n```\r\nSpecifically, something is causing `areaPivTbl` to not have the one of the attributes it needs in that last SearchCursor. I'm not familiar with this segment of code, so I don't know how it gets those attributes normally, much less why it's not now, but that's what I could identify. @bangen, do you see anything wrong with this code?"}}
{"actor":{"display_login":"banderson1618"}}