Esempio n. 1
0
    def write_las_file(self):
        """ Create and write a new lidar file with the desirable points
        """
        if self.surfaces:
            self.out_full_path = os.path.join(
                self.out_dir,
                ('Surfaces_' + self.templates_dict['las'].format(self.name)))

        elif self.terrain:
            self.out_full_path = os.path.join(
                self.out_dir,
                ('Terrain_' + self.templates_dict['las'].format(self.name)))

        out_file = File(self.out_full_path,
                        mode='w',
                        header=self.in_file.header)
        if self.terrain:
            class_2_points, class_2_bool = self.get_points_by_class(
                self.class_flag)
            out_file.points = self.in_file.points[class_2_bool]

        elif self.surfaces:
            out_file.points = self.in_file.points[self.in_file.return_num == 1]

        out_file.close()
Esempio n. 2
0
def do_hm(target_tile_path):
    # load tile for matching
    target_tile_name = target_tile_path.stem + target_tile_path.suffix
    try:
        target_tile = File(target_tile_path, mode='r') # this can take some time
     
        # use global to get the info, apologize to programming teachers
        global ref_tile
        global ky_lidar_fix_path
    
        # match histograms
        new_dist = hist_match(target_tile.intensity, ref_tile.intensity)
	
        # apply transformation
        new_tile_path = ky_lidar_fix_path / target_tile_name
        new_tile = File(new_tile_path, mode='w', header=target_tile.header)
        new_tile.points = target_tile.points
        new_tile.intensity = new_dist
        new_tile.close()
        return (True, new_tile_path)
    
    except:
        # if we can't load the file, that's a big problem, but it seems to happen
        # sometimes. 
        return (False, target_tile_path)
Esempio n. 3
0
 def write(self):
     output = self.configs["paths"]["output"]
     points = np.array(self.points, dtype=self.dtype)
     #print self.header
     outfile = File(output + self.filename, mode="w", header=self.header)
     outfile.points = points
     outfile.close()
Esempio n. 4
0
    def write_las_file(self):
        """ Create and write a new lidar file with the desirable points
        """

        self.dirs.set_output_dir()
        full_path = self.dirs.out_paths['las_terrain']
        self.dirs.create_dir(self.dirs.out_dirs['las'])

        out_file = File(full_path, mode='w', header=self.in_file.header)
        class_2_points, class_2_bool = self.get_points_by_class(
            self.class_flag)
        out_file.points = self.in_file.points[class_2_bool]
        out_file.close()
Esempio n. 5
0
def z_adjustData(tile, source_data,target_data,filetype,outputfolder):

    tilename = tile.name

    source_tile = os.path.join(source_data, '{0}.{1}'.format(tilename,filetype)).replace('\\','/')
    target_tile = os.path.join(target_data, '{0}.{1}'.format(tilename,filetype)).replace('\\','/')
    temp_outputfile = os.path.join(outputfolder, '{0}.{1}'.format(tilename,'las')).replace('\\','/')
    outputfile = os.path.join(outputfolder, '{0}.{1}'.format(tilename,filetype)).replace('\\','/')
    
    #read the obfuscated tile
    sourcefile = File(source_tile, mode='r')
    targetfile = File(target_tile, mode='r')


    #get z values from source
    z_values=sourcefile.get_z_scaled()
    outfile = File(temp_outputfile, mode="w", header=targetfile.header)
    outfile.points=targetfile.points

    
    #Replace the z values from source file
    outfile.set_z_scaled(z_values)

    outfile.close()
    sourcefile.close()
    targetfile.close()


    #lascopy all x,y,z,classification based on the corrected gps time
    subprocessargs=['C:/LAStools/bin/las2las.exe', '-i', temp_outputfile, '-olaz', '-o', outputfile]
    subprocessargs=list(map(str,subprocessargs))    
    p = subprocess.run(subprocessargs,stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False, check=True, universal_newlines=True)

    if os.path.isfile(outputfile):
        #read the obfuscated tile
        log = f'Z replaced from {source_tile} -> {target_tile}'
        os.remove(temp_outputfile)
        print(log)

   
        return(True,outputfile,log)


    else:

        log = f'Failed replacing Z from {source_tile} -> {target_tile}'
        #os.remove(temp_outputfile)
        print(log)

        return(False,None,log)
