code: def scale_swath_data(self, data, scaling_factors):
          
          num_grans = len(scaling_factors) // 2
          gran_size = data.shape[0] // num_grans
          factors = scaling_factors.where(scaling_factors > -999)
          factors = factors.data.reshape((-1, 2))
          factors = xr.DataArray(da.repeat(factors, gran_size, axis=0),
                                 dims=(data.dims[0], 'factors'))
          data = data * factors[:, 0] + factors[:, 1]
          return data
docs: Scale swath data using scaling factors and offsets.
  
          Multi-granule (a.k.a. aggregated) files will have more than the usual two values.