code: def apply_atms_limb_correction(
      datasets, channel_idx, dmean, coeffs, amean, nchx, nchanx
  ):
      """Calculate the correction for each channel."""
      ds = datasets[channel_idx]
  
      fov_line_correct = []
      for fov_idx in range(ds.shape[1]):
          coeff_sum = np.zeros(ds.shape[0], dtype=ds.dtype)
          for k in range(nchx[channel_idx]):
              chn_repeat = nchanx[channel_idx, k]
              coef = coeffs[channel_idx, fov_idx, chn_repeat] * (
                  datasets[chn_repeat, :, fov_idx]
                  - amean[chn_repeat, fov_idx, channel_idx]
              )
              coeff_sum = np.add(coef, coeff_sum)
          fov_line_correct.append(np.add(coeff_sum, dmean[channel_idx]))
      return np.stack(fov_line_correct, axis=1)
  
imports: import datetime
  import importlib
  import logging
  import os
  from collections import Counter
  import dask.array
  import numpy
  import xarray
  from satpy.aux_download import retrieve
  from satpy.readers.file_handlers import BaseFileHandler
  from satpy.utils import get_legacy_chunk_size
label_desc: Use image node_id 4 for calling a global function with example usage: apply_atms_limb_correction(datasets, channel_idx, dmean, coeffs, amean, nchx, nchanx) and returns: np