From 13ac4a458a92e8c32d034d3ea2771d6600df5424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20C=2E=20Riven=C3=A6s?= Date: Mon, 9 Oct 2023 15:13:57 +0200 Subject: [PATCH] fixup --- src/xtgeo/well/_well_aux.py | 1 - src/xtgeo/xyz_common/__init__.py | 2 ++ src/xtgeo/xyz_common/_xyz_data.py | 10 +++++----- tests/test_grid3d/test_grid_vs_well.py | 1 - tests/test_well/test_well.py | 1 - tests/test_well/test_well_vs_grid.py | 18 +++++++++--------- 6 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/xtgeo/well/_well_aux.py b/src/xtgeo/well/_well_aux.py index 0483fb194..6ffd36fd6 100644 --- a/src/xtgeo/well/_well_aux.py +++ b/src/xtgeo/well/_well_aux.py @@ -14,7 +14,6 @@ import pandas as pd import xtgeo -import xtgeo.cxtgeo._cxtgeo as _cxtgeo # type: ignore from xtgeo.common import XTGeoDialog from ..xyz_common._xyz_enum import _AttrName diff --git a/src/xtgeo/xyz_common/__init__.py b/src/xtgeo/xyz_common/__init__.py index 9102473e7..d0d9058e2 100644 --- a/src/xtgeo/xyz_common/__init__.py +++ b/src/xtgeo/xyz_common/__init__.py @@ -3,3 +3,5 @@ from xtgeo.xyz_common._xyz_data import _XYZData from xtgeo.xyz_common._xyz_enum import _AttrName, _AttrType, _XYZType + +__all__ = ["_XYZData", "_AttrName", "_AttrType", "_XYZType"] diff --git a/src/xtgeo/xyz_common/_xyz_data.py b/src/xtgeo/xyz_common/_xyz_data.py index 6e4a2ac17..341e035ce 100644 --- a/src/xtgeo/xyz_common/_xyz_data.py +++ b/src/xtgeo/xyz_common/_xyz_data.py @@ -45,7 +45,6 @@ from xtgeo.common import XTGeoDialog from xtgeo.common.sys import _convert_carr_double_np, _get_carray from xtgeo.cxtgeo import _cxtgeo -from xtgeo.xyz_common._xyz_enum import _AttrType, _XYZType from ._xyz_enum import _AttrName, _AttrType, _XYZType @@ -86,7 +85,7 @@ def __init__( xyztype: str = "well", floatbits: Literal["float32", "float64"] = "float64", ): - logger.info("Running init for: %s", __class__.__name__) + logger.info("Running init for: %s", __name__) self._df = dataframe self._attr_types = {} @@ -199,13 +198,14 @@ def _infer_attr_dtypes(self): datatypes[name] = _AttrType.CONT continue - if "Float" in str(dtype): + if "float" in str(dtype).lower(): datatypes[name] = _AttrType.CONT - elif "Int" in str(dtype): + elif "int" in str(dtype).lower(): datatypes[name] = _AttrType.DISC else: raise RuntimeError( - f"Log type seems to be something else than Float or Int for {name}" + "Log type seems to be something else than float or int for " + f"{name}: {dtype}" ) self._attr_types = datatypes logger.debug("Processed attr_type: %s", self._attr_types) diff --git a/tests/test_grid3d/test_grid_vs_well.py b/tests/test_grid3d/test_grid_vs_well.py index 17d57322e..c1c80dffa 100644 --- a/tests/test_grid3d/test_grid_vs_well.py +++ b/tests/test_grid3d/test_grid_vs_well.py @@ -7,7 +7,6 @@ import xtgeo from xtgeo.common import XTGeoDialog -from xtgeo.well import Well xtg = XTGeoDialog() logger = xtg.basiclogger(__name__) diff --git a/tests/test_well/test_well.py b/tests/test_well/test_well.py index 0e09067d4..4e4fc1cd4 100644 --- a/tests/test_well/test_well.py +++ b/tests/test_well/test_well.py @@ -1,4 +1,3 @@ -import sys from os.path import join import numpy as np diff --git a/tests/test_well/test_well_vs_grid.py b/tests/test_well/test_well_vs_grid.py index fb91f5567..f9b2c83bc 100644 --- a/tests/test_well/test_well_vs_grid.py +++ b/tests/test_well/test_well_vs_grid.py @@ -76,12 +76,12 @@ def test_well_get_gridprops(tmpdir, loadwell1, loadgrid1, loadporo1): mywell.get_gridproperties(myporo, mygrid) - # myactnum = mygrid.get_actnum() - # myactnum.codes = {0: "INACTIVE", 1: "ACTIVE"} - # myactnum.describe() - - # mywell.get_gridproperties(myactnum, mygrid) - # mywell.to_file(join(tmpdir, "w_from_gprops.w")) - # assert mywell.dataframe.iloc[4775]["PORO_model"] == pytest.approx(0.2741, abs=0.001) - # assert mywell.dataframe.iloc[4775]["ACTNUM_model"] == 1 - # assert mywell.isdiscrete("ACTNUM_model") is True + myactnum = mygrid.get_actnum() + myactnum.codes = {0: "INACTIVE", 1: "ACTIVE"} + myactnum.describe() + + mywell.get_gridproperties(myactnum, mygrid) + mywell.to_file(join(tmpdir, "w_from_gprops.w")) + assert mywell.dataframe.iloc[4775]["PORO_model"] == pytest.approx(0.2741, abs=0.001) + assert mywell.dataframe.iloc[4775]["ACTNUM_model"] == 1 + assert mywell.isdiscrete("ACTNUM_model") is True