Skip to content

Commit 2a76ec8

Browse files
committed
- [BUG] Update xsolution.py to match subsurface v0.2 properly
1 parent fc12134 commit 2a76ec8

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ install:
5656
- pip install git+https://github.com/arviz-devs/arviz --force-reinstall
5757

5858
# Install subsurface
59-
- pip install subsurface==0.2
59+
- pip install subsurface
6060

6161
- conda install -c conda-forge gdal
6262

gempy/core/xsolution.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -231,35 +231,35 @@ def create_unstruct_xarray(values, l0, l1, xyz):
231231
# Values and lith block
232232
property_v3 = xr.DataArray(
233233
data=values[0][:, l0:l1],
234-
dims=['attribute', 'cell'],
234+
dims=['cell_attr', 'cell'],
235235
)
236236

237-
arrays['property_v3'] = property_v3
237+
arrays['property'] = property_v3
238238

239239
if values[1] is not None:
240240
# block
241241
block_v3 = xr.DataArray(
242242
data=values[1][:, :, l0:l1],
243-
dims=['Features', 'attribute', 'cell'],
243+
dims=['Features', 'cell_attr', 'cell'],
244244
)
245245

246-
arrays['block_v3'] = block_v3
246+
arrays['block'] = block_v3
247247

248248
if values[4] is not None:
249249
# Scalar field
250250
scalar_field_v3 = xr.DataArray(
251251
data=values[4][:, l0:l1],
252252
dims=['Features', 'cell'],
253253
)
254-
arrays['scalar_field_v3'] = scalar_field_v3
254+
arrays['scalar_field'] = scalar_field_v3
255255

256256
if values[6] is not None:
257257
# Scalar field
258258
mask_v3 = xr.DataArray(
259259
data=values[6][:, l0:l1],
260260
dims=['Features', 'cell'],
261261
)
262-
arrays['mask_v3'] = mask_v3
262+
arrays['mask'] = mask_v3
263263

264264
return arrays
265265

@@ -272,8 +272,10 @@ def set_values_to_custom_grid(self, values: list, l0, l1,
272272
self.s_custom_grid = subsurface.UnstructuredData.from_array(
273273
vertex=xyz,
274274
cells="points",
275-
attributes=arrays,
276-
coords=coords)
275+
cells_attr=arrays,
276+
coords=coords,
277+
default_cells_attr_name="block"
278+
)
277279

278280
return self.s_custom_grid
279281

gempy/plot/plot_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ def plot_3d(model, plotter_type='basic',
345345
img = gpv.p.show(screenshot=True)
346346
plt.imshow(img[1])
347347
plt.axis('off')
348-
plt.show()
348+
plt.show(block=False)
349349
gpv.p.close()
350350

351351
if off_screen is False:

test/test_plotting/test_plot_3d.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
warnings.warn('Unable to enable faulthandler:\n%s' % str(e))
1111

1212

13+
def test_pyvista_running():
14+
from pyvista import examples
15+
examples.plot_wave()
16+
1317
def test_plot_3d_data_default(one_fault_model_no_interp):
1418
gpv = gp.plot.plot_3d(one_fault_model_no_interp,
1519
plotter_type='basic', off_screen=True, image=True, notebook=False)

test/test_plotting/test_vista.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ def test_plot_surface_points_poly_live(self, vista_object_only_data_interactive)
9090
vista_object_only_data_interactive.live_updating = True
9191
vista_object_only_data_interactive.plot_surface_points()
9292
print('foo')
93+
img = vista_object_only_data_interactive.p.show(screenshot=True, auto_close=False)
94+
plt.imshow(img[1])
95+
plt.show(block=False)
96+
print('foo')
97+
9398

9499
def test_plot_surface_points_poly_static(self, vista_object_only_data):
95100
"""

0 commit comments

Comments
 (0)