Esempio n. 1
0
def icosft4d(hcub,axis1=None,axis2=None,axis3=None,axis4=None,verb=False):
  """ 4D inverse cosine transform """
  # Single axes inverse transforms
  if(axis1 and not axis2 and not axis3 and not axis4):
    return icosft4d1(hcub)
  elif(axis2 and not axis1 and not axis3 and not axis4):
    return icosft4d2(hcub)
  elif(axis3 and not axis1 and not axis2 and not axis4):
    return icosft4d3(hcub)
  elif(axis4 and not axis1 and not axis2 and not axis3):
    return icosft4d2(hcub)
  # Multi-axes transforms
  elif(axis1 and axis2 and axis3 and not axis4):
    ift1  = icosft4d1(hcub)
    ift12 = icosft4d2(ift1)
    return  icosft4d3(ift12)
  elif(axis2 and axis3 and axis4 and not axis1):
    printprogress("axes:", 0, 3)
    ift2   = icosft4d2(hcub)
    printprogress("axes:", 1, 3)
    ift23  = icosft4d3(ift2)
    printprogress("axes:", 2, 3)
    ift234 = icosft4d4(ift23)
    printprogress("axes:", 3, 3)
    return  ift234
  else:
    print("This type of 4D icosft has not yet been implemented")
    return
Esempio n. 2
0
def convert2time(depth,dz,dt,oro=1.0,dro=0.01,oz=0.0,ot=0.0,verb=False):
  """
  Converts residually migrated images from depth to time

  Parameters
    depth - the input depth residual depth migrated images
    dz    - the depth sampling of the residual migration images
    dt    - output time sampling
    oro   - center residual migration value [1.0]
    dro   - rho sampling [0.01]
    oz    - input depth origin [0.0]
    ot    - output time origin [0.0]
  """
  # Get the dimensions of the input cube
  if(len(depth.shape) == 4):
    fnro = depth.shape[0]; nh = depth.shape[1]; nm = depth.shape[2]; nz = depth.shape[3]
  else:
    fnro = depth.shape[0]; nh = 1; nm = depth.shape[1]; nz = depth.shape[2]
  nt = nz
  # Compute velocity
  T = (nt-1)*dt; Z = (nz-1)*dz
  vc = 2*Z/T
  # Compute rho axis
  nro = (fnro + 1)/2; foro = oro - (nro-1)*dro;
  vel  = np.zeros(depth.shape,dtype='float32')
  if(nh > 1):
    time = np.zeros([fnro,nh,nm,nt],dtype='float32')
  else:
    time = np.zeros([fnro,nm,nt],dtype='float32')
  # Apply a stretch for each rho
  for iro in range(fnro):
    if(verb): printprogress("nrho:",iro,fnro)
    ro = foro + iro*dro
    vel[:] = vc/ro
    d2t.convert2time(nh,nm,nz,oz,dz,nt,ot,dt,vel,depth[iro],time[iro])
  if(verb): printprogress("nrho:",fnro,fnro)

  return time
