top of page

Slope Aspect Forested Classification​

The Python script classifies slope, aspect and forested lands as follow:

• Moderate slope — between 5 and 20 degrees
• Southerly aspect — between 150 and 270 degrees
• Forested — land cover types of 41, 42, or 43

# Ehsan Momeni

# Raster processing

from arcpy import env, ListRasters, CheckOutExtension, sa

env.workspace = r"C:\Users\emomeni\data"  # Shapefile sources
env.overwriteOutput = True

rasterlist = ListRasters()  # listing all rasters in the input folder
print ("All rasters in the folder are:")
for raster in rasterlist:
    print("\t%s" % raster)

fc = "elevation"  # input data
CheckOutExtension("Spatial")  # checking spatial extension


# slope detection
slope = sa.Slope(fc, "DEGREE")
goodslope1 = slope < 20
goodslope2 = slope > 5
goodfinal = goodslope1 & goodslope2  # combining conditions
goodfinal.save("Moderate_slope.tif")  # saving the results
print("The moderate slopes for 'elevation' between 5 and 20 Degree is saved.")


# aspect detection
aspect = sa.Aspect(fc)
goodaspect1 = aspect < 270
goodaspect2 = aspect > 150
goodfinal = goodaspect1 & goodaspect1  # combining conditions
goodfinal.save("Southerly_aspect.tif")  # saving the results
print("The Southerly aspect for 'elevation' between 150 and 270 Degree is saved.")


# extracting forested land cover
myremap = sa.RemapValue([[41, 1], [42, 2], [43, 3]])
outreclass = sa.Reclassify("landcover.tif", "VALUE", myremap, "NODATA")
outreclass.save("Forested_LC.tif")
print("The forested land cover is saved.")

google_scholar1-300x150.png
ResearchGate.png
Ehsan Momeni ORCID GIS Remote Sensing Ur
Ehsan Momeni LinkedIn GIS Remote Sensing
ncbi-300x150.png
academia.png

(Information on this website may not be up to date)

bottom of page