예제 #1
0
class LicenseError(Exception):
    pass


try:
    #Check for spatial analyst license
    if arcpy.CheckExtension("Spatial") == "Available":
        arcpy.CheckOutExtension("Spatial")
    else:
        raise LicenseError

    inR = arcpy.GetParameterAsText(0)
    r = geomorph_routines_module.checkExt(inR)
    inZUnits = arcpy.GetParameterAsText(1)
    zFactor = geomorph_routines_module.getZFactor(r, inZUnits)
    # Set overwrite option
    env.overwriteOutput = True

    # Getting info on raster
    dscRaster = arcpy.Describe(r)
    inSpRef = dscRaster.spatialReference
    spRefType = inSpRef.type
    cellSize = dscRaster.meanCellHeight
    if spRefType == "Geographic":
        cellSize = cellSize / zFactor
    slope = Slope(r, "DEGREE", zFactor)
    aspect = Aspect(r)

    cosResult = Cos(Divide(Times(3.142, Minus(aspect, 180)), 180))
    outraster = Times(slope, cosResult)
예제 #2
0
class LicenseError(Exception):
    pass


try:
    #Check for spatial analyst license
    if arcpy.CheckExtension("Spatial") == "Available":
        arcpy.CheckOutExtension("Spatial")
    else:
        raise LicenseError

    demRaster = arcpy.GetParameterAsText(0)

    inZUnits = arcpy.GetParameterAsText(1)

    zFactor = geomorph_routines_module.getZFactor(demRaster, inZUnits)
    # Set overwrite option
    env.overwriteOutput = True

    #Set message about running
    arcpy.AddMessage("Running Slope ......")
    sUnits = arcpy.GetParameterAsText(2)
    if sUnits == "DEGREE":
        slopeUnits = sUnits
    else:
        slopeUnits = "PERCENT_RISE"
    outRaster = Slope(demRaster, slopeUnits, zFactor)

    outRasterName = arcpy.GetParameterAsText(3)
    outRaster.save(outRasterName)