def test_bad_shape_error(self): with pytest.raises(ValueError, match=r'Input arrays must be three-dimensional.'): strat.compute_boxy_stratigraphy_volume(self.elev[:, 10, 120].squeeze(), self.time[:, 10, 120].squeeze(), dz=0.05)
def test_returns_volume_and_elevations_given_nz(self): s, e = strat.compute_boxy_stratigraphy_volume(self.elev, self.time, nz=33) assert s.ndim == 3 assert s.shape == e.shape assert s.shape[0] == 33 + 1
def test_returns_volume_and_elevations_given_dz(self): s, e = strat.compute_boxy_stratigraphy_volume(self.elev, self.time, dz=0.05) assert s.ndim == 3 assert s.shape == e.shape assert e[1, 0, 0] - e[0, 0, 0] == pytest.approx(0.05)
def test_returns_volume_and_elevations_given_z(self): z = np.linspace(-20, 500, 200) s, e = strat.compute_boxy_stratigraphy_volume(self.elev, self.time, z=z) assert s.ndim == 3 assert s.shape == e.shape assert np.all(e[:, 0, 0] == z)
def test_no_z_options(self): with pytest.warns(UserWarning, match=r'No specification .*'): strat.compute_boxy_stratigraphy_volume(self.elev, self.time)
def test_return_cube(self): s, e = strat.compute_boxy_stratigraphy_volume(self.elev, self.time, dz=0.05, return_cube=True)