Esempio n. 6
0
 def get_first_returns_array(self):
 
     # Guardo el archivo para poder leerlo
     
     if self.partials_create:
         full_path = self.dirs.out_paths['las_surfaces']
         self.dirs.create_dir(self.dirs.out_dirs['las'])
     
     else:
         full_path = self.dirs.temp_full_paths['las_surfaces']
         self.dirs.create_dir(self.dirs.temp_dirs['temp_dir'])            
     
     out_file = File(full_path, mode='w', header=self.in_file.header)
     out_file.points = self.in_file.points[
             self.in_file.return_num == 1]
     out_file.close()
     
     #leo el archivo
     in_file = File(full_path, mode='r')
     scale = in_file.header.scale
     offset = in_file.header.offset
                     
     x = in_file.X
     y = in_file.Y
     z = in_file.Z
     
     x_dimension = x * scale[0] + offset[0]
     y_dimension = y * scale[1] + offset[1]
     z_dimension = z * scale[-1] + offset[-1]
     
     size = x_dimension.shape[0]
     
     x_array = x_dimension.reshape(size, 1)
     y_array = y_dimension.reshape(size, 1)
     z_array = z_dimension
     
     # Cerrar archivo para poder eliminarlo
     in_file.close()
     if not self.partials_create:
         self.dirs.remove_temp_file(full_path)
         self.dirs.remove_temp_dir(self.dirs.temp_dirs['temp_dir'])
         
     xy_array = np.concatenate((x_array, y_array), axis=1)
     self.surfaces_arrays_list = [xy_array, z_array]
Esempio n. 7
0
    def get_points_arrays(self):
        """ Creates arrays for a given class (default=2) with the coordinates
            of the points classificated by that class flag
        """
        #        class_flags = 2, 3, 4, 5 para suelo, vegetación baja, media y alta respectivamente
        if self.terrain:
            class_2_points, class_2_bool = self.get_points_by_class(
                self.class_flag)
            size = class_2_points.shape[0]
            x_array = self.x_dimension[class_2_bool].reshape(size, 1)
            y_array = self.y_dimension[class_2_bool].reshape(size, 1)
            z_array = self.z_dimension[class_2_bool]

        elif self.surfaces:
            # Guardo el archivo para poder leerlo

            self.out_dir = os.path.join(self.out_path, 'intermediate_results',
                                        'las')

            filename = ('Surfaces_' +
                        self.templates_dict['las'].format(self.name))

            full_path = os.path.join(self.out_dir, filename)

            self.files_utils.create_dir(self.out_dir)

            out_file = File(full_path, mode='w', header=self.in_file.header)
            out_file.points = self.in_file.points[self.in_file.return_num == 1]
            out_file.close()

            #leo el archivo
            in_file = File(full_path, mode='r')
            scale = in_file.header.scale
            offset = in_file.header.offset

            x = in_file.X
            y = in_file.Y
            z = in_file.Z

            x_dimension = x * scale[0] + offset[0]
            y_dimension = y * scale[1] + offset[1]
            z_dimension = z * scale[-1] + offset[-1]

            size = x_dimension.shape[0]

            x_array = x_dimension.reshape(size, 1)
            y_array = y_dimension.reshape(size, 1)
            z_array = z_dimension

            # Cerrar archivo para poder eliminarlo
            in_file.close()

            if not self.partials_create:
                self.files_utils.remove_temp_file(full_path)
                try:
                    self.files_utils.remove_temp_dir(self.out_dir)
                except OSError:
                    pass

        xy_array = np.concatenate((x_array, y_array), axis=1)
        self.lidar_arrays_list = [xy_array, z_array]
