code: def extrapolate(a):
      
      nans = np.where(~np.isnan(a))[0]
      first, last = nans[0], nans[-1]
      a[:first] = a[first]
      a[last + 1:] = a[last]
      return a
docs: From ``bruges``
  
      Extrapolate up and down an array from the first and last non-NaN samples.
  
      E.g. Continue the first and last non-NaN values of a log up and down.