Module 7 - Rasters
Due to a shortened semester, we were asked to only choose one of the two (2) modules left. I did chose Module 6 even though it was harder than I anticipated. But I wanted to challenge myself and I also didn't leave out Module 7 to learn more tricks in Python.
This module was quite helpful as we didn't tackle much about raster data which I commonly am now working a lot in my job. As I'm working with a project related to catchment/watershed mapping, doing this module gave me more additional insights on Spatial Analyst tools. When using the Spatial Analyst module in Spyder, it is important to add the if-else statement in your script to check if the user is able to access the extension. Same goes to the check-in and check-out lines which I totally forgot and I spent 10-15 minutes figuring out why my code wasn't running. It's only returning an error saying that I don't have access to the extension. Anyways, got it all figured out when I went back and checked the exercise module again.
We were also thought that initially results from the tools are exported as temporary rasters unless we call out the save() option in our code lines. Our output for the assignment was a combination of land cover classification, slope and aspect so defined the best area (maybe) for a certain purpose (agriculture?).
I was hoping Dr. Morgan will also upload all the other modules that students take if it were a longer semester. I saw in the repository that it can go up to Module 12. It will help us exercise our skills in Python - even just the exercise and assignment modules. Please - I really wanted to enhance my Python skills. :)
Alright, here's my final output for this module - looks cool:
Alright, here's my final output for this module - looks cool:
Additional notes to remember when working with rasters (and sometimes vectors too):
- Import arcpy.sa if you are to work with rasters and run some analysis.
- Use the if-else statement when running Spatial Analyst as a checker to confirm if you have access to it.
- Check if you added lines on CheckOutExtension and CheckInExtension so it lets you use the extension outside ArcGIS Pro.
- Use Ampersand (&) “Boolean And” map algebra operator to combine the temporary rasters as well as using it in map algebra operations. It is different when you access SQL in ArcGIS Pro and type in AND.
- Instead of doing map algebra operation separately, especially in between integers, you can use the lessthanequal and morethanequal operators and ampersand (&). Example: finalslope = (outslope >= 5) & (outslope <= 20)
- If you want to export your raster (and not as temporary data), use the .save() to save your output to your specified folder/gdb.
Comments
Post a Comment