#mg,_,capacity_out = tl.erode(mg,dt,slopes_at_nodes=max_slope) mg_copy = deepcopy(mg) mg,_ = sde.erode(mg,dt) #print sde.iterations_in_dt #print 'capacity ', np.amax(capacity_out[mg.core_nodes]) #print 'rel sed ', np.nanmax(sed_in[mg.core_nodes]/capacity_out[mg.core_nodes]) if i%100 == 0: print 'loop ', i print 'max_slope', np.amax(mg.at_node['steepest_slope'][mg.core_nodes]) 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'], mg.at_node['flow_receiver']) dists_upstr = prf.get_distances_upstream(mg, len(mg.at_node['steepest_slope']), profile_IDs, mg.at_node['links_to_flow_receiver']) prf.plot_profiles(dists_upstr, profile_IDs, mg.at_node['topographic_elevation']) #mg.update_boundary_nodes() #vid.add_frame(mg, 'topographic_elevation') 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
#note the input arguments here are not totally standardized between modules #mg = diffuse.diffuse(mg, i*dt) mg = lin_diffuse.diffuse(mg, dt) mg = fr.route_flow(grid=mg) mg = sp.erode(mg) ##plot long profiles along channels pylab.figure(6) profile_IDs = prf.channel_nodes(mg, mg.at_node['steepest_slope'], mg.at_node['drainage_area'], mg.at_node['upstream_ID_order'], mg.at_node['flow_receiver']) dists_upstr = prf.get_distances_upstream( mg, len(mg.at_node['steepest_slope']), profile_IDs, mg.at_node['links_to_flow_receiver']) prf.plot_profiles(dists_upstr, profile_IDs, mg.at_node['topographic_elevation']) print 'Completed loop ', i print 'Completed the simulation. Plotting...' #Finalize and plot # Clear previous plots pylab.figure(1) pylab.close() pylab.figure(1) im = imshow_node_grid(mg, 'water_discharges', cmap='PuBu') # display a colored image pylab.figure(2) im = imshow_node_grid(mg, 'topographic_elevation') # display a colored image
#perform the loops: for i in xrange(nt): #mg = diffuse.diffuse(mg, i*dt) mg = lin_diffuse.diffuse(mg, dt) mg = fr.route_flow(grid=mg) mg = sp.erode(mg) ##plot long profiles along channels pylab.figure(6) profile_IDs = prf.channel_nodes(mg, mg.at_node['steepest_slope'], mg.at_node['drainage_area'], mg.at_node['upstream_ID_order'], mg.at_node['flow_receiver']) dists_upstr = prf.get_distances_upstream(mg, len(mg.at_node['steepest_slope']), profile_IDs, mg.at_node['links_to_flow_receiver']) prf.plot_profiles(dists_upstr, profile_IDs, mg.at_node['planet_surface__elevation']) print 'Completed loop ', i print 'Completed the simulation. Plotting...' #Finalize and plot elev = fr.node_water_discharge elev_r = mg.node_vector_to_raster(elev) # Clear previous plots pylab.figure(1) pylab.close() pylab.figure(1) im = pylab.imshow(elev_r, cmap=pylab.cm.RdBu) # display a colored image pylab.colorbar(im)