Exemplo n.º 1
0
fr = FlowAccumulator(mg, flow_director="D8")
sp = StreamPowerEroder(mg, "./drive_sp_params.txt")
# load the Fastscape module too, to allow direct comparison
fsp = FastscapeEroder(mg, "./drive_sp_params.txt")

# perform the loop:
elapsed_time = 0.  # total time in simulation
while elapsed_time < time_to_run:
    print(elapsed_time)
    if elapsed_time + dt > time_to_run:
        print("Short step!")
        dt = time_to_run - elapsed_time
    mg = fr.run_one_step()
    # print 'Area: ', numpy.max(mg.at_node['drainage_area'])
    # mg = fsp.erode(mg)
    mg = fsp.erode(mg, K_if_used="K_values")
    # mg,_,_ = sp.erode(mg, dt, node_drainage_areas='drainage_area', slopes_at_nodes='topographic__steepest_slope')
    # add uplift
    mg.at_node["topographic__elevation"][mg.core_nodes] += uplift * dt
    elapsed_time += dt

# Finalize and plot
elev = mg["node"]["topographic__elevation"]
elev_r = mg.node_vector_to_raster(elev)

# Clear previous plots
pylab.figure(1)
pylab.close()

# Plot topography
pylab.figure(1)
Exemplo n.º 2
0
# instantiate the components:
fr = FlowAccumulator(mg, flow_director="D8")
# load the Fastscape module too, to allow direct comparison
fsp = FastscapeEroder(mg, "./pot_fr_params.txt")

# perform the loop:
elapsed_time = 0.  # total time in simulation
while elapsed_time < time_to_run:
    print(elapsed_time)
    if elapsed_time + dt > time_to_run:
        print("Short step!")
        dt = time_to_run - elapsed_time
    mg = fr.run_one_step()
    # print 'Area: ', numpy.max(mg.at_node['drainage_area'])
    # mg = fsp.erode(mg)
    mg = fsp.erode(mg, K_if_used="K_values")
    # mg,_,_ = sp.erode(mg, dt, node_drainage_areas='drainage_area', slopes_at_nodes='topographic__steepest_slope')
    # add uplift
    mg.at_node["topographic__elevation"][mg.core_nodes] += uplift * dt
    elapsed_time += dt

pfr = PotentialityFlowRouter(mg, "pot_fr_params.txt")
pfr.route_flow(return_components=True)  # route_on_diagonals=False)

figure("Topo")
imshow_node_grid(mg, "topographic__elevation")
figure("Potentiality flow fluxes")
imshow_node_grid(mg, "surface_water__discharge")
figure("D8 drainage areas")
imshow_node_grid(mg, "drainage_area")
figure("K (core only)")
    # MN: Set the elevation of that random outlet boundary node to zero
    #mg['node'][ 'topographic__elevation'][random_boundary_node] = 0

    print('Random boundary node', random_boundary_node)

    #instantiate the components:
    fr = FlowAccumulator(mg, flow_director='D8')
    sp = FastscapeEroder(mg, input_file)

    time_on = time()

    #perform the inner time loops:
    for i in range(nt):
        mg['node']['topographic__elevation'][mg.core_nodes] += uplift_per_step
        mg = fr.run_one_step()
        mg = sp.erode(mg)

        #plot long profiles along channels
        pylab.figure(6)
        profile_IDs = prf.channel_nodes(
            mg, mg.at_node['topographic__steepest_slope'],
            mg.at_node['drainage_area'],
            mg.at_node['flow__upstream_node_order'],
            mg.at_node['flow__receiver_node'])
        dists_upstr = prf.get_distances_upstream(
            mg, len(mg.at_node['topographic__steepest_slope']), profile_IDs,
            mg.at_node['flow__link_to_receiver_node'])
        prf.plot_profiles(dists_upstr, profile_IDs,
                          mg.at_node['topographic__elevation'])
        # print 'Completed loop ', i
Exemplo n.º 4
0
print('Running ...') 

#instantiate the components:
pr = PrecipitationDistribution(input_file)
fr = Flow(mg)
sp = Fsc(mg, input_file)
hd = Diff(mg, input_file)

