-
Notifications
You must be signed in to change notification settings - Fork 10
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
SegmentNetwork.py invalid expression (SelectLayerByAttribute) #300
Comments
@Yorkshirepuddnz Apologies for the super late response, unfortunately it's really difficult to tell what is going on with this error without your dataset. If you haven't figured it out already, I would first try saving the intermediate before the line that fails, running the selection in ArcMap, and then dropping the output of the selection through the rest of the code. |
Good suggestion @mhallerud. @Yorkshirepuddnz there is a UK adaptation of BRAT that was just published by Hugh Graham (see post here in sqlBRAT repo). pyBRAT is a research-grade series of scripts that was pretty unapologetically written for a workflow with nationally available US Data. That said, it has been modified to work with Canadian datasets, UK datasets, and more bespoke US data. None of those have been done (yet) as professional-grade tools to make an easy to use GIS user interface. Conceptually, there is nothing stopping you from applying BRAT, it is just recognizing what the scripts and tools to apply them can and can't do. You're getting stuck at a step that is simply selecting the part of your drainage network you want to use (here a perennial selection) and then will attempt to segment it. Your troubleshooting step seems reasonable (i.e. fudge data to add that piece it is looking for). You could also try to push this past this by attempting to just manually produce what this step does and move to next step, or adjusting that script in what its looking for. I haven't used @h-a-graham 's code, but his UK adaptation of BRAT is in this repo. Alternatively, you could take a look at what he does for dealing with UK data. Paper just came out too. |
@Yorkshirepuddnz it looks like you may need to use 'FTYPE' rather than 'FCODE' for the extra US based column. My understanding is that the USGS data considers ephemeral stream which are filtered out from line 43 in the script here: segmentNetwork.py
AS Joe says, pyBRAT is designed for the US but can be adapted for the uk. The UK version has a similar script to split a stream network here: script PS. a more userfirendly better documented version of the UK BDC repo that Joe shared will be coming out soon. |
Hi all, |
Hi guys,
I'm pretty new to this sorry if I've missed anything out
I'm trying to run the SegmentNetwork.py script for a stream network in the UK. As such it doesn't have the NHD network attributes. I've added an "FCODE" column to the polyline attribute table and populated this with "46006" since the network represents perennial streams only.
I'm running the script in the python window in ArcMap 10.6.1 and get the following traceback:
Runtime error Traceback (most recent call last): File "", line 171, in File "", line 31, in main File "f:\desktop10.6\arcpy\arcpy\management.py", line 7742, in SelectLayerByAttribute raise e ExecuteError: ERROR 000358: Invalid expression Failed to execute (SelectLayerByAttribute).
Any hints would be greatly appreciated,
Many thanks,
Gabe
The text was updated successfully, but these errors were encountered: