code: def _interpolate_local_equalized_tiles(
      data,
      out,
      mask_to_equalize,
      valid_data_mask,
      do_log_scale,
      log_offset,
      tile_weights,
      all_bin_information,
      all_cumulative_dist_functions,
      row_idx,
      col_idx,
      tile_size,
  ):
      # calculate the range for this tile (min is inclusive, max is exclusive)
      num_row_tile = row_idx
      num_col_tile = col_idx
      min_row = num_row_tile * tile_size
      max_row = min_row + tile_size
      min_col = num_col_tile * tile_size
      max_col = min_col + tile_size
  
      # for convenience, pull some of these tile sized chunks out
      temp_all_data = data[min_row:max_row, min_col:max_col].copy()
      temp_mask_to_equalize = mask_to_equalize[
          min_row:max_row, min_col:max_col
      ]
      temp_all_valid_data_mask = valid_data_mask[
          min_row:max_row, min_col:max_col
      ]
  
      # if we have any data in this tile, calculate our weighted sum
      if not temp_mask_to_equalize.any():
          return
  
      if do_log_scale:
          temp_all_data[temp_all_valid_data_mask] = np.log(
              temp_all_data[temp_all_valid_data_mask] + log_offset
          )
      temp_data_to_equalize = temp_all_data[temp_mask_to_equalize]
      temp_all_valid_data = temp_all_data[temp_all_valid_data_mask]
  
      # a place to hold our weighted sum that represents the interpolated contributions
      # of the histogram equalizations from the surrounding tiles
      temp_sum = np.zeros_like(temp_data_to_equalize)
  
      # how much weight were we unable to use because those tiles
      # fell off the edge of the image?
      unused_weight = np.zeros(
          temp_data_to_equalize.shape, dtype=tile_weights.dtype
      )
  
      # loop through all the surrounding tiles and process their
      # contributions to this tile
      for weight_row in range(3):
          for weight_col in range(3):
              tmp_tile_weights = tile_weights[weight_row, weight_col][
                  np.where(temp_mask_to_equalize)
              ]
              cumul_func, bin_info = _get_cumul_bin_info_for_tile(
                  num_row_tile,
                  weight_row,
                  num_col_tile,
                  weight_col,
                  all_cumulative_dist_functions,
                  all_bin_information,
              )
              if bin_info is None or cumul_func is None:
                  unused_weight -= tmp_tile_weights
                  continue
  
              # equalize our current tile using the histogram
              # equalization from the tile we're processing
              temp_equalized_data = np.interp(
                  temp_all_valid_data, bin_info[:-1], cumul_func
              )
              temp_equalized_data = temp_equalized_data[
                  np.where(
                      temp_mask_to_equalize[temp_all_valid_data_mask]
                  )
              ]
  
              # add the contribution for the tile we're
              # processing to our weighted sum
              temp_sum += temp_equalized_data * tmp_tile_weights
  
      # if we have unused weights, scale our values to correct for that
      if unused_weight.any():
          # TODO: if the mask masks everything out this will be a zero!
          temp_sum /= unused_weight + 1
  
      out[min_row:max_row, min_col:max_col][
          temp_mask_to_equalize
      ] = temp_sum
  
imports: from __future__ import annotations
  import logging
  import math
  from datetime import datetime
  import dask
  import dask.array
  import numpy
  import xarray
  from satpy.composites import CompositeBase, GenericCompositor
  from satpy.dataset import combine_metadata
label_desc: Use image node_id 6 for calling a global function with example usage: _interpolate_local_equalized_tiles(data, out, mask_to_equalize, valid_data_mask, do_log_scale, log_offset, tile_weights, all_bin_information, all_cumulative_dist_functions, row_idx, col_idx, tile_size) without return types