def obfuscate_data(tile, inputfolder, originx, originy, rotation, xoffset,
                   yoffset, zoffset, toffset, outputfolder, filetype,
                   outtilename, buffer):
    """Rotate a point around a given point.
    x and y are numpy lists
    """
    tilename = tile.name
    input_file = os.path.join(outputfolder,
                              '{0}.{1}'.format(tilename,
                                               filetype)).replace('\\', '/')
    buffered_file = os.path.join(outputfolder,
                                 '{0}_buff.laz'.format(tilename)).replace(
                                     '\\', '/')
    temp_outputfile = os.path.join(outputfolder,
                                   '{0}.{1}'.format(outtilename,
                                                    'las')).replace('\\', '/')
    outputfile = os.path.join(outputfolder,
                              '{0}.{1}'.format(outtilename,
                                               filetype)).replace('\\', '/')
    log = ''
    try:
        neighbours = tile.getneighbours(buffer)
        neighbourfiles = []
        for fi in neighbours:
            nfi = os.path.join(inputfolder,
                               '{0}.{1}'.format(fi,
                                                filetype)).replace('\\', '/')
            if os.path.isfile(nfi):
                neighbourfiles.append(nfi)

        keep = '-keep_xy {0} {1} {2} {3}'.format(str(tile.xmin - buffer),
                                                 str(tile.ymin - buffer),
                                                 str(tile.xmax + buffer),
                                                 str(tile.ymax + buffer))
        keep = keep.split()

        subprocessargs = [
            'C:/LAStools/bin/las2las.exe', '-i'
        ] + neighbourfiles + ['-olaz', '-o', buffered_file, '-merged'] + keep
        subprocessargs = list(map(str, subprocessargs))
        p = subprocess.run(subprocessargs,
                           stdout=subprocess.PIPE,
                           stderr=subprocess.STDOUT,
                           shell=False,
                           check=True,
                           universal_newlines=True)

        infile = File(buffered_file, mode='r')

        xvalues = infile.get_x_scaled()
        yvalues = infile.get_y_scaled()
        zvalues = infile.get_z_scaled()
        tvalues = infile.get_gps_time()

        print(
            f"\ntilename={tilename:s} xoffset={xoffset:0.4f} yoffset={yoffset:0.4f} zoffset={zoffset:0.4f} rotation={rotation:0.4f}  toffset={toffset:0.4f}"
        )

        #rotate points
        xvalues, yvalues = rotate_about_origin(xvalues, yvalues,
                                               math.radians(rotation), originx,
                                               originy)
        #print(tilename,xvalues[0],yvalues[0],zvalues[0])
        #offset points
        newxvals = xvalues + xoffset
        newyvals = yvalues + yoffset
        newzvals = zvalues + zoffset
        newtvals = tvalues + toffset

        #print(tilename,newxvals[0],newyvals[0],newzvals[0])
        outfile = File(temp_outputfile, mode="w", header=infile.header)
        outfile.points = infile.points
        outfile.set_x_scaled(newxvals)
        outfile.set_y_scaled(newyvals)
        outfile.set_z_scaled(newzvals)
        outfile.set_gps_time(newtvals)

        outfile.close()
        infile.close()

        subprocessargs = [
            'C:/LAStools/bin/las2las.exe', '-i', temp_outputfile, '-olaz',
            '-o', outputfile
        ]
        subprocessargs = list(map(str, subprocessargs))
        p = subprocess.run(subprocessargs,
                           stdout=subprocess.PIPE,
                           stderr=subprocess.STDOUT,
                           shell=False,
                           check=True,
                           universal_newlines=True)

        if os.path.isfile(outputfile):
            log = f'Succesfully Obfuscated {tilename}'
            os.remove(temp_outputfile)
            os.remove(buffered_file)

            return (True, outputfile, log)

    except:

        log = f"{tilename} : Obfuscation Failed"
        print(log)
        #outfile.close()
        #infile.close()
        return (False, tilename, log)
Esempio n. 9
0
        del res['angle']
        del res['raw_classification']
        del res['raw_classificationT']

        res.columns = ['raw_classification']

        # Writing the new las

        for row in res.itertuples():
            class1_points[row.Index]['point'][
                'raw_classification'] = row.raw_classification

        point_copy_ori[(inFile1.raw_classification == 1)] = class1_points
        #point_copy_ori[(inFile1.raw_classification == 1) | (inFile1.raw_classification == 2) | (inFile1.raw_classification == 5) | (inFile1.raw_classification == 6) | (inFile1.raw_classification == 7)]= class1_points
        outFile1 = File(dirout + '\\' + filename,
                        mode="w",
                        header=inFile1.header)
        outFile1.points = point_copy_ori
        outFile1.close()

        inFile1.close()
        inFile2.close()
        update_progress(ci / int(D1))

if eR > 0:
    print('Process finnihed :' + str(eR) +
          ' errors read Comp-result.txt in the source folder')
else:
    print('Process finnihed with no errors')

exit(0)
Esempio n. 10
0
        mini = i

# Keeping all points in 0.5 unit distance radius
pos = dataset[index_pos[0][mini]]
distances = np.sum((dataset - pos)**2, axis=1)
keep_points = distances < 0.5
points_kept = inFile.points[keep_points]
print("We're keeping %i points out of %i total in the new AOI point cloud" %
      (len(points_kept), len(inFile)))

# Creating a webpage and naming it according to the user_name
trimmedLAS = user_name + '.las'
htmlDOC = user_name + '.html'

outFile = File(trimmedLAS, mode="w", header=inFile.header)
outFile.points = points_kept
outFile.close()

