code: def main(infile, outfile, num_workers=4):
      """Process infile block-by-block and write to a new file
  
      The output is the same as the input, but with band order
      reversed.
      """
  
      with rasterio.open(infile) as src:
          # Create a destination dataset based on source params. The
          # destination will be tiled, and we'll process the tiles
          # concurrently.
          profile = src.profile
          profile.update(blockxsize=128, blockysize=128, tiled=True)
  
          with rasterio.open(outfile, "w", **profile) as dst:
              windows = [window for ij, window in dst.block_windows()]
  
              # We cannot write to the same file from multiple threads
              # without causing race conditions. To safely read/write
              # from multiple threads, we use a lock to protect the
              # DatasetReader/Writer
              read_lock = threading.Lock()
              write_lock = threading.Lock()
  
              def process(window):
                  with read_lock:
                      src_array = src.read(window=window)
  
                  # The computation can be performed concurrently
                  result = compute(src_array)
  
                  with write_lock:
                      dst.write(result, window=window)
  
              # We map the process() function over the list of
              # windows.
              with concurrent.futures.ThreadPoolExecutor(
                  max_workers=num_workers
              ) as executor:
                  executor.map(process, windows)
  
imports: import concurrent.futures
  import multiprocessing
  import threading
  import rasterio
  from rasterio._example import compute
label_desc: Use image node_id 1 for calling a global function with example usage: main(infile, outfile, num_workers) without return types