def test_cube_randomline(show_plot): """Import a cube, and compute a randomline given a simple Polygon""" incube = Cube(SFILE4) poly = xtgeo.Polygons() poly.from_list([[778133, 6737650, 2000, 1], [776880, 6738820, 2000, 1]]) logger.info("Generate random line...") hmin, hmax, vmin, vmax, random = incube.get_randomline(poly) assert hmin == pytest.approx(-15.7, 0.1) assert random.mean() == pytest.approx(-12.5, 0.1) if show_plot: import matplotlib.pyplot as plt plt.figure() plt.imshow( random, cmap="seismic", interpolation="sinc", extent=(hmin, hmax, vmax, vmin), ) plt.axis("tight") plt.colorbar() plt.show()
def test_cube_randomline(): """Import a cube, and compute a randomline given a simple Polygon""" # import matplotlib.pyplot as plt incube = Cube(SFILE4) # make a polyline with two points dfr = pd.DataFrame( np.array([[778133, 6737650, 2000, 1], [776880, 6738820, 2000, 1]]), columns=["X_UTME", "Y_UTMN", "Z_TVDSS", "POLY_ID"], ) poly = xtgeo.Polygons() poly.dataframe = dfr logger.info("Generate random line...") hmin, hmax, vmin, vmax, random = incube.get_randomline(poly)