Esempio n. 3
0
def off2angssk(off,
               oh,
               dh,
               dz,
               oz=0.0,
               na=281,
               amax=70,
               oa=None,
               da=None,
               nta=601,
               ota=-3,
               dta=0.01,
               nthrds=4,
               transp=False,
               oro=None,
               dro=None,
               verb=False):
    """
  Convert subsurface offset gathers to opening angle gathers

  Parameters
    off    - Subsurface offset gathers of shape [nro,nh,nz,nx] (nro is optional)
    oh     - Origin of subsurface offset axis
    dh     - Sampling of subsurface offset axis
    dz     - Sampling in depth
    oz     - Depth origin [0.0]
    na     - Number of angles [281]
    amax   - Maximum angle [70 degrees]
    oa     - Origin of angle axis (not needed if na and amax specified)
    da     - Spacing on angle axis (not needed if na and amax specified)
    nta    - Number of slant-stacks (tangents) to be computed [601]
    ota    - Origin of slant-stack (tangent) axis [-3]
    dta    - Sampling of slant-stack tangent axis [0.01]
    nthrds - Number of OpenMP threads to parallelize over image point axis [4]
    transp - Transpose the output to have shape [nro,na,nz,nx]
    oro    - Origin of rho axis (triggers another type of verbosity) [None]
    dro    - Sampling of rho axis (triggers another type of verbosity) [None]
    verb   - Verbosity flag [False]

  Returns the converted angle gathers of shape [nro,nx,na,nz]
  """
    # Handle the case if no rho axis
    if (len(off.shape) == 3):
        offr = np.expand_dims(off, axis=0)
    else:
        offr = off
    # Transpose the data to have shape [nr,nx,nh,nz]
    offt = np.ascontiguousarray(np.transpose(offr, (0, 3, 1, 2)))
    # Get shape of data
    nro = offt.shape[0]
    nx = offt.shape[1]
    nh = offt.shape[2]
    nz = offt.shape[3]
    # Compute the angle axis if amax is specified
    if (oa is None and da is None):
        # Handles only symmetric subsurface offsets for now
        amin = -amax
        avals = np.linspace(amin, amax, na)
        # Compute angle axis
        da = avals[1] - avals[0]
        oa = avals[0]

    # Allocate output and convert to angle
    ext = 4
    angs = np.zeros([nro, nx, na, nz], dtype='float32')
    # Verbosity
    rverb = False
    cverb = False
    if (verb):
        if ((oro is None or dro is None) and nro > 1):
            rverb = True
        else:
            cverb = True
    # Loop over rho
    for iro in range(nro):
        if (rverb): printprogress("nrho:", iro, nro)
        if (cverb and nro > 1):
            print("rho=%.3f (%d/%d)" % (oro + iro * dro, iro + 1, nro))
        convert2ang(nx, nh, oh, dh, nta, ota, dta, na, oa, da, nz, oz, dz, ext,
                    offt[iro], angs[iro], nthrds, cverb)
    if (rverb): printprogress("nrho:", nro, nro)

    # Transpose and return
    if (transp):
        if (nro > 1):
            return np.ascontiguousarray(np.transpose(angs, (0, 2, 3, 1)))
        else:
            return np.ascontiguousarray(np.transpose(angs[0], (1, 2, 0)))
    else:
        if (nro > 1):
            return angs
        else:
            return angs[0]
Esempio n. 4
0
  def largegraben_block(self,azim=0.0,begz=0.6,begx=0.3,begy=0.5,dx=0.3,dy=0.0,rand=True):
    """
    Puts in a large graben fault block system. For now only will give nice faults along
    0,90,180,270 azimuths

    Parameters
      azim - azimuth along which faults are oriented [0.0]
      begz - beginning position in z for fault (same for all) [0.6]
      begx - beginning position in x for system [0.5]
      begy - beginning position in y for system [0.5]
      dx   - spacing between faults in the x direction [0.3]
      dy   - spacing between faults in the y direction [0.0]
      rand - small random variations in the positioning and throw of the faults [True]
    """
    assert(dx != 0.0 or dy != 0.0),"Either dx or dy must be non-zero"
    # Throw parameters and spacing
    daz1 = 25000; dz1 = 10000; dxi = dx; dyi = dy
    daz2 = 25000; dz2 = 10000
    if(rand):
      # First fault
      daz1 += np.random.rand()*(2000) - 1000
      dz1  += np.random.rand()*(2000) - 1000
      # Second fault
      daz2 += np.random.rand()*(2000) - 1000
      dz2  += np.random.rand()*(2000) - 1000
      # Spacing
      dxi += np.random.rand()*(dxi) - dxi/2
      dyi += np.random.rand()*(dyi) - dyi/2
    if(dx != 0.0):
      # First fault
      printprogress("nlfaults",0,2)
      self.fault(begx=begx    ,begy=begy,begz=begz,daz=daz1,dz=dz1,azim=azim+180.0,theta_die=12.0,theta_shift=4.0,dist_die=1.2,perp_die=1.0)
      printprogress("nlfaults",1,2)
      # Second fault
      self.fault(begx=begx+dx,begy=begy,begz=begz,daz=daz2,dz=dz2,azim=azim      ,theta_die=12.0,theta_shift=4.0,dist_die=1.2,perp_die=1.0)
      printprogress("nlfaults",2,2)
    else:
      # First fault
      printprogress("nlfaults",0,2)
      self.fault(begx=begx,begy=begy    ,begz=begz,daz=daz1,dz=dz1,azim=azim+180.0,theta_die=12.0,theta_shift=4.0,dist_die=1.2,perp_die=1.0)
      printprogress("nlfaults",1,2)
      # Second fault
      self.fault(begx=begx,begy=begy+dy,begz=begz,daz=daz,dz=dz,azim=azim      ,theta_die=12.0,theta_shift=4.0,dist_die=1.2,perp_die=1.0)
      printprogress("nlfaults",2,2)