Skip to content

Commit 6004b89

Browse files
committed
[WIP] Debugging grid serialization
1 parent 2e59670 commit 6004b89

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

gempy/core/data/encoders/binary_encoder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def deserialize_grid(binary_array:bytes, custom_grid_length: int, topography_len
6969

7070
custom_grid_binary = binary_array[custom_grid_start:custom_grid_end]
7171
topography_binary = binary_array[topography_grid_start:topography_grid_end]
72-
custom_grid = np.frombuffer(custom_grid_binary)
72+
custom_grid = np.frombuffer(custom_grid_binary, dtype=np.float64)
7373
topography = np.frombuffer(topography_binary)
7474

7575

gempy/core/data/grid.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,16 @@ def deserialize_properties(cls, data: Union["Grid", dict], constructor: ModelWra
9090

9191
@property
9292
def grid_binary(self):
93-
custom_grid_bytes = self._custom_grid.values.tobytes() if self._custom_grid else b''
94-
topography_bytes = self._topography.values.tobytes() if self._topography else b''
93+
astype = self._custom_grid.values.astype("float64")
94+
custom_grid_bytes = astype.tobytes() if self._custom_grid else b''
95+
topography_bytes = self._topography.values.astype("float64").tobytes() if self._topography else b''
9596
return custom_grid_bytes + topography_bytes
9697

9798
@computed_field
9899
def binary_meta_data(self) -> dict:
99100
return {
100-
'custom_grid_binary_length': len(self._custom_grid.values.tobytes()) if self._custom_grid else 0,
101-
'topography_binary_length': len(self._topography.values.tobytes()) if self._topography else 0
101+
'custom_grid_binary_length': len(self._custom_grid.values.astype("float64").tobytes()) if self._custom_grid else 0,
102+
'topography_binary_length': len(self._topography.values.astype("float64").tobytes()) if self._topography else 0
102103
}
103104

104105
@computed_field(alias="active_grids")

0 commit comments

Comments
 (0)