code: def flds_sort(d,s):
      '''
      Sort based on position. Sort with s as a tuple of the sort
      indices and shape from first sort.
      Parameters:
      -----------
      d   -- the flds/sclr data
      s   -- (si, shape) sorting and shaping data from firstsort.
      '''
      labels = [ key for key in d.keys()
                 if key not in ['t', 'xs', 'ys', 'zs', 'fd', 'sd'] ];
      si,shape = s;
      for l in labels:
          d[l] = d[l][si].reshape(shape);
          d[l] = np.squeeze(d[l]);
      return d;