GIS Logo GSP 118 (318): GIS Programming

Flavors of ArcGIS 10 Functions

One of the complicatoins of ArcGIS Python programming is that there are different "flavors" of the same function calls for many of the functions in ArcGIS. Within ArcGIS, including in the "Results" window, you will see one definition and from an external Python script, you'll see another. As an example, if we execute the "Flow Accumulation" tool and then copy the code from the results window we will see:

arcpy.Fill_sa(<InputRaster>,<OutputRaster>,"#")

Where "InputRaster" is the name of the input layer or a raster file and "OutputRaster" is the name of the output layer or raster file. The "#" indicates that the last parameter is not specified. If we check the ArcGIS 10 (the 10 is important here) help for Flow Accumulation, we find the following definition for this function:

out_surface_raster=Fill(in_surface_raster, {z_limit})

I added the "out_accumulation_raster" raster that is defined as the "Return Type" in the ArcGIS help.

If we check the function definition in Wing we recieve:

Symbol: arcpy.sa.Fill
  Likely type: callable function Fill
    def Fill(in_surface_raster, z_limit = "#")
Fill(in_surface_raster, {z_limit})

  Fills sinks in a surface raster to remove small imperfections in the data.

  Arguments:
  in_surface_raster -- The input raster representing a continuous surface.
  z_limit -- Maximum elevation difference between a sink and its pour point to be filled.

  Results:
  out_surface_raster -- Output surface raster

Notice that the second two are very similar while the code from the Results window is a bit different. You can use the code from the Results window as a starting point but you will need to rework it based on the content from ArcGIS help and/or the function definitions in Python. As a note, the Python definitions shown in Wing are part of the "bindings" between Python and ArcGIS so if anything is going to be correct, it's the information presented there.

Additional Resources

ArcGIS Resource Center: Flow Accumulation Help