import matplotlib.pyplot as plt
import numpy as np
from landlab.plot.imshow import imshow_field, imshow_grid

# Elevation_NS.npy is predetermined elevation profile that has
# a North and a South facing slope with a flat valley in the middle
# Slopes were defined to range from 0 through 55 in steps of 5 degrees
# Aspect is supposed to be 0 deg for North facing and 180 deg for South facing

grid = RasterModelGrid(53, 67, 10.0)
elev = np.load("elevation_NS.npy")
grid["node"]["Elevation"] = elev

ids = grid.node_at_cell
# Burroughs
slope_burrough, aspect_burrough = grid.calculate_slope_aspect_at_nodes_burrough(ids, vals="Elevation")
# Horn
slope_horn, aspect_horn = grid.calculate_slope_aspect_at_nodes_horn(ids, vals="Elevation")
# BestFitPlane
slope_bfp, aspect_bfp = grid.calculate_slope_aspect_at_nodes_best_fit_plane(ids, elev)


# node_slopes_using_patches
slope_NSP = grid.node_slopes_using_patches(elevs="Elevation", unit="degrees")

pic = 0
plt.figure(pic)
imshow_field(grid, "Elevation", values_at="node", grid_units=("m", "m"))
plt.title("Elevation in m")
# plt.savefig('Elevation_NS')
import numpy as np
from landlab.plot.imshow import imshow_grid

# Elevation_NS.npy is predetermined elevation profile that has
# a North and a South facing slope with a flat valley in the middle
# Slopes were defined to range from 0 through 55 in steps of 5 degrees
# Aspect is supposed to be 0 deg for North facing and 180 deg for South facing

grid = RasterModelGrid(53, 67, 10.)
elev = np.load('elevation_NS.npy')
grid['node']['Elevation'] = elev

ids = grid.node_at_cell
# Burroughs
slope_burrough, aspect_burrough = \
    grid.calculate_slope_aspect_at_nodes_burrough(ids, vals='Elevation')
# Horn
slope_horn, aspect_horn = \
    grid.calculate_slope_aspect_at_nodes_horn(ids, vals='Elevation')
# BestFitPlane
slope_bfp, aspect_bfp = grid.calculate_slope_aspect_at_nodes_best_fit_plane(
    ids, elev)


# node_slopes_using_patches
slope_NSP = grid.node_slopes_using_patches(elevs='Elevation', unit='degrees')

pic = 0
plt.figure(pic)
imshow_grid(grid, 'Elevation', values_at='node', grid_units=('m', 'm'))
plt.title('Elevation in m')