Exemplo n.º 1
0
def get_gis_unfragmented(build_list, dir, columns):
    """
	Concat 52 gis voxels into 1 building.xyz
	"""
    frames = []
    for build in build_list:
        filename = os.path.join(dir, build + '.xyz')
        message = 'Opening "{}"'.format(filename)
        with stopwatch(message):
            df = pd.read_csv(filename, sep=' ', names=columns)
            frames.append(df)

    output = os.path.join(dir, 'building.xyz')
    message = 'Writing "{}"'.format(output)
    with stopwatch(message):
        result = pd.concat(frames)
        result.to_csv(output, sep=' ', header=False, index=False)
Exemplo n.º 2
0
def get_bim_unfragmented(build_list, dir, columns):
    """
	Concat 6 bim voxels into 1 building.xyz
	"""
    ID = 1
    frames = []
    for build in build_list:
        filename = os.path.join(dir, build, 'classmodel.xyz')
        message = 'Opening "{}"'.format(filename)
        with stopwatch(message):
            df = pd.read_csv(filename, sep=' ', names=columns)
            df['buildID'] = ID
            frames.append(df)
        ID = ID + 1

    output = os.path.join(dir, 'building.xyz')
    message = 'Writing "{}"'.format(output)
    with stopwatch(message):
        result = pd.concat(frames)
        result.to_csv(output, sep=' ', header=False, index=False)
Exemplo n.º 3
0
if __name__=='__main__':
	print('********** Initializing ArgumentParser and related arguments **********')
	parser = argparse.ArgumentParser(description='Input and output data path', 
		formatter_class=argparse.ArgumentDefaultsHelpFormatter)
	parser.add_argument('--input', help='directory for input data')
	parser.add_argument('--output', help='directory for output data')
	args = parser.parse_args(sys.argv[1:])
	if os.path.exists(args.input):
		print('Input file exists')

	print('********** Opening .xyz file **********')
	xyzset = set()		# store xyz in each line from raw data file
	xMin, yMin, zMin = None, None, None
	xMax, yMax, zMax = None, None, None
	message = 'Opening "{}"'.format(args.input)	# output message
	with stopwatch(message):
		with open(args.input, mode='r', encoding='utf-8') as f:
			while(True):
				line = f.readline().strip()
				if not line:
					break				
				x, y, z, objNum = int(line.split()[0]), int(line.split()[1]), int(line.split()[2]), int(line.split()[3])
				xyzset.add(tuple(int(i) for i in line.split()))
				if xMin is None:
					xMin, yMin, zMin = x, y, z
					xMax, yMax, zMax = x, y, z
				if x < xMin:
					xMin = x
				if y < yMin:
					yMin = y
				if z < zMin:
Exemplo n.º 4
0
    parser.add_argument('--ymin', help='min y')
    parser.add_argument('--ymax', help='max y')
    parser.add_argument('--x', help='x')
    parser.add_argument('--y', help='y')
    parser.add_argument('--r', help='radius')
    args = parser.parse_args(sys.argv[1:])
    if os.path.exists(args.input):
        print('Input file exists')

    for i in range(3):
        print(
            '********** Q1: Retrieving all voxels in a given building semantic class **********'
        )
        message1 = 'Loading "{}" voxels in unfragmented file'.format(
            dir_dict[int(args.buildID)])
        with stopwatch(message1):
            df, _ = get_build_unfragmented(args.input, args.buildID)
        print('')

        message1 = 'Loading "{}" voxels in fragmented file'.format(
            dir_dict[int(args.buildID)])
        with stopwatch(message1):
            df, _ = get_build_fragmented(args.input, args.buildID)
        print('')

        print(
            '********** Q2: Retrieving all voxels refer to a given IFC class **********'
        )
        message2 = 'Loading "{}" voxels in {} unfragmented building'.format(
            int(args.objID), dir_dict[int(args.buildID)])
        with stopwatch(message2):