Skip to content

Commit

Permalink
Merge pull request #482 from kinverarity1/lidar-file
Browse files Browse the repository at this point in the history
Detect and raise IOError exception for LiDAR files (fixes #472)
  • Loading branch information
kinverarity1 authored Jul 14, 2021
2 parents 8fcf7ea + 2af57ab commit 02cf79b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lasio/las.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ def read(
try:
file_obj, self.encoding = reader.open_file(file_ref, **kwargs)

test_lidar = file_obj.read(4)
if test_lidar == "LASF":
raise IOError("This is a LASer file (i.e. LiDAR data), not a Log ASCII Standard file")
else:
file_obj.seek(0)

logger.debug(
"Fetching substitutions for read_policy {} and null policy {}".format(
read_policy, null_policy
Expand Down

0 comments on commit 02cf79b

Please # to comment.