Exemplo n.º 1
0
                  '--ref',
                  action='store',
                  dest='refmodel',
                  help='reference model to subtract')

parser.set_defaults(dims=None, refmodel=None)

(options, args) = parser.parse_args()

if (len(args) < 2):
    parser.print_help()
    exit(0)

infile = args[0]
outfile = args[1]

if (options.dims is None):
    dims = getParams()['dims']
else:
    dims = [int(item) for item in options.dims.strip().split(',')]

velmodel = readfast(infile, dims).copy(order='F')

if (options.refmodel is not None):
    refmodel = readfast(options.refmodel, dims).copy(order='F')
else:
    refmodel = np.zeros_like(velmodel)

with open(outfile, 'w') as fp:
    fp.write(velmodel - refmodel)
Exemplo n.º 2
0
olddims = (151, 65, 61)
newdims = (301, 121)
oldori = (-1., -1.1, -2000.)
newori = (-1., -2000.)
sl = 20
dxold = 100
dxnew = 50
forstr = '%f\t%f\t%f\t%f\n'

oxgrid, ozgrid = np.mgrid[oldori[0]:oldori[0] + olddims[0] * dxold:dxold,
                          oldori[2]:oldori[2] + olddims[2] * dxold:dxold]

nxgrid, nzgrid = np.mgrid[newori[0]:newori[0] + newdims[0] * dxnew:dxnew,
                          newori[1]:newori[1] + newdims[1] * dxnew:dxnew]

fmodel = readfast(infile, olddims)
oldsl = fmodel[:, sl, :]

gridinput = np.column_stack((oxgrid.ravel(), ozgrid.ravel()))
gridoutput = np.column_stack((nxgrid.ravel(), nzgrid.ravel()))

newsl = griddata(gridinput, oldsl.ravel(), gridoutput, method='linear')
newsl.shape = newdims

saveoutput = np.column_stack(
    (nxgrid.T.ravel(), nzgrid.T.ravel(), newsl.T.ravel()))

with open(outfile, 'w') as fp:
    for i in range(saveoutput.shape[0]):
        fp.write(forstr %
                 (saveoutput[i, 0], y, -saveoutput[i, 1], saveoutput[i, 2]))
Exemplo n.º 3
0
VERSION = '%prog v1.0\n'
DESCRIPTION = '''Convert FAST model to Paraview RAW file.'''
USAGE = '%prog [options] infile outfile'

parser = OptionParser(	usage		= USAGE,
			version		= VERSION,
			description	= DESCRIPTION)

parser.add_option('-d', '--dims', action='store', dest='dims',
		help='dimensions of FAST model')

parser.set_defaults(	dims = None)

(options, args) = parser.parse_args()

if (len(args) < 2):
  parser.print_help()
  exit(0)

infile = args[0]
outfile = args[1]

if (options.dims is None):
  dims = getParams()['dims'] 
else:
  dims = [int(item) for item in options.dims.strip().split(',')]

velmodel = readfast(infile, dims).copy(order='F')
with open(outfile, 'w') as fp:
  fp.write(velmodel)
Exemplo n.º 4
0
if (len(args) < 2):
  outfile = infile + addfilename
else:
  outfile = args[1]

try:
  params = getParams()
except IOError:
  parser.error('FAST header file "for.header" does not exist; are you executing in the FAST working directory?')

dims = params['dims']
pseudodims = (dims[0],1,dims[2])

try:
  model3d = readfast(infile, dims)
except:
  parser.error('Problem reading "%s"!'%(infile,))

try:
  hitcount = readfast(hcfile, dims)
except:
  parser.error('Problem reading "%s"!'%(hcfile,))

# ------------------------------------------------------------------------

# Calculate average of the 3D model along the y-axis
model2davg = model3d.mean(axis=1)

# Calculate 2D hitcount by summing along the y-axis
hitcount2dsum = hitcount.sum(axis=1)
Exemplo n.º 5
0
    outfile = infile + addfilename
else:
    outfile = args[1]

try:
    params = getParams()
except IOError:
    parser.error(
        'FAST header file "for.header" does not exist; are you executing in the FAST working directory?'
    )

dims = params['dims']
pseudodims = (dims[0], 1, dims[2])

try:
    model3d = readfast(infile, dims)
except:
    parser.error('Problem reading "%s"!' % (infile, ))

try:
    hitcount = readfast(hcfile, dims)
except:
    parser.error('Problem reading "%s"!' % (hcfile, ))

# ------------------------------------------------------------------------

# Calculate average of the 3D model along the y-axis
model2davg = model3d.mean(axis=1)

# Calculate 2D hitcount by summing along the y-axis
hitcount2dsum = hitcount.sum(axis=1)
Exemplo n.º 6
0
DESCRIPTION = '''Convert FAST model to Paraview RAW file.'''
USAGE = '%prog [options] infile outfile'

parser = OptionParser(usage=USAGE, version=VERSION, description=DESCRIPTION)

parser.add_option('-d',
                  '--dims',
                  action='store',
                  dest='dims',
                  help='dimensions of FAST model')

parser.set_defaults(dims=None)

(options, args) = parser.parse_args()

if (len(args) < 2):
    parser.print_help()
    exit(0)

infile = args[0]
outfile = args[1]

if (options.dims is None):
    dims = getParams()['dims']
else:
    dims = [int(item) for item in options.dims.strip().split(',')]

velmodel = readfast(infile, dims).copy(order='F')
with open(outfile, 'w') as fp:
    fp.write(velmodel)
Exemplo n.º 7
0
y = 0.
olddims = (151,65,61)
newdims = (301,121)
oldori = (-1.,-1.1,-2000.)
newori = (-1.,-2000.)
sl = 20
dxold = 100
dxnew = 50
forstr = '%f\t%f\t%f\t%f\n'

oxgrid, ozgrid = np.mgrid[oldori[0]:oldori[0]+olddims[0]*dxold:dxold,
                          oldori[2]:oldori[2]+olddims[2]*dxold:dxold]

nxgrid, nzgrid = np.mgrid[newori[0]:newori[0]+newdims[0]*dxnew:dxnew,
                          newori[1]:newori[1]+newdims[1]*dxnew:dxnew]

fmodel = readfast(infile, olddims)
oldsl = fmodel[:,sl,:]

gridinput = np.column_stack((oxgrid.ravel(), ozgrid.ravel()))
gridoutput = np.column_stack((nxgrid.ravel(), nzgrid.ravel()))

newsl = griddata(gridinput, oldsl.ravel(), gridoutput, method='linear')
newsl.shape = newdims

saveoutput = np.column_stack((nxgrid.T.ravel(), nzgrid.T.ravel(),newsl.T.ravel()))

with open(outfile, 'w') as fp:
  for i in range(saveoutput.shape[0]):
    fp.write(forstr%(saveoutput[i,0], y, -saveoutput[i,1], saveoutput[i,2]))
Exemplo n.º 8
0
parser.add_option('-r', '--ref', action='store', dest='refmodel',
		help='reference model to subtract')

parser.set_defaults(	dims = None,
			refmodel = None)

(options, args) = parser.parse_args()

if (len(args) < 2):
  parser.print_help()
  exit(0)

infile = args[0]
outfile = args[1]

if (options.dims is None):
  dims = getParams()['dims'] 
else:
  dims = [int(item) for item in options.dims.strip().split(',')]

velmodel = readfast(infile, dims).copy(order='F')

if (options.refmodel is not None):
  refmodel = readfast(options.refmodel, dims).copy(order='F')
else:
  refmodel = np.zeros_like(velmodel)

with open(outfile, 'w') as fp:
  fp.write(velmodel - refmodel)