code: def interp1d(x,Z,xout,spline=False,kind='linear',fill_value=np.NaN,**kwargs):
      
  
      linear = not spline
      
      
      nx=len(x)
      
      if linear :
          
          try :
              f = scipy.interpolate.interp1d(x, Z, kind=kind,bounds_error=False,fill_value=fill_value,**kwargs)
              Zout = f(xout)
          except RuntimeError : Zout = np.repeat(np.NaN,nx)
  
      else :
          tck = scipy.interpolate.splrep(x,Z,s=0)
          try : Zout = scipy.interpolate.splev(xout,tck,der=0,**kwargs)
          except RuntimeError : Zout = np.repeat(np.NaN,nx)
  
      return Zout
docs: INTERP1D : Interpolate values from a 1D vector at given positions
      
      @param x: 1st dimension vector of size NX
      
      @author: Renaud DUSSURGET, LER/PAC, Ifremer La Seyne