code: def expand_single_values(var, scans):
          
          if scans.size == 1:
              return var
          else:
              expanded = np.repeat(var, scans)
              expanded.attrs = var.attrs
              expanded.rename({expanded.dims[0]: 'y'})
              return expanded
docs: Expand single valued variable to full scan lengths.