def apply_function(array_func, inpath, outpath): from VolumeData import fileformats try: grids = fileformats.open_file(inpath) except fileformats.Unknown_File_Type, e: sys.stderr.write(str(e)) sys.exit(1)
def count_neighbors(inpath, outpath): from VolumeData import fileformats try: glist = fileformats.open_file(inpath) except fileformats.Unknown_File_Type, e: sys.stderr.write(str(e)) sys.exit(1)
def gaussian_convolve(inpath, linewidth, outpath): from VolumeData import fileformats try: glist = fileformats.open_file(inpath) except fileformats.Unknown_File_Type, e: sys.stderr.write(str(e)) sys.exit(1)
def write_netcdf(inpath, outpath, xyz_origin, xyz_step): from VolumeData import fileformats try: glist = fileformats.open_file(inpath) except fileformats.Unknown_File_Type, e: sys.stderr.write(str(e)) sys.exit(1)
def gaussian_convolve(inpath, linewidth, outpath): from VolumeData import fileformats try: glist = fileformats.open_file(inpath) except fileformats.Unknown_File_Type, e: sys.stderr.write(str(e)) sys.exit(1)
def write_netcdf(inpath, outpath, xyz_origin, xyz_step): from VolumeData import fileformats try: glist = fileformats.open_file(inpath) except fileformats.Unknown_File_Type, e: sys.stderr.write(str(e)) sys.exit(1)
def downsize(mode, cell_size, inpath, outpath): from VolumeData import fileformats try: glist = fileformats.open_file(inpath) except fileformats.Unknown_File_Type, e: sys.stderr.write(str(e)) sys.exit(1)
def downsize(mode, cell_size, inpath, outpath): from VolumeData import fileformats try: glist = fileformats.open_file(inpath) except fileformats.Unknown_File_Type, e: sys.stderr.write(str(e)) sys.exit(1)
def apply_function(array_func, inpath, outpath): from VolumeData import fileformats try: grids = fileformats.open_file(inpath) except fileformats.Unknown_File_Type, e: sys.stderr.write(str(e)) sys.exit(1)
def show_header(path): try: glist = fileformats.open_file(path) except fileformats.Unknown_File_Type: return False for grid_data in glist: sys.stdout.write('Header for %s\n' % grid_data.path) sys.stdout.write(' Data value type: %s\n' % grid_data_type(grid_data)) sys.stdout.write(' %-12s' % 'size:' + '%12d %12d %12d\n' % tuple(grid_data.size)) sys.stdout.write(' %-12s' % 'xyz origin:' + '%12.8g %12.8g %12.8g\n' % tuple(grid_data.origin)) sys.stdout.write(' %-12s' % 'xyz step:' + '%12.8g %12.8g %12.8g\n' % tuple(grid_data.step)) return True
def show_header(path): try: glist = fileformats.open_file(path) except fileformats.Unknown_File_Type: return False for grid_data in glist: sys.stdout.write('Header for %s\n' % grid_data.path) sys.stdout.write(' Data value type: %s\n' % grid_data_type(grid_data)) sys.stdout.write(' %-12s' % 'size:' + '%12d %12d %12d\n' % tuple(grid_data.size)) sys.stdout.write(' %-12s' % 'xyz origin:' + '%12.8g %12.8g %12.8g\n' % tuple(grid_data.origin)) sys.stdout.write(' %-12s' % 'xyz step:' + '%12.8g %12.8g %12.8g\n' % tuple(grid_data.step)) return True
def data_item_from_file(outfile): """data_item_from_file(outfile) Input: outfile file to be read Output: data_item Data_Item for data in outfile Create and return a Data_Item from outfile. If no input file, returns None. """ if outfile == None: return None from VolumeData import fileformats data = fileformats.open_file(outfile)[0] data_item = data_item_from_data(data) return data_item
def combine_grids(mode, inpath1, inpath2, outpath): from VolumeData import fileformats grids = [] failed_paths = [] for path in (inpath1, inpath2): try: glist = fileformats.open_file(path) grids.append(glist) except fileformats.Unknown_File_Type: failed_paths.append(path) if failed_paths: warning = fileformats.suffix_warning(failed_paths) sys.stderr.write(warning) sys.exit(1) combined = map(lambda g1, g2: Combined_Grid(mode, g1, g2), grids[0], grids[1]) from VolumeData.netcdf import write_grid_as_netcdf write_grid_as_netcdf(combined, outpath)
# ----------------------------------------------------------------------------- # if len(sys.argv) != 9: syntax() inpath = sys.argv[1] try: imin = int(sys.argv[2]) imax = int(sys.argv[3]) jmin = int(sys.argv[4]) jmax = int(sys.argv[5]) kmin = int(sys.argv[6]) kmax = int(sys.argv[7]) except: syntax() outpath = sys.argv[8] from VolumeData import fileformats try: glist = fileformats.open_file(inpath) except fileformats.Unknown_File_Type, e: sys.stderr.write(str(e)) sys.exit(1) from VolumeData import Grid_Subregion r = [Grid_Subregion(g, (imin, jmin, kmin), (imax, jmax, kmax)) for g in glist] from VolumeData.netcdf import write_grid_as_netcdf write_grid_as_netcdf(r, outpath)