'--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)
infile = args[0] if (not os.path.isfile(infile)): parser.error('Input file "%s" does not exist!'%(infile,)) if (not os.path.isfile(hcfile)): parser.error('Hit count file "%s" does not exist!'%(hcfile,)) 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,))
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)
infile = args[0] if (not os.path.isfile(infile)): parser.error('Input file "%s" does not exist!' % (infile, )) if (not os.path.isfile(hcfile)): parser.error('Hit count file "%s" does not exist!' % (hcfile, )) 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)