AnsweredAssumed Answered

ArcHydro doesn't recognize workspace or target locations in Python ?

Question asked by Playa on Mar 13, 2017
Latest reply on Apr 24, 2017 by jherold_sai

I'm currently busy re-writing the following Python Module:

 

 

I have just realised that ArcHydro doesn't recognize the arcpy.env.workspace or the ArcHydroTools.SetTargetLocations("HydroConfig", "Layers", "RasterWorkspace", "VectorWorkspace")

 

'''
Created on March 13, 2017

ArcHydro Main Model

@author: PeterW
'''


# import system modules and site-packages
from pathlib import Path
import arcpy
import ArcHydroTools

# set arguments
rasters_workspace = r"E:\Projects\2016\G113386\ArcHydro\Model01\Layers01"
dem = r"E:\Projects\2016\G113386\DEM\raw"
fgdb_workspace = r"E:\Projects\2016\G113386\ArcHydro\Model01\Model01.gdb"


# check out extensions and set environment settings
arcpy.CheckOutExtension("Spatial")
arcpy.env.overwriteOutput = True


def rasters_main(rasters_workspace, dem):
    """ Create Rasters as part of ArcHydro Pre-processing"""
    # set raster workspace
    arcpy.env.workspace = rasters_workspace
    # set ArcHyro Target Locations for Raster and Vector Datasets
    ArcHydroTools.SetTargetLocations("HydroConfig", "Layers", rasters_workspace, fgdb_workspace)
    # create Fil Sinks raster
    arcpy.AddMessage("Processing Fill Sinks")
    ArcHydroTools.FillSinks(dem, "fil")
    # create Flow Direction raster

rasters_main(rasters_workspace, dem)

Python Module: arcpy.env.workspace and ArcHydroTools.SetTargetLocations ignored by ArcHydro

 

Processing Fill Sinks
Traceback (most recent call last):
  File "E:\Python\Eclipse\2015\arcpy64bit\src\archydro\archydro_main_test.py", line 34, in <module>
    rasters_main(rasters_workspace, dem)
  File "E:\Python\Eclipse\2015\arcpy64bit\src\archydro\archydro_main_test.py", line 31, in rasters_main
    ArcHydroTools.FillSinks(dem, "fil")
  File "C:\Program Files\ESRI\WaterUtils\ArcHydro\bin\ArcHydroTools.py", line 6805, in FillSinks
    raise e
arcgisscripting.ExecuteError: You need to set either the geoprocessing Workspace or the Arc Hydro Raster Location before running the tool.
Failed to execute (FillSinks).

Error Message:

 

I'm currently using ArcGIS 10.3.1 and ArcHydroTools 10.3.0.78

Outcomes