docs: def clip(self, min=None, max=None, replace=np.nan):
          """Clip values outside of a defined range.
  
          Parameters
          ----------
          min : number (optional)
              New channel minimum. Default is None.
          max : number (optional)
              New channel maximum. Default is None.
          replace : number or 'value' (optional)
              Replace behavior. Default is nan.
          """
          if max is None:
              max = self.max()
          if min is None:
              min = self.min()
  
          def f(dataset, s, min, max, replace):
              if hasattr(min, "shape"):
                  min = min[wt_kit.valid_index(s, min.shape)]
              if hasattr(max, "shape"):
                  max = max[wt_kit.valid_index(s, max.shape)]
              if hasattr(replace, "shape"):
                  replace = replace[wt_kit.valid_index(s, replace.shape)]
              arr = dataset[s]
              if replace == "value":
                  dataset[s] = np.clip(arr, min, max)
              else:
                  arr[arr < min] = replace
                  arr[arr > max] = replace
                  dataset[s] = arr
  
          self.chunkwise(f, min=min, max=max, replace=replace)