# Creating a text file log of all variables and observations
save_path = 'C:/CrowdData/'
name_of_file = user_name
completeName = save_path + name_of_file + ".txt"
file1 = open(completeName, "w")
toFile = ("\bUser Name:\b \n" + str(user_name) + "\n\bUser Occupation:\b \n" +
          str(user_occupation) + "\n\bPoint1 Data:\b0 \n" + str(rc) +
          "\n\bPoint2 Data:\b \n" + str(rc2) + "\n\b3D Point1:\b \n" +
          str(results[0]) + "\n\b3D Point2:\b \n" + str(results[1]) +
          "\n\b3D distance in point cloud:\b \n" + str(dist_3d) +
          "\n\bActual distance:\b \n" + str(act_dist) +
          "\n\bScaling Factor:\b \n" + str(scl_fct))
file1.write(toFile)
Esempio n. 11
0
from laspy.file import File
import copy
inFile = File("autzen-dd.las", mode="r")
header = inFile.header
points = copy.deepcopy(inFile.points)

import numpy as np

X = inFile.X
Y = inFile.Y

minx = np.min(X)
miny = np.min(Y)

maxx = np.max(X)
maxy = np.max(Y)

print minx, miny, maxx, maxy
x = ((maxx - minx) / 2.0 + minx) - 1.0 / header.scale[0]
y = (maxy - miny) / 2.0 + miny

print x, y

points[0][0][0] = x

print points[0][0][0]
outfile = File("spurious.las", mode='w', header=header)
outfile.points = points
import pdb
pdb.set_trace()
Esempio n. 12
0
from laspy.file import File
import copy
inFile = File("autzen-dd.las", mode = "r")
header = inFile.header
points = copy.deepcopy(inFile.points)

import numpy as np

X = inFile.X
Y = inFile.Y

minx = np.min(X)
miny = np.min(Y)

maxx = np.max(X)
maxy = np.max(Y)

print minx, miny, maxx, maxy
x = ((maxx - minx)/2.0 + minx) - 1.0/header.scale[0]
y = (maxy - miny)/2.0 + miny

print x, y

points[0][0][0] = x

print points[0][0][0]
outfile = File("spurious.las", mode='w', header = header)
outfile.points = points
import pdb;pdb.set_trace()
def clarifydata(tile, obfuscated_data, original_data, filetype, outputfolder):

    tilename = tile.name
    obfuscated_name = tile.params['obfsname']
    toffset = tile.params['toffset']

    obfuscated_tile = os.path.join(obfuscated_data, '{0}.{1}'.format(
        obfuscated_name, filetype)).replace('\\', '/')
    ori_tile = os.path.join(original_data,
                            '{0}.{1}'.format(tilename,
                                             filetype)).replace('\\', '/')
    temp_outputfile = os.path.join(outputfolder,
                                   '{0}.{1}'.format(tilename,
                                                    'las')).replace('\\', '/')
    outputfile = os.path.join(outputfolder,
                              '{0}.{1}'.format(tilename,
                                               filetype)).replace('\\', '/')

    #read the obfuscated tile
    infile = File(obfuscated_tile, mode='r')

    #get the gps times
    tvalues = infile.get_gps_time()
    #reset to original times
    newtvals = tvalues - toffset

    outfile = File(temp_outputfile, mode="w", header=infile.header)
    outfile.points = infile.points
    outfile.set_gps_time(newtvals)

    outfile.close()
    infile.close()

    #lascopy all x,y,z,classification based on the corrected gps time
    subprocessargs = [
        'C:/LAStools/bin/lascopy.exe', '-i', temp_outputfile, '-i', ori_tile,
        '-olaz', '-o', outputfile
    ]
    subprocessargs = list(map(str, subprocessargs))
    p = subprocess.run(subprocessargs,
                       stdout=subprocess.PIPE,
                       stderr=subprocess.STDOUT,
                       shell=False,
                       check=True,
                       universal_newlines=True)

    if os.path.isfile(outputfile):
        #read the obfuscated tile
        nfile = File(outputfile, mode='r')
        classification = nfile.classification
        #print(classification)

        #get the class 0
        if not 0 in classification:

            log = f'Succesfully coverted {obfuscated_name} -> {tilename}'
            os.remove(temp_outputfile)
            print(log)

            ofile = File(ori_tile, mode='r')

            return (True, outputfile, log)

        else:

            log = f'Failed coverting {obfuscated_name} -> {tilename}- class 0 points in tile'
            #os.remove(temp_outputfile)
            print(log)

            return (False, outputfile, log)

    else:

        log = f'Failed coverting {obfuscated_name} -> {tilename}'
        #os.remove(temp_outputfile)
        print(log)

        return (False, outputfile, log)
