5.0

5.0 | 2 ratings Rate this file 42 downloads (last 30 days) File Size: 292.42 KB File ID: #15818

Upslope area functions

by Steve Eddins

 

03 Aug 2007 (Updated 17 Sep 2009)

Code covered by the BSD License  

Functions for computing and visualizing upslope area, influence map, dependence map

Download Now | Watch this File

File Information
Description

A collection of functions for calculating the upslope area and related measurements for a digital elevation model (DEM).

Based on the method of Tarboton.

See also the upslope area postings on my image processing blog, March-August 2007, http://blogs.mathworks.com/steve.

Requires Image Processing Toolbox.

Functions include dem_flow, dependence_map, facet_flow, fill_sinks, flow_matrix, influence_map, pixel_flow, postprocess_plateaus, upslope_area, vis_dem_flow, and vis_map.

Includes a sample DEM data set.

Required Products Image Processing Toolbox
MATLAB release MATLAB 7.4 (R2007a)
Zip File Content  
Other Files
license.txt,
upslope/border_nans.m,
upslope/Contents.m,
upslope/dem_flow.m,
upslope/dependence_map.m,
upslope/facet_flow.m,
upslope/fill_sinks.m,
upslope/flow_matrix.m,
upslope/influence_map.m,
upslope/milford_ma_dem.mat,
upslope/pixel_flow.m,
upslope/postprocess_plateaus.m,
upslope/Readme.txt,
upslope/screenshot.jpg,
upslope/tests/Readme.txt,
upslope/tests/test_border_nans.m,
upslope/tests/test_dem_flow.m,
upslope/tests/test_dependence_map.m,
upslope/tests/test_facet_flow.m,
upslope/tests/test_fill_sinks.m,
upslope/tests/test_flow_matrix.m,
upslope/tests/test_influence_map.m,
upslope/tests/test_pixel_flow.m,
upslope/tests/test_postprocess_plateaus.m,
upslope/tests/test_upslope_area.m,
upslope/tests/test_vis_dem_flow.m,
upslope/tests/test_vis_map.m,
upslope/upslope_area.m,
upslope/vis_dem_flow.m,
upslope/vis_map.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
19 Aug 2007 Wolfgang Schwanghart

Hi Steve,

great contribution! Users of older Matlab versions (R14) need to replace the function hypot(s1,s2) by
s = sqrt(abs(s1).^2 + abs(s2).^2)

One critique: The functions don't handle NaNs.

Best regards, Wolfgang

20 Aug 2007 Steve Eddins

Hi Wolfgang,

Do you have opinion about should be done with NaNs?

Thanks, Steve

20 Aug 2007 Wolfgang Schwanghart

Hi Steve,

areas of interest to geographers often are catchments which commonly have irregular shape. Beyond the watersheds there is often a lack of data. Hence, these values outside the catchment are NaNs. While NaNs inside the catchment may be interpolated the NaNs outside can merely be extrapolated.

Hence, I tried following. I replaced the NaNs in the DEM by -Inf. That works except that it produces an erroneous flow direction on the watershed pixels.

Best regards,
Wolfgang

18 Jul 2008 Felix Hebeler

After implementing Tarbotons Dinf algorithm for calculating flow directions I finally stumpled upon your toolbox, which is a lot faster. Thanks for the implementation, maybe if you add a keyword 'flow direction' it could save some other users some work ;-)

23 Oct 2009 Charlie seviour seviour

How do you combine this script with flow data?
If the flow was the same for each pixel I could simply multiple the upslope area by a constant. Since this is not the case I need to find a way of inputting my flow data as it calculates the up slope area.

Can anyone enlighten me,
Charlie

Please login to add a comment or rating.
Updates
07 Aug 2007

Based on feedback I've received, I removed the "plateau flattening" step from the upslope area computation. This step is now provided as a separate function.

02 Oct 2007

Version 1.2. Alter handling of border-connected NaN pixels based on feedback from Wolfgang and others.

18 Mar 2008

Version 1.3. Corrected border NaN computation for dependence_map and influence_map.

25 Sep 2008

Version 1.4 - modified fill_sinks.m to fill using 8-connectivity instead of 4-connectivity.

02 Oct 2008

Added flow direction keywords as suggested by reviewer Felix. Thanks!

10 Mar 2009

Version 1.4.1
=============
10-Mar-2009

* Fixed M-file help typo in dependence_map.m.

* Allowed input matrix E to contain NaNs in postprocess_plateaus.m.

* Added unit test directory.

26 May 2009

Version 1.4.2 - Added sample DEM data source information to Contents.m. No functional changes in this version.

17 Sep 2009

Use assertElementsAlmostEqual in unit tests.

Tag Activity for this File
Tag Applied By Date/Time
upslope area Steve Eddins 22 Oct 2008 09:21:55
hydrology Steve Eddins 22 Oct 2008 09:21:55
dem Steve Eddins 22 Oct 2008 09:21:55
earth sciences Steve Eddins 22 Oct 2008 09:21:55
flow direction Steve Eddins 23 Oct 2008 10:33:17
hi Charlie seviour seviour 23 Oct 2009 09:23:03
very nice work i tried to make one myself but it didnt work Charlie seviour seviour 23 Oct 2009 09:23:03
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com