print 'Running ...' #instantiate the components: fr = FlowRouter(mg) sp = SPEroder(mg, input_file) vid = VideoPlotter(mg, data_centering='node') time_on = time() #perform the loops: for i in xrange(nt): print 'loop ', i mg['node']['planet_surface__elevation'][mg.core_nodes] += uplift_per_step mg = fr.route_flow(grid=mg) mg = sp.erode(mg) #vid.add_frame(mg, 'planet_surface__elevation') vid.add_frame(mg, mg.hillshade(alt=15.), cmap='gray') print 'Completed the simulation. Plotting...' time_off = time() #Finalize and plot elev = mg['node']['planet_surface__elevation'] #imshow.imshow_node_grid(mg, elev) print('Done.') print 'Time: ', time_off-time_on #pylab.show()
#reinstantiate the components with the new grid fr = FlowRouter(mg) sp = StreamPowerEroder(mg, './drive_sp_params.txt') fsp = Fsc(mg, './drive_sp_params.txt') #load the Fastscape module too, to allow direct comparison fsp = Fsc(mg, './drive_sp_params.txt') vid = VideoPlotter(mg, data_centering='node', step=2.5) #perturb: time_to_run = 50. dt=0.5 elapsed_time = 0. #total time in simulation while elapsed_time < time_to_run: print(elapsed_time) vid.add_frame(mg, 'topographic__elevation', elapsed_time) if elapsed_time+dt>time_to_run: print("Short step!") dt = time_to_run - elapsed_time mg = fr.route_flow() #print 'Area: ', numpy.max(mg.at_node['drainage_area']) mg = fsp.erode(mg) #mg,_,_ = sp.erode(mg, dt, node_drainage_areas='drainage_area', slopes_at_nodes='topographic__steepest_slope') #plot long profiles along channels if numpy.allclose(elapsed_time%1.,0.) or numpy.allclose(elapsed_time%1.,1.): pylab.figure("long_profiles") profile_IDs = prf.channel_nodes(mg, mg.at_node['topographic__steepest_slope'], mg.at_node['drainage_area'], mg.at_node['flow_receiver']) dists_upstr = prf.get_distances_upstream(mg, len(mg.at_node['topographic__steepest_slope']), profile_IDs, mg.at_node['links_to_flow_receiver'])
print("Running ...") # instantiate the components: fr = FlowRouter(mg) sp = SPEroder(mg, input_file) vid = VideoPlotter(mg, data_centering="node") time_on = time() # perform the loops: for i in xrange(nt): print("loop ", i) mg["node"]["topographic__elevation"][mg.core_nodes] += uplift_per_step mg = fr.route_flow() mg = sp.erode(mg) # vid.add_frame(mg, 'topographic__elevation') vid.add_frame(mg, mg.hillshade(alt=15.0), cmap="gray") print("Completed the simulation. Plotting...") time_off = time() # Finalize and plot elev = mg["node"]["topographic__elevation"] # imshow.imshow_node_grid(mg, elev) print("Done.") print("Time: ", time_off - time_on) # pylab.show()
print 'Running ...' #instantiate the components: fr = FlowRouter(mg) sp = SPEroder(mg, input_file) vid = VideoPlotter(mg, data_centering='node') time_on = time() #perform the loops: for i in xrange(nt): print 'loop ', i mg['node']['topographic_elevation'][mg.core_nodes] += uplift_per_step mg = fr.route_flow(grid=mg) mg = sp.erode(mg) #vid.add_frame(mg, 'topographic_elevation') vid.add_frame(mg, mg.hillshade(alt=15.), cmap='gray') print 'Completed the simulation. Plotting...' time_off = time() #Finalize and plot elev = mg['node']['topographic_elevation'] #imshow.imshow_node_grid(mg, elev) print('Done.') print 'Time: ', time_off - time_on #pylab.show()
#reinstantiate the components with the new grid fr = FlowRouter(mg) sp = StreamPowerEroder(mg, './drive_sp_params.txt') fsp = Fsc(mg, './drive_sp_params.txt') #load the Fastscape module too, to allow direct comparison fsp = Fsc(mg, './drive_sp_params.txt') vid = VideoPlotter(mg, data_centering='node', step=2.5) #perturb: time_to_run = 50. dt = 0.5 elapsed_time = 0. #total time in simulation while elapsed_time < time_to_run: print elapsed_time vid.add_frame(mg, 'topographic_elevation', elapsed_time) if elapsed_time + dt > time_to_run: print "Short step!" dt = time_to_run - elapsed_time mg = fr.route_flow(grid=mg) #print 'Area: ', numpy.max(mg.at_node['drainage_area']) mg = fsp.erode(mg) #mg,_,_ = sp.erode(mg, dt, node_drainage_areas='drainage_area', slopes_at_nodes='steepest_slope') #plot long profiles along channels if numpy.allclose(elapsed_time % 1., 0.) or numpy.allclose( elapsed_time % 1., 1.): pylab.figure("long_profiles") profile_IDs = prf.channel_nodes(mg, mg.at_node['steepest_slope'], mg.at_node['drainage_area'], mg.at_node['upstream_ID_order'],