Skip to content

Commit 3772edf

Browse files
committed
[WIP] Being able to compute
1 parent 6df2212 commit 3772edf

File tree

6 files changed

+27
-15
lines changed

6 files changed

+27
-15
lines changed

gempy_engine/API/server/_server_functions.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,14 @@ def setup_logger():
3232

3333

3434
def process_input(gempy_input: GemPyInput, logger: logging.Logger) -> (InputDataDescriptor, InterpolationInput, int):
35-
36-
logger.debug("Input grid:", gempy_input.interpolation_input.grid)
3735

38-
regular_grid: EngineGrid = EngineGrid.from_regular_grid(regular_grid=RegularGrid.from_schema(gempy_input.interpolation_input.grid))
39-
40-
# BUG: Adapt this to the new grid
41-
# gempy_input.interpolation_input.grid = regular_grid
36+
logger.debug(f"Input grid: {gempy_input.interpolation_input.grid}")
4237

4338
interpolation_input: InterpolationInput = InterpolationInput.from_schema(gempy_input.interpolation_input)
4439
input_data_descriptor: InputDataDescriptor = InputDataDescriptor.from_schema(gempy_input.input_data_descriptor)
4540
n_stack = len(input_data_descriptor.stack_structure.masking_descriptor)
46-
logger.debug("masking descriptor: ", input_data_descriptor.stack_structure.masking_descriptor)
47-
logger.debug("stack structure: ", input_data_descriptor.stack_structure)
41+
42+
logger.debug(f"masking descriptor: {input_data_descriptor.stack_structure.masking_descriptor}")
43+
logger.debug(f"stack structure: {input_data_descriptor.stack_structure}")
4844
return input_data_descriptor, interpolation_input, n_stack
4945

gempy_engine/API/server/main_server_pro.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,21 @@ def compute_gempy_model(gempy_input: GemPyInput):
5656
print("Running gempy model...")
5757
logger.info("Running GemPy Engine")
5858

59+
interpolation_input: InterpolationInput
60+
input_data_descriptor: InputDataDescriptor
5961
input_data_descriptor, interpolation_input, n_stack = process_input(
6062
gempy_input=gempy_input,
6163
logger=logger
6264
)
63-
65+
6466
# region Set new fancy triangulation TODO: This has to be move to the interpolation options coming from the client
65-
FANCY_TRIANGULATION = True
66-
if FANCY_TRIANGULATION:
67-
default_interpolation_options.mesh_extraction_fancy = True
67+
# FANCY_TRIANGULATION = True
68+
# if FANCY_TRIANGULATION:
69+
# default_interpolation_options.mesh_extraction_fancy = True
6870
# default_interpolation_options.mesh_extraction_masking_options = MeshExtractionMaskingOptions.RAW # * To Date only raw making is supported
6971
# endregion
7072

71-
default_interpolation_options.mesh_extraction_masking_options = MeshExtractionMaskingOptions.RAW # * To Date only raw making is supported
73+
# default_interpolation_options.mesh_extraction_masking_options = MeshExtractionMaskingOptions.RAW # * To Date only raw making is supported
7274

7375
solutions: Solutions = _compute_model(
7476
interpolation_input=interpolation_input,

gempy_engine/core/data/interpolation_input.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,18 @@ def from_interpolation_input_subset(cls, all_interpolation_input: "Interpolation
102102

103103
@classmethod
104104
def from_schema(cls, schema: InterpolationInputSchema) -> "InterpolationInput":
105+
106+
octree_grid = RegularGrid(
107+
orthogonal_extent=schema.grid.extent,
108+
regular_grid_shape=np.array([2, 2, 2])
109+
)
110+
grid: EngineGrid = EngineGrid( # * Here we convert the GemPy grid to the
111+
octree_grid=octree_grid
112+
)
105113
return cls(
106114
surface_points=SurfacePoints.from_schema(schema.surface_points),
107115
orientations=Orientations.from_schema(schema.orientations),
108-
grid=schema.grid,
116+
grid=grid
109117
)
110118

111119

requirements/server-requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ fastapi
44
uvicorn[standard]
55
subsurface
66
pandas
7+
httpx
8+
subsurface-terra

tests/test_server/example.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@
6565
]
6666
]
6767
},
68-
"grid": null
68+
"grid": {
69+
"extent": [ 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 ],
70+
"octree_levels": 2
71+
}
6972
},
7073
"input_data_descriptor": {
7174
"number_of_points_per_surface": [7],

tests/test_server/tests_server_I.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def test_post_example_json(client):
4141
headers={"Content-Type": "application/json"}
4242
)
4343

44+
print(response.json())
4445
assert response.status_code == 200
4546
result = response.json()
4647
assert "result" in result or "scalar_field" in result

0 commit comments

Comments
 (0)