Actualmente estoy ocupado reescribiendo el siguiente Módulo de Python:<\/P>
<\/P>
Acabo de darme cuenta de que ArcHydro no reconoce arcpy.env.workspace ni ArcHydroTools.SetTargetLocations("HydroConfig", "Layers", "RasterWorkspace", "VectorWorkspace")<\/P>
'''Creado el 13 de marzo de 2017Modelo Principal de ArcHydro@author: PeterW'''<\/SPAN># importar módulos del sistema y site-packages<\/SPAN>from<\/SPAN> pathlib import<\/SPAN> Pathimport<\/SPAN> arcpyimport<\/SPAN> ArcHydroTools# establecer argumentos<\/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># verificar extensiones y establecer configuraciones del entorno<\/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> """ Crear Rasters como parte del Pre-procesamiento de ArcHydro"""<\/SPAN> # establecer workspace para raster<\/SPAN> arcpy.<\/SPAN>env.<\/SPAN>workspace =<\/SPAN> rasters_workspace # establecer ArcHyro Target Locations para conjuntos de datos Raster y Vectoriales<\/SPAN> ArcHydroTools.<\/SPA N>SetTargetLocations("HydroConfig"</ SPAN>, < SPAN clas s= "string toke n ">"Layers"</ SPAN>, rasters_workspace, fgdb_workspace)< /SP AN > < SPAN clas s= "comment toke n "># crear raster Fill Sinks</ SPAN > arcpy.AddMessage(< SPAN clas s= "string toke n ">"Procesando Fill Sinks"</ SPAN >) ArcHydroTools.FillSinks(dem, "fil") < SPAN clas s= "comment toke n "># crear raster Flow Direction</ SPAN >rasters_main(rasters_workspace, dem)</ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN ></ SPAN > </ SPA N ></ CODE ></ PRE >< P >Módulo de Python: arcpy.env.workspace y ArcHydroTools.SetTargetLocations ignorados por ArcHydro</ P >< P ></ P >< PRE class = "lia-code-sample line-numbers language-none">< CODE >Procesando Fill SinksTraceback (última llamada más reciente): Archivo "E:\Python\Eclipse\2015\arcpy64bit\src\archydro\archydro_main_test.py", línea 34, en rasters_main(rasters_workspace, dem) Archivo "E:\Python\Eclipse\2015\arcpy64bit\src\archydro\archydro_main_test.py", línea 31, en rasters_main ArcHydroTools.FillSinks(dem, "fil") Archivo "C:\Program Files\ESRI\WaterUtils\ArcHydro\bin\ArcHydroTools.py", línea 6805, en FillSinks raise earcgisscripting.ExecuteError: Necesita establecer ya sea el geoprocessing Workspace o la ubicación Raster de Arc Hydro antes de ejecutar la herramienta.No se pudo ejecutar (FillSinks). << EM OJ I _40 >> </ span>< span >< < EM OJ I _41 >> </ span>< span >< < EM OJ I _42 >> </ span>< span >< < EM OJ I _43 >> </ span>< span >< < EM OJ I _44 >> </ span>< span >< < EM OJ I _45 >> </ span>< span >< < EM OJ I _46 >> </ span>< span >< < EM OJ I _47 >> </ span>< span >< < EM OJ I _48 >> </ span>< span >< < EM OJ I _49 >> </ span ></ CODE ></ PRE >< P >Mensaje de error:< /P>< /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
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.