Ik ben momenteel bezig met het herschrijven van de volgende Python Module:<\/P>
<\/P>
Ik realiseerde me net dat ArcHydro de arcpy.env.workspace of de ArcHydroTools.SetTargetLocations("HydroConfig", "Layers", "RasterWorkspace", "VectorWorkspace") niet herkent<\/P>
'''Gemaakt op 13 maart 2017ArcHydro Hoofdmodel@author: PeterW'''<\/SPAN># importeer systeemmodules en site-packages<\/SPAN>from<\/SPAN> pathlib import<\/SPAN> Pathimport<\/SPAN> arcpyimport<\/SPAN> ArcHydroTools# stel argumenten in<\/SPAN>rasters_workspace =<\/SPAN> r"E:\Projects\2016\G113386\ArcHydro\Model01\Layers01"<\/SPAN>dem =<\/SPAN> r"E:\Projects\2016\G113386\DEM\raw"<\/SPAN>fgdb_workspace =<\/SPAN> r"E:\Projects\2016\G113386\ArcHydro\Model01\Model01.gdb"<\/SPAN># check extensies uit en stel omgevingsinstellingen in<\/SPAN>arcpy.<\/SPAN>CheckOutExtension(<\/SPAN>"Spatial"<\/SPAN>)<\/SPAN>arcpy.<\/SPAN>env.<\/SPAN>overwriteOutput =<\/SPAN> True<\/SPAN>def<\/SPAN> rasters_main<\/SPAN>(<\/SPAN>rasters_workspace, <\/SPAN>dem)<\/SPAN>:<\/SPAN>""" Maak Rasters als onderdeel van ArcHydro Pre-processing"""<\/SPAN># stel raster workspace in<\/SPAN> arcpy.<\/SPAN>env.<\/SPAN>workspace =<\/SPAN> rasters_workspace# stel ArcHyro Doellocaties in voor Raster en Vector Datasets<\/SPAN> ArcHydroTools.<\/span>SetTargetLocations("HydroConfig", "Layers", rasters_workspace, fgdb_workspace) # maak Fill Sinks raster aan arcpy.AddMessage("Verwerken Fill Sinks") ArcHydroTools.FillSinks(dem, "fil")# maak Flow Direction raster aanrasters_main(rasters_workspace, dem)< </ span > << EM O J I _ 34 >> </ span > << EM O J I _ 35 >> </ span > << EM O J I _ 36 >> </ span > < / CODE > < / PRE > < P > Python Module: arcpy.env.workspace en ArcHydroTools.SetTargetLocations genegeerd door ArcHydro < / P > < P > < / P > < PRE klasse = " lia-code-sample line-numbers language-none " >< CODE > Verwerken Fill Sinks Traceback ( meest recente oproep laatst ) : Bestand " E : \ Python \ Eclipse \ 2015 \ arcpy64bit \ src \ archydro \ archydro_main_test.py " , regel 34 , in < module > rasters_main ( rasters_workspace , dem ) Bestand " E : \ Python \ Eclipse \ 2015 \ arcpy64bit \ src \ archydro \ archydro_main_test.py " , regel 31 , in rasters_main ArcHydroTools . FillSinks ( dem , " fil " ) Bestand " C : \ Program Files \ ESRI \ WaterUtils \ ArcHydro \ bin \ ArcHydroTools.py " , regel 6805 , in FillSinks raise e arcgisscripting . ExecuteError : U moet ofwel de geoprocessing Workspace instellen of de Arc Hydro Raster Locatie voordat u de tool uitvoert . Mislukt om uit te voeren ( FillSinks ) . << EM O J I _ 37 >> << EM O J I _ 38 >> << EM O J I _ 39 >> << EM O J I _ 40 >> << EM O J I _ 41 >> << EM O J I _ 42 >> << EM O J I _ 43 >> << EM O J I _ 44 >> << EM O J I _ 45 >> << EM O J I _ 46 >> << EM O J I _ 47 >> << EM O J I _ 48 >> << EM O J I _ 49 >> </ CODE > </ PRE > < P > Foutmelding : < / P > < P > < / P > < P > Ik gebruik momenteel ArcGIS 10.3.1 en ArcHydroTools 10.3.0.78 < / P > </ BODY > </ HTML >
I don't know if this will fix your problem, but I was having a similar issue (except with vector location instead of raster location) with ThinCrossSection tool even though I set the arcpy enviroment and ArcHydro's target locations.
The issue seems to be that you need a full path to a feature instead of just the name:
<SPAN class="comment token"># This did not work for me</SPAN> ArcHydroTools<SPAN class="punctuation token">.</SPAN>ThinCrossSection<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"TEMP"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"MaxNumberOfVertices"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">500</SPAN><SPAN class="punctuation token">,</SPAN> output<SPAN class="punctuation token">,</SPAN> report<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># This did</SPAN> output <SPAN class="operator token">=</SPAN> gdb_path <SPAN class="operator token">+</SPAN> <SPAN class="string token">'\\'</SPAN> <SPAN class="operator token">+</SPAN> output report <SPAN class="operator token">=</SPAN> gdb_path <SPAN class="operator token">+</SPAN> <SPAN class="string token">'\\'</SPAN> <SPAN class="operator token">+</SPAN> report ArcHydroTools<SPAN class="punctuation token">.</SPAN>ThinCrossSection<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"TEMP"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"MaxNumberOfVertices"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">500</SPAN><SPAN class="punctuation token">,</SPAN> output<SPAN class="punctuation token">,</SPAN> report<SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
And with this, I just had to set the arcpy workspace - I don't need to call SetTargetLocations from ArcHydro.
So specifically for yours, replacing 'fil' in the FillSinks call with the full path to 'fil' might work
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.