def convertFile(tilename, inputfolder, outputfolder, filetype, Xorigin,
                Yorigin, Xoffset, Yoffset, costheta, sintheta):

    inputfile = os.path.join(inputfolder,
                             '{0}.{1}'.format(tilename,
                                              filetype)).replace('\\', '/')
    temp_outputfile = os.path.join(outputfolder,
                                   '{0}.{1}'.format(tilename,
                                                    'las')).replace('\\', '/')
    outputfile = os.path.join(outputfolder,
                              '{0}.{1}'.format(tilename,
                                               filetype)).replace('\\', '/')

    try:
        inFile = File(inputfile, mode='r')

        header = inFile.header
        outfile = File(
            temp_outputfile,
            mode="w",
            header=header,
        )

        tic = time.perf_counter()
        X = inFile.get_x_scaled()
        Y = inFile.get_y_scaled()

        X, Y = Translate(X, Y, -1 * Xorigin, -1 * Yorigin)
        X, Y = Rotate(X, Y, sintheta, costheta)
        X, Y = Translate(X, Y, Xorigin, Yorigin)
        X, Y = Translate(X, Y, Xoffset, Yoffset)

        outfile.points = inFile.points
        outfile.set_x_scaled(X)
        outfile.set_y_scaled(Y)

        toc = time.perf_counter()

        outfile.close()

        subprocessargs = [
            'C:/LAStools/bin/las2las.exe', '-i', temp_outputfile, '-olaz',
            '-o', outputfile
        ]
        subprocessargs = list(map(str, subprocessargs))
        p = subprocess.run(subprocessargs,
                           stdout=subprocess.PIPE,
                           stderr=subprocess.STDOUT,
                           shell=False,
                           check=True,
                           universal_newlines=True)

        log = f"{tilename} : Convertion completed in {toc - tic:0.4f}s"
        print(log)

        if os.path.isfile(outputfile):
            os.remove(temp_outputfile)

        return (True, outputfile, log)

    except:

        log = f"{tilename} : Convertion Failed"
        print(log)
        outfile.close()
        return (False, tilename, log)
Esempio n. 15
0
withehelds_points = inFile.get_withheld()

try:
	overlap = inFile.get_overlap()
except laspy.util.LaspyException as err:
	print("Overlap error: {0}".format(err))
	#print(format(err))

angle_rank = inFile.get_scan_angle_rank()

try:
	scan_angle = inFile.get_scan_angle()
except laspy.util.LaspyException as err:
	print("\nScan angle error: {0}".format(err))
	
user_data = inFile.get_user_data()

try:
	reds = inFile.get_red()
	greens = inFile.get_green()
	blues = inFile.get_blue()
except laspy.util.LaspyException as err:
	print("\nColor: {0}".format(err))
#wv_desc_indices = inFile.get_wave_packet_desc_index()
#inFile.get_nir()

outFile = File('output.las', mode='w', header=inFile.header)
print("outFile type",type(outFile))
outFile.points = inFile.points[I]
outFile.close()
Esempio n. 16
0
distances = np.sum((coords - first_point)**2, axis=1)

# Create an array of indicators for whether or not a point is less than
# 500000 units away from the first point

keep_points = distances < 500000

# Grab an array of all points which meet this threshold

points_kept = inFile.points[keep_points]

print("We're keeping %i points out of %i total" %
      (len(points_kept), len(inFile)))

print("Find ground points...")
# Grab the return_num and num_returns dimensions
num_returns = inFile.num_returns
return_num = inFile.return_num
ground_points = inFile.points[num_returns == return_num]

print("%i points out of %i were ground points." %
      (len(ground_points), len(inFile)))

print("Writing output files...")

outFile2 = File("../data/las/ground_points.las",
                mode="w",
                header=inFile.header)
outFile2.points = ground_points
outFile2.close()
Esempio n. 17
0
        inFile = File(dirname1 + '\\' + filename, mode='r')

        num_avant = len(inFile.points)
        coords = np.vstack((inFile.x, inFile.y, inFile.z)).transpose()
        unique, index = np.unique(coords, axis=0, return_index=True)
        points_kept = inFile.points[index]
        num_apres = len(points_kept)

        if (num_avant != num_apres):
            num_dupli = num_avant - num_apres
            nom = os.path.splitext(filename)[0]

            outFile1 = File(dirout + '\\' + nom + '.las',
                            mode="w",
                            header=inFile.header)
            outFile1.points = points_kept
            outFile1.close()

            file.write(filename + ' ' + str(num_dupli) +
                       ' duplicated (xyz) : sur ' + str(num_avant) +
                       ' points\n')

        inFile.close()

        update_progress(ci / int(D1))

