Select to view content in your preferred language

How to multithread a single function in arcpy?

447
1
02-16-2022 12:19 AM
STanveerPSL
New Contributor

I have a huge DEM raster (more than 6 GB in size). I need to Process this raster through Hydrology toolset in ArcGIS (fill, flow direction, flow accumulation..etc).  When trying to implement any of these analysis, normally it would take long hours of processing. I'm trying to make use of multithreading capabilities to shorten the analysis time.

After searching through the internet, I found practitioners usually split the raster into smaller chunks and process them in parallel manner which is a good idea. However, in my Case that is not possible because hydrology analyses depends on pixel neighborhood and splitting raster would affect the analysis.

Given the function below:

import arcpy
from arcpy import env
from arcpy.sa import *


def fill_raster(path_to_input_raster,path_to_output_raster):
    outFill = Fill(path_to_input_raster)
    outFill.save(path_to_output_raster)

What is Required?

How can I multithread fill_raster  function without splitting input raster into chunks?

0 Kudos
1 Reply
DanPatterson
MVP Esteemed Contributor

can you exploit in_memory workspace rather than writing to disk?

Considerations when using the in_memory workspace—ArcGIS Pro | Documentation

And to keep watch on, only a few spatial analyst functions support gpu for now

GPU processing with Spatial Analyst—ArcGIS Pro | Documentation


... sort of retired...
0 Kudos