I have a counties feature class and dozens of water well feature classes in a project geodatabase. I want to find all the water wells that are assigned to a county but have coordinates that place them outside of that county. My chunk of code just creates a new feature class that's a copy of the original water well feature class. I don't see what's not why this isn't working. I've played around with the selection and inversion clauses to try to get it right. If I invert both I can find wells that are not located within ANY Michigan county, but that's not particularly helpful. Have any ideas why this isn't working right?
```
print("Finding water well outliers")
arcpy.env.workspace = r"C:\Users\BarnbyJ\Documents\ArcGIS\Projects\Water Well Outliers Script\Water Well Outliers Script.gdb"
fcs = arcpy.ListFeatureClasses('*Wells*')
if fcs is not None:
for fc in arcpy.ListFeatureClasses("*_WaterWells"):
countyName = fc.split(".")[0] #assuming that the feature classes all have the same pattern
sel_counties = arcpy.management.SelectLayerByAttribute("Counties", "NEW_SELECTION", "NAME = '{}'", "NON_INVERT").getOutput(0)
sel_wells = arcpy.management.SelectLayerByLocation(fc, "INTERSECT", sel_counties, None, "ADD_TO_SELECTION", "INVERT").getOutput(0)
arcpy.management.CopyFeatures(sel_wells, "{}_WaterWells_Outliers".format(countyName), '', None, None, None)
arcpy.management.SelectLayerByAttribute("Counties", "CLEAR_SELECTION").getOutput(0)
print(sel_counties)
print("Outliers identified")