tried fussing with inputting filename backslashes as either "\" or "\\", didn't help.
lyrFAC = "lyrFAC" lyrFDIR = "lyrFDIR" gp.MakeRasterLayer(flow_acc,lyrFAC) gp.MakeRasterLayer(flow_dir,lyrFDIR) expr = "con(%s <= %s, %s)" % (lyrFAC,1100,lyrFDIR) gp.SingleOutputMapAlgebra_sa(expr,flowdir_channels)
In general I've found them inconvenient because they don't exist anywhere that I can look at them while debugging or just tracing my algorithm's results
E:\work\test1>dir /x Directory of E:\work\test1 06/05/2012 03:42 PM <DIR> . 06/05/2012 03:42 PM <DIR> .. 06/05/2012 03:39 PM <DIR> testa1 06/05/2012 03:40 PM <DIR> TESTBV~1 testbverylongname 06/05/2012 03:42 PM <DIR> TMP_RI~1 tmp_rios_preproc2 0 File(s) 0 bytes 4 Dir(s) 92,880,891,904 bytes free
# Early in script, define hydrology layers, global variables - this code has been used and re-used for years and worked fine on all Arc versions outputws = gp.workspace + os.sep + "Output" + os.sep Hydrows = outputws + "Hydro_layers" + os.sep if not gp.exists(Hydrows + "flow_dir"): # Create flow direction raster gp.FlowDirection_sa(DEM, Hydrows + "flow_dir", "NORMAL") flow_dir = Hydrows + "flow_dir" if not gp.exists(Hydrows + "flow_acc"): # Create flow accumulation raster gp.FlowAccumulation_sa(Hydrows + "flow_dir", Hydrows + "flow_acc", "", "FLOAT") flow_acc = Hydrows + "flow_acc" # Later, set flow direction raster to null where there are streams def define_channels(): try: gp.AddMessage("\nDefining flow direction channels...") exp = "\"VALUE\" > " + str(int(threshold_flowacc)) # THIS IS WHERE THE ERROR OCCURS gp.SetNull_sa(flow_acc, flow_dir, flowdir_channels, exp) # ALTO TRIED THIS gp.SingleOutputMapAlgebra_sa("CON(" + flow_acc + " <= " + threshold_flowacc + ", " + flow_dir, ")", flowdir_channels) except: gp.AddError ("\nError defining flow direction channels: " + gp.GetMessages(2)) raise Exception
When SetNull runs, I get this error - the path is totally garbled:
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.