Skip to content

Commit 44d3f1b

Browse files
committed
[WIP/ENH] Getting the section running
1 parent 0d10881 commit 44d3f1b

File tree

2 files changed

+5
-32
lines changed

2 files changed

+5
-32
lines changed

gempy/core/data/grid_modules/sections_grid.py

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
from pydantic import Field, model_validator
2-
from typing import Tuple, Dict, List, Optional
3-
41
import dataclasses
52
import numpy as np
3+
from pydantic import Field
4+
from typing import Tuple, Dict, List, Optional
65

76
from ..core_utils import calculate_line_coordinates_2points
87
from ..encoders.converters import short_array_type
@@ -42,7 +41,7 @@ class Sections:
4241
]
4342

4443
# computed/internal (will be serialized too unless excluded)
45-
names: List[str] = Field(default_factory=list, exclude=True)
44+
names: short_array_type = Field(default=np.array([]), exclude=True)
4645
points: List[List[Tuple[float, float]]] = Field(default_factory=list, exclude=True)
4746
resolution: List[Tuple[int, int]] = Field(default_factory=list, exclude=True)
4847
length: np.ndarray = Field(default_factory=lambda: np.array([0]), exclude=True)
@@ -51,38 +50,13 @@ class Sections:
5150
values: np.ndarray = Field(default_factory=lambda: np.empty((0, 3)), exclude=True)
5251
extent: Optional[np.ndarray] = Field(default=None, exclude=True)
5352

54-
# def __init__(self, regular_grid=None, z_ext=None, section_dict=None):
55-
# pd = require_pandas()
56-
# if regular_grid is not None:
57-
# self.z_ext = regular_grid.extent[4:]
58-
# else:
59-
# self.z_ext = z_ext
60-
#
61-
# self.section_dict = section_dict
62-
# self.names = []
63-
# self.points = []
64-
# self.resolution = []
65-
# self.length = [0]
66-
# self.dist = []
67-
# self.df = pd.DataFrame()
68-
# self.df['dist'] = self.dist
69-
# self.values = np.empty((0, 3))
70-
# self.extent = None
71-
#
72-
# if section_dict is not None:
73-
# self.set_sections(section_dict)
7453
def __post_init__(self):
7554
self.initialize_computations()
7655
pass
7756

78-
# @model_validator(mode="after")
79-
# def init_class(self):
80-
# self.initialize_computations()
81-
# return self
82-
#
8357
def initialize_computations(self):
8458
# copy names
85-
self.names = list(self.section_dict.keys())
59+
self.names = np.array(list(self.section_dict.keys()))
8660

8761
# build points/resolution/length
8862
self._get_section_params()

test/test_modules/test_grids/test_grids_sections.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ def test_section_grids():
4141
verify_moment="after",
4242
file_name=f"verify/{geo_model.meta.name}"
4343
)
44-
return
45-
gp.compute_model(geo_model)
44+
gp.compute_model(geo_model, validate_serialization=False)
4645
gpv.plot_2d(
4746
model=geo_model,
4847
section_names=['section_SW-NE', 'section_NW-SE', 'topography'],

0 commit comments

Comments
 (0)