How to use the landlab.plot.imshow.imshow_node_grid function in landlab

To help you get started, we’ve selected a few landlab examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github landlab / landlab / landlab / examples / diffusion_driver.py View on Github external
im = pylab.plot(mg.dx * np.arange(nrows), elev_r[:, int(ncols // 2)])

    print('Completed loop ', i)

print('Completed the simulation. Plotting...')

# Finalize and plot:
# put a title on figure 4
pylab.figure(4)
pylab.title('N-S cross_section, linear diffusion')
pylab.xlabel('Distance')
pylab.ylabel('Elevation')

# figure 5 is the map of the final elevations
pylab.figure(5)
imshow_node_grid(mg, 'topographic__elevation')

# superpose this final form onto figure 3:
pylab.figure(3)
# turn the 1-D array of elevation values into a spatially accurate 2-D
# gridded format, for plotting
elev_r = mg.node_vector_to_raster(mg['node']['topographic__elevation'])
im = pylab.plot(mg.dx * np.arange(nrows), elev_r[:, int(ncols // 2)])
pylab.xlabel('Distance')
pylab.ylabel('Elevation')

pylab.show()  # this line displays all of the figures you've issued plot commands for, since you last called show()
github landlab / landlab / landlab / components / flow_routing / examples / test_lake_mapper.py View on Github external
z += np.random.rand(nx*ny)/1000.

mg.add_field('node', 'topographic__elevation', z, copy=False)

fr = FlowAccumulator(mg, flow_director='D8')
lf = DepressionFinderAndRouter(mg)

fr.run_one_step()

figure('old drainage area')
imshow_node_grid(mg, 'drainage_area')

lf.map_depressions(pits=mg.at_node['flow__sink_flag'])

figure('depression depth')
imshow_node_grid(mg, 'depression__depth')

figure('new drainage area')
imshow_node_grid(mg, 'drainage_area')
github landlab / landlab / landlab / components / potentiality_flowrouting / examples / drive_pot_fr_coupled2.py View on Github external
out=mg.at_link[
                                        'water__discharge'])
    # map_link_end_node_max_value_to_link(mg, 'water__discharge')
    kd_link = 1.e6*mg.at_link['water__discharge'][mg.active_links]
    qs = -kd_link*g
    dqsdx = mg.calculate_flux_divergence_at_nodes(qs)
    dzdt = -dqsdx
    mg.at_node['topographic__elevation'][interior_nodes] += dzdt[interior_nodes]*dt
    if i%50==0:
        print('loop '+str(i))
        section_downfan.append(mg.node_vector_to_raster(mg.at_node['topographic__elevation'])[1:,section_col].copy())

figure(1)
imshow_node_grid(mg, 'topographic__elevation')
figure(2)
imshow_node_grid(mg, 'water__depth')
figure(3)
imshow_node_grid(mg, 'water__discharge', cmap='Blues_r')
figure(4)
for i in range(len(section_downfan)):
    plot(section_downfan[i], '-')
github landlab / landlab / landlab / examples / coupled_driver.py View on Github external
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

elev = mg['node']['topographic_elevation']
elev_r = mg.node_vector_to_raster(elev)
pylab.figure(3)
im = pylab.plot(mg.dx*np.arange(nrows), elev_r[:,int(ncols//2)])
pylab.title('N-S cross_section')

pylab.figure(4)
im = pylab.plot(mg.dx*np.arange(ncols), elev_r[int(nrows//4),:])
pylab.title('E-W cross_section')

drainage_areas = mg['node']['drainage_area'][mg.get_interior_nodes()]
steepest_slopes = mg['node']['steepest_slope'][mg.get_interior_nodes()]
pylab.figure(5)
pylab.loglog(drainage_areas, steepest_slopes, 'x')
pylab.xlabel('Upstream drainage area, m^2')
github landlab / landlab / landlab / components / stream_power / examples / simple_sp_driver.py View on Github external
print('Elapsed time: ', time_off-time_on)

time_off = time.time()
print('Elapsed time: ', time_off-time_on)

#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)
im = imshow_node_grid(mg, 'topographic__elevation')  # display a colored image
print(elev_r)

pylab.figure(2)
im = pylab.plot(dx*numpy.arange(nrows), elev_r[:,int(ncols//2)])  # display a colored image
pylab.title('Vertical cross section')

# Plot topography
#pylab.figure(1)
#im = imshow_node_grid(mg, 'topographic_elevation')  # display a colored image
#print elev_r

pylab.show()

print('Done.')
github landlab / landlab / landlab / components / stream_power / examples / perturb_sp_storms.py View on Github external
#add uplift
        mg.at_node['topographic__elevation'][mg.core_nodes] += 5.*uplift*interval_duration

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

# Clear previous plots
pylab.figure("topo")
pylab.close()

# Plot topography
pylab.figure("topo")
#im = pylab.imshow(elev_r, cmap=pylab.cm.RdBu)  # display a colored image
im = llplot.imshow_node_grid(mg, 'topographic__elevation')
#print elev_r
#pylab.colorbar(im)
#pylab.title('Topography')

pylab.figure("Xsec")
im = pylab.plot(dx*numpy.arange(nrows), elev_r[:,int(ncols//2)])  # display a colored image
pylab.title('Vertical cross section')

pylab.figure("Slope-Area")
im = pylab.loglog(mg.at_node['drainage_area'], mg.at_node['topographic__steepest_slope'],'.')
pylab.title('Slope-Area')

pylab.show()

print('Done.')
github landlab / landlab / landlab / examples / coupled_driver.py View on Github external
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

elev = mg['node']['topographic_elevation']
elev_r = mg.node_vector_to_raster(elev)
pylab.figure(3)
im = pylab.plot(mg.dx*np.arange(nrows), elev_r[:,int(ncols//2)])
pylab.title('N-S cross_section')

pylab.figure(4)
im = pylab.plot(mg.dx*np.arange(ncols), elev_r[int(nrows//4),:])
pylab.title('E-W cross_section')

drainage_areas = mg['node']['drainage_area'][mg.get_interior_nodes()]
steepest_slopes = mg['node']['steepest_slope'][mg.get_interior_nodes()]
github landlab / landlab / landlab / components / potentiality_flowrouting / examples / drive_pot_fr_coupled3.py View on Github external
g = mg.calculate_gradients_at_active_links(mg.at_node['topographic__elevation'])
    mg.map_max_of_link_nodes_to_link('water__volume_flux_magnitude',
                                     out=mg.at_link[
                                        'water__volume_flux_magnitude'])
    # map_link_end_node_max_value_to_link(mg, 'water__volume_flux_magnitude')
    kd_link = 1.e6*mg.at_link['water__volume_flux_magnitude'][mg.active_links]
    qs = -kd_link*g
    dqsdx = mg.calculate_flux_divergence_at_nodes(qs)
    dzdt = -dqsdx
    mg.at_node['topographic__elevation'][interior_nodes] += dzdt[interior_nodes]*dt
    if i%50==0:
        print('loop '+str(i))
        section_downfan.append(mg.node_vector_to_raster(mg.at_node['topographic__elevation'])[1:,section_col].copy())

figure(1)
imshow_node_grid(mg, 'topographic__elevation')
figure(2)
imshow_node_grid(mg, mg.hillshade(), cmap='bone')
figure(3)
imshow_node_grid(mg, 'water__volume_flux_magnitude', cmap='Blues_r')
figure(4)
for i in range(len(section_downfan)):
    plot(section_downfan[i], '-')
github landlab / landlab / landlab / components / potentiality_flowrouting / examples / drive_pot_fr_coupled3b.py View on Github external
out=mg.at_link[
                                        'water__volume_flux_magnitude'])
    # map_link_end_node_max_value_to_link(mg, 'water__volume_flux_magnitude')
    kd_link = 1.e6*mg.at_link['water__volume_flux_magnitude'][mg.active_links]
    qs = -kd_link*g
    dqsdx = mg.calculate_flux_divergence_at_nodes(qs)
    dzdt = -dqsdx
    mg.at_node['topographic__elevation'][interior_nodes] += dzdt[interior_nodes]*dt
    if i%50==0:
        print('loop '+str(i))
        section_downfan.append(mg.node_vector_to_raster(mg.at_node['topographic__elevation'])[1:,section_col].copy())

figure(1)
imshow_node_grid(mg, 'topographic__elevation')
figure(2)
imshow_node_grid(mg, mg.hillshade(), cmap='bone')
figure(3)
imshow_node_grid(mg, 'water__volume_flux_magnitude', cmap='Blues_r')
figure(4)
for i in range(len(section_downfan)):
    plot(section_downfan[i], '-')
github landlab / landlab / landlab / components / stream_power / examples / perturb_sp_driver.py View on Github external
elapsed_time += dt

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

#vid.produce_video()

# Clear previous plots
pylab.figure("topo")
pylab.close()

# Plot topography
pylab.figure("topo")
#im = pylab.imshow(elev_r, cmap=pylab.cm.RdBu)  # display a colored image
im = llplot.imshow_node_grid(mg, elev)
#print elev_r
#pylab.colorbar(im)
#pylab.title('Topography')

pylab.figure("Xsec")
im = pylab.plot(dx*numpy.arange(nrows), elev_r[:,int(ncols//2)])  # display a colored image
pylab.title('Vertical cross section')

pylab.figure("Slope-Area")
im = pylab.loglog(mg.at_node['drainage_area'], mg.at_node['topographic__steepest_slope'],'.')
pylab.title('Slope-Area')

pylab.show()

print('Done.')