Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self._reader = base.Reader(self.filename, mode = self._mode, header=self._header)
if self.in_srs:
self._reader.SetInputSRS(self.in_srs)
if self.out_srs:
self._reader.SetOutputSRS(self.out_srs)
## Wire up API for extra dimensions
if self._reader.extra_dimensions != []:
for dimension in self._reader.extra_dimensions:
dimname = dimension.name.decode().replace("\x00", "").replace(" ", "_").lower()
self.addProperty(dimname)
elif self._mode == 'rw':
if self._header is None:
self._writer = base.Writer(self.filename,mode = self._mode)
self._reader = self._writer
self._header = self._reader.get_header()
## Wire up API for any extra Dimensions
if self._writer.extra_dimensions != []:
for dimension in self._writer.extra_dimensions:
dimname = dimension.name.decode().replace("\x00", "").replace(" ", "_").lower()
self.addProperty(dimname)
else:
raise util.LaspyException("Headers must currently be stored in the file, you provided: " + str(self._header))
elif self._mode == 'w':
if self._header is None:
raise util.LaspyException("Creation of a file in write mode requires a header object.")
if isinstance(self._header, header.HeaderManager):
vlrs = self._header.vlrs
evlrs = self._header.evlrs
def open(self):
'''Open the file for processing, called by __init__
'''
if self._mode in ("r", "r-"):
if not os.path.exists(self.filename):
raise OSError("No such file or directory: '%s'" % self.filename)
## Make sure we have a header
if self._header is None:
self._reader = base.Reader(self.filename, mode=self._mode)
self._header = self._reader.get_header()
else:
raise util.LaspyException("Headers must currently be stored in the file, you provided: " + str(self._header))
self._reader = base.Reader(self.filename, mode = self._mode, header=self._header)
if self.in_srs:
self._reader.SetInputSRS(self.in_srs)
if self.out_srs:
self._reader.SetOutputSRS(self.out_srs)
## Wire up API for extra dimensions
if self._reader.extra_dimensions != []:
for dimension in self._reader.extra_dimensions:
dimname = dimension.name.decode().replace("\x00", "").replace(" ", "_").lower()
self.addProperty(dimname)
def open(self):
'''Open the file for processing, called by __init__
'''
if self._mode in ("r", "r-"):
if not os.path.exists(self.filename):
raise OSError("No such file or directory: '%s'" % self.filename)
## Make sure we have a header
if self._header is None:
self._reader = base.Reader(self.filename, mode=self._mode)
self._header = self._reader.get_header()
else:
raise util.LaspyException("Headers must currently be stored in the file, you provided: " + str(self._header))
self._reader = base.Reader(self.filename, mode = self._mode, header=self._header)
if self.in_srs:
self._reader.SetInputSRS(self.in_srs)
if self.out_srs:
self._reader.SetOutputSRS(self.out_srs)
## Wire up API for extra dimensions
if self._reader.extra_dimensions != []:
for dimension in self._reader.extra_dimensions:
dimname = dimension.name.decode().replace("\x00", "").replace(" ", "_").lower()
self.addProperty(dimname)
elif self._mode == 'rw':
if self._header is None:
self._writer = base.Writer(self.filename,mode = self._mode)
self._reader = self._writer