Change depth unit matching to handle conflicts
@@ -302,9 +302,21 @@ class LASFile(object):
check_units_on.append(self.well[mnemonic])
if len(self.curves) > 0:
check_units_on.append(self.curves[0])
+ matches = []
for index_unit, possibilities in defaults.DEPTH_UNITS.items():
- if all(i.unit.upper() in possibilities for i in check_units_on):
- self.index_unit = index_unit
+ for check_unit in check_units_on:
+ if any([check_unit.unit == p for p in possibilities]) or any(
+ [check_unit.unit.upper() == p for p in possibilities]
+ ):
+ matches.append(index_unit)
+ matches = set(matches)
+ if len(matches) == 1:
+ self.index_unit = tuple(matches)[0]
+ elif len(matches) == 0:
+ self.index_unit = None
+ else:
+ logger.warning("Conflicting index units found: {}".format(matches))
+ self.index_unit = None
def write(self, file_ref, **kwargs):
"""Write LAS file to disk.
