Module 7: Working with Rasters
The purpose of this lab was to explore the raster object geoprocessing functions in a Python scripting environment. The final script used the raster object geoprocessing functions .Reclassify, .Slope, and .Aspect functions to create a final raster that combines a reclassified landcover.shp showing only forested land, and highlights slopes between 5° and 20° plus aspect between 150° and 270° from an elevation.shp. The final output raster is below:
The biggest issue I had was with the .Raster function. I defined my new raster as elevraster, however I kept receiving an error that this raster did
not exist when trying to perform the
.Slope function. To correct this, I saved the raster with .save in the working environment folder.
This resolved the error. The other error was a syntax error while saving the final raster.
I simply did not close the parentheses.
Because the script ran without intermediate steps, it was difficult
to ensure that the .Slope and .Aspect functions were performing the correct
calculations when I created the new temp variables for the conditions outlined
in the assignment. To check that the calculations were occurring, I used the .save method to save the intermediate
rasters and compared them to the final. The intermediate rasters were different
from the final and showed that the script was performing correctly.
Comments
Post a Comment