From 76e8999eaa1210b18f72824bf433ca635fc1c550 Mon Sep 17 00:00:00 2001 From: Neyberson Date: Thu, 28 Mar 2024 11:23:10 -0500 Subject: [PATCH] Add validations for template at to_las function --- pozo/graphs.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pozo/graphs.py b/pozo/graphs.py index 0737a13..52e753b 100644 --- a/pozo/graphs.py +++ b/pozo/graphs.py @@ -371,24 +371,24 @@ def to_las(self, *selectors, **kwargs): strategy = kwargs.pop("strategy", "merge") if template is not None: las = template + else: las = lasio.LASFile() curves = self.to_las_CurveItems(self, *selectors, **kwargs) if strategy == "merge": - las_new = las.copy() + if template is None: raise ValueError ("If you do not have a template, you must use the option pozo-only") for curve in curves: if las.mnemonic() != curve.mnemonic(): - las_new.append_curve_item(curve) + las.append_curve_item(curve) elif strategy == "add": - las_new = las.copy() + if template is None: raise ValueError ("If you do not have a template, you must use the option pozo-only") for curve in curves: - las_new.append_curve_item(curve) + las.append_curve_item(curve) elif strategy == "pozo-only": - las_new = lasio.LASFile() + if template: raise ValueError ("If you have a template, you must use the options mergr or add") for curve in curves: - if las.mnemonic() != curve.mnemonic(): - las_new.append_curve_item(curve) + if las.mnemonic() != curve.mnemonic(): las.append_curve_item(curve) else: raise ValueError("The strategy does not has support from pozo, please use: 'merge', 'add' or 'pozo-only'")