0

I want to create python script with aim to import him in environment arcmap 10.1 and to make a hydrologic analysis

because the scipt meybe can have many outputs raster file or feature class would like to find a way for automatic save outputs variables in the folder workspace

for example

I want to import a raster file (Dem) and to take as export a 3 raster file from the command fill sinks, Fill Sinks,flow directions and flow accumulation from arc hydro toolbox

cl = my import dem
fill = output for Fill Sinks
fdr = output for flow directions
Fac = output for flow accumulation

and i want export them(3 raster) automatically saved to the folder workspace without definitive output parameters from the user

import arcpy
arcpy.ImportToolbox("C:\Program Files (x86)\ArcGIS\Desktop10.1\ArcToolbox\Toolboxes\Arc Hydro Tools.tbx", "archydrotools")
# Local variables:
arcpy.CheckOutExtension("spatial")
arcpy.env.overwriteOutput = True
arcpy.env.workspace = arcpy.GetParameterAsText(0)
cl = arcpy.GetParameterAsText(1)
# Process: Fill Sinks
arcpy.FillSinks_archydrotools(cl, fill, "", "", "ISSINK_YES")
# Process: Flow Direction
arcpy.FlowDirection_archydrotools(fill, Fdr, "")
# Process: Flow Accumulation
arcpy.FlowAccumulation_archydrotools(Fdr, Fac)

any idea ?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Mar 12, 2014 at 7:25

1 Answer 1

3

From what I understand, you just have to assign fill, Fdr and Fac the name you want to name those raster! They will be automatically saved to the arcpy.env.workspace.

import arcpy
arcpy.ImportToolbox("C:\Program Files (x86)\ArcGIS\Desktop10.1\ArcToolbox\Toolboxes\Arc Hydro Tools.tbx", "archydrotools")
#Set Ouput Names
fill=arcpy.GetParameterAsText(0) + '\\OuputFillRasterName'
Fdr=arcpy.GetParameterAsText(0) + '\\OuputFdrRasterName'
Fac=arcpy.GetParameterAsText(0) + '\\OuputFacRasterName'
# Local variables:
arcpy.CheckOutExtension("spatial")
arcpy.env.overwriteOutput = True
arcpy.env.workspace = arcpy.GetParameterAsText(0)
cl = arcpy.GetParameterAsText(1)
# Process: Fill Sinks
arcpy.FillSinks_archydrotools(cl, fill, "", "", "ISSINK_YES")
# Process: Flow Direction
arcpy.FlowDirection_archydrotools(fill, Fdr, "")
# Process: Flow Accumulation
arcpy.FlowAccumulation_archydrotools(Fdr, Fac)
answered Mar 12, 2014 at 15:08
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.