def test_slopes_at_patches_comps(self): rmg = RasterModelGrid((4, 5)) rmg.at_node['topographic__elevation'] = rmg.node_x.copy() slopes_out = rmg.node_slopes(unit='radians', return_components=True) assert_array_almost_equal(slopes_out[0].data, np.full(20, np.pi / 4., dtype=float)) assert_array_almost_equal(slopes_out[1][0].data, np.ones(20, dtype=float)) assert_array_almost_equal(slopes_out[1][1].data, np.zeros(20, dtype=float))
def test_slopes_at_patches(self): rmg = RasterModelGrid((4, 5)) rmg.at_node['topographic__elevation'] = rmg.node_x.copy() slopes_out = rmg.node_slopes(unit='degrees') assert_array_almost_equal(slopes_out, np.full(20, 45., dtype=float))