From 2af57ab7b73f00127de081e1079b258a2ef97719 Mon Sep 17 00:00:00 2001 From: Kent Inverarity Date: Wed, 14 Jul 2021 17:08:04 +0930 Subject: [PATCH] Detect and raise Exception for LiDAR files --- lasio/las.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lasio/las.py b/lasio/las.py index 676b3c3..18eb699 100644 --- a/lasio/las.py +++ b/lasio/las.py @@ -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