if eR > 0:
    print('Process finnihed :' + str(eR) +
          ' errors read Comp-result.txt in the source folder')
else:
    print('Process finnihed with no errors')
Esempio n. 18
0
def convertFile(tilename, inputfolder, outputfolder, filetype):

    inputfile = os.path.join(inputfolder,
                             '{0}.{1}'.format(tilename,
                                              filetype)).replace('\\', '/')
    temp_outputfile = os.path.join(outputfolder,
                                   '{0}.{1}'.format(tilename,
                                                    'las')).replace('\\', '/')
    outputfile = os.path.join(outputfolder,
                              '{0}.{1}'.format(tilename,
                                               filetype)).replace('\\', '/')

    try:
        inFile = File(inputfile, mode='r')

        header = inFile.header

        outfile = File(
            temp_outputfile,
            mode="w",
            header=header,
        )

        outfile.header.offset = [0.0, 0.0, 0.0]

        tic = time.perf_counter()
        X = inFile.get_x_scaled()
        Y = inFile.get_y_scaled()
        Z = inFile.get_z_scaled()
        E, N = transGDA94_to_ArgyleGrid(X, Y)

        outfile.points = inFile.points
        outfile.set_x_scaled(E)
        outfile.set_y_scaled(N)

        print(E, N, Z)

        toc = time.perf_counter()

        outfile.close()

        subprocessargs = [
            'C:/LAStools/bin/las2las.exe', '-i', temp_outputfile, '-olaz',
            '-o', outputfile
        ]
        subprocessargs = list(map(str, subprocessargs))
        p = subprocess.run(subprocessargs,
                           stdout=subprocess.PIPE,
                           stderr=subprocess.STDOUT,
                           shell=False,
                           check=True,
                           universal_newlines=True)

        log = f"{tilename} : Convertion completed in {toc - tic:0.4f}s"
        print(log)

        if os.path.isfile(outputfile):
            os.remove(temp_outputfile)

        return (True, outputfile, log)

    except:

        log = f"{tilename} : Convertion Failed"
        print(log)
        outfile.close()
        return (False, tilename, log)
Esempio n. 19
0
def convertFile(tilename, inputfolder, xorigin, yorigin, scalar, xshift,
                yshift, outputfolder, filetype):

    inputfile = os.path.join(inputfolder,
                             '{0}.{1}'.format(tilename,
                                              filetype)).replace('\\', '/')
    temp_outputfile = os.path.join(outputfolder,
                                   '{0}.{1}'.format(tilename,
                                                    'las')).replace('\\', '/')
    outputfile = os.path.join(outputfolder,
                              '{0}.{1}'.format(tilename,
                                               filetype)).replace('\\', '/')

    try:
        inFile = File(inputfile, mode='r')

        header = inFile.header
        outfile = File(
            temp_outputfile,
            mode="w",
            header=header,
        )

        tic = time.perf_counter()
        xvalues = inFile.get_x_scaled()
        newxvals = shiftNscale(xvalues, xshift, xorigin, scalar)
        yvalues = inFile.get_y_scaled()
        newyvals = shiftNscale(yvalues, yshift, yorigin, scalar)

        outfile.points = inFile.points
        outfile.set_x_scaled(newxvals)
        outfile.set_y_scaled(newyvals)

        toc = time.perf_counter()

        outfile.close()

        subprocessargs = [
            'C:/LAStools/bin/las2las.exe', '-i', temp_outputfile, '-olaz',
            '-o', outputfile
        ]
        subprocessargs = list(map(str, subprocessargs))
        p = subprocess.run(subprocessargs,
                           stdout=subprocess.PIPE,
                           stderr=subprocess.STDOUT,
                           shell=False,
                           check=True,
                           universal_newlines=True)

        log = f"{tilename} : Convertion completed in {toc - tic:0.4f}s"
        print(log)

        if os.path.isfile(outputfile):
            os.remove(temp_outputfile)

        return (True, outputfile, log)

    except:

        log = f"{tilename} : Convertion Failed"
        print(log)
        outfile.close()
        return (False, tilename, log)