Select to view content in your preferred language

Python Code for Suitability Mapping

194
1
a month ago
IA_GIS
by
New Contributor

Hello! I’m fairly new to Python and still learning, particularly when working with ArcPy in ArcPro. I’m working on an internship project with a non-profit, and I’ve run into some challenges that I hope this community might be able to help me with.

Project Background: As part of my project, I am developing a suitability model for agricultural crops using future climate data. We are working with several data layers in .TIFF and .CRF formats, including:

  • Soil
  • Growing Degree Days
  • Land Use
  • Temperature (multidimensional data with 12 months, including min, max, and mean values)
  • Precipitation (also multidimensional with 12 months of data)

The aim is to classify the layers into three categories: Ideal, Suitable, and Unsuitable. After classification, we want to average each pixel’s value across these suitability layers to produce a final output.

Issue: I am using ArcPy in ArcPro to automate parts of the process, such as remapping, clipping, and reprojecting data. However, I've encountered two key issues:

  1. The code I wrote runs quite slowly, especially for large datasets. I'm not sure whether it's due to the way I've written the script or a limitation of the processing power I'm using.

  2. I’m having trouble storing the .CRF files in memory, which might be impacting the performance further. I’ve considered trying multiprocessing to speed up the process but am unsure how to properly implement it within this context.

Questions:

  1. Would it be possible to optimize the script using multiprocessing to enhance performance?
  2. Should I consider using Map Algebra for specific tasks like remapping or reclassifying, instead of relying on the current ArcPy approach?
  3. Are there any other Python libraries or ArcPro functions that might make this process more efficient?

I’ve attached a copy of my current Python code. Any help or suggestions would be incredibly valuable, especially from those with experience handling multidimensional climate data and raster processing in ArcPro. I’m fairly new to Python, so I’d really appreciate any guidance, tips, or advice you can offer to help me improve.

Thank you all for your time and assistance!

0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor

There are tools for suitability modeling which may be of interest, if you want to use them rather than coding from scratch

Introduction to the Suitability Modeler—ArcGIS Pro | Documentation


... sort of retired...
0 Kudos