####################RUN
track_uplift = 0 #track cumulative uplift to know top of hard layer
last_trunc = runtime
for (interval_duration, rainfall_rate) in pr.yield_storm_interstorm_duration_intensity():
    if rainfall_rate != 0.:
        # note diffusion also only happens when it's raining...
        _ = fr.route_flow()
        _ = sp.erode(mg, interval_duration, K_if_used='K_values')
        _ = hd.diffuse(interval_duration)
    track_uplift += uplift_rate * interval_duration #top of beginning surface
    mg.at_node['topographic__elevation'][mg.core_nodes] += uplift_rate * interval_duration
    this_trunc = pr.elapsed_time // t_plot
    if this_trunc != last_trunc: # time to plot a new profile!
        print ('Time %d' % (t_plot * this_trunc))
        last_trunc = this_trunc
    else:
        pass
    
    #check where hard rocks and soft rocks are, change k to reflect this
    if hard_layer_on_or_off == 1: #if using layers
        hard_layer = np.where(mg.at_node['topographic__elevation'] >= track_uplift - hard_layer_thickness)
        soft_layer = np.where(mg.at_node['topographic__elevation'] < track_uplift - hard_layer_thickness)
        k[hard_layer] = k_unerodible
Exemplo n.º 5
0
fr = FlowAccumulator(mg, flow_director='D8')
sp = StreamPowerEroder(mg, './drive_sp_params.txt')
#load the Fastscape module too, to allow direct comparison
fsp = FastscapeEroder(mg, './drive_sp_params.txt')

#perform the loop:
elapsed_time = 0.  #total time in simulation
while elapsed_time < time_to_run:
    print(elapsed_time)
    if elapsed_time + dt > time_to_run:
        print("Short step!")
        dt = time_to_run - elapsed_time
    mg = fr.run_one_step()
    #print 'Area: ', numpy.max(mg.at_node['drainage_area'])
    #mg = fsp.erode(mg)
    mg = fsp.erode(mg, K_if_used='K_values')
    #mg,_,_ = sp.erode(mg, dt, node_drainage_areas='drainage_area', slopes_at_nodes='topographic__steepest_slope')
    #add uplift
    mg.at_node['topographic__elevation'][mg.core_nodes] += uplift * dt
    elapsed_time += dt

#Finalize and plot
elev = mg['node']['topographic__elevation']
elev_r = mg.node_vector_to_raster(elev)

# Clear previous plots
pylab.figure(1)
pylab.close()

# Plot topography
pylab.figure(1)
    #mg['node'][ 'topographic__elevation'][random_boundary_node] = 0

    print('Random boundary node',  random_boundary_node)


    #instantiate the components:
    fr = FlowAccumulator(mg, flow_director='D8')
    sp = FastscapeEroder(mg, input_file)

    time_on = time()

    #perform the inner time loops:
    for i in range(nt):
        mg['node']['topographic__elevation'][mg.core_nodes] += uplift_per_step
        mg = fr.run_one_step()
        mg = sp.erode(mg)

        #plot long profiles along channels
        pylab.figure(6)
        profile_IDs = prf.channel_nodes(mg, mg.at_node['topographic__steepest_slope'],
                mg.at_node['drainage_area'], mg.at_node['flow__upstream_node_order'],
                mg.at_node['flow__receiver_node'])
        dists_upstr = prf.get_distances_upstream(mg, len(mg.at_node['topographic__steepest_slope']),
                profile_IDs, mg.at_node['flow__link_to_receiver_node'])
        prf.plot_profiles(dists_upstr, profile_IDs, mg.at_node['topographic__elevation'])
        # print 'Completed loop ', i



    print('Completed the simulation. Plotting...')
Exemplo n.º 7
0
fr = FlowAccumulator(mg, flow_director='D8')
sp = StreamPowerEroder(mg, './drive_sp_params.txt')
#load the Fastscape module too, to allow direct comparison
fsp = FastscapeEroder(mg, './drive_sp_params.txt')

#perform the loop:
elapsed_time = 0. #total time in simulation
while elapsed_time < time_to_run:
    print(elapsed_time)
    if elapsed_time+dt>time_to_run:
        print("Short step!")
        dt = time_to_run - elapsed_time
    mg = fr.run_one_step()
    #print 'Area: ', numpy.max(mg.at_node['drainage_area'])
    #mg = fsp.erode(mg)
    mg = fsp.erode(mg, K_if_used='K_values')
    #mg,_,_ = sp.erode(mg, dt, node_drainage_areas='drainage_area', slopes_at_nodes='topographic__steepest_slope')
    #add uplift
    mg.at_node['topographic__elevation'][mg.core_nodes] += uplift*dt
    elapsed_time += dt

#Finalize and plot
elev = mg['node']['topographic__elevation']
elev_r = mg.node_vector_to_raster(elev)

# Clear previous plots
pylab.figure(1)
pylab.close()

# Plot topography
pylab.figure(1)