Exemple #1
0
    "#### Modelling landscape evolution and composition of sediment flux ####")
print("Starting")
print(datetime.datetime.now().time())

#### Set up model grid ####

print("Loading in topo")
print(datetime.datetime.now().time())

zr_nc = netCDF4.Dataset('input_dir/topo_CG.nc')
zr_ma = zr_nc['z'][:, :]
mg = RasterModelGrid(zr_ma.shape)
zr = mg.add_zeros('node', 'topographic__elevation')
zr += np.reshape(zr_ma.data.astype(float), zr.shape)
dx = 200
mg._dx, mg._dy = (dx, dx)

# Set up the boundary conditions on the square grid
mg.status_at_node[mg.nodes_at_left_edge] = FIXED_VALUE_BOUNDARY
mg.status_at_node[mg.nodes_at_top_edge] = FIXED_VALUE_BOUNDARY
mg.status_at_node[mg.nodes_at_bottom_edge] = FIXED_VALUE_BOUNDARY
mg.status_at_node[mg.nodes_at_right_edge] = FIXED_VALUE_BOUNDARY

# This natural data has some pits/depressions in which we want to fill
# using the sink filler algorithm

print("Filling pits")
print(datetime.datetime.now().time())
sfb = SinkFillerBarnes(mg, method='D8', fill_flat=False)
sfb.run_one_step()