Code covered by the BSD License  

Highlights from
Upslope area functions

5.0 | 3 ratings Rate this file 17 Downloads (last 30 days) File Size: 292 KB File ID: #15818
image thumbnail

Upslope area functions


Steve Eddins (view profile)


03 Aug 2007 (Updated )

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

| Watch this File

File Information

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,

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)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
08 Jul 2010 Steve Eddins

Steve Eddins (view profile)

Bard, I am not doing any active algorithm development in this area right now, and I have no plans to enhance this submission. You might want to take a look at Wolfgang Schwanghart's TopoToolbox:

Comment only
07 Jul 2010 Bard R.

Great algorithm, how would modify it to include flow length as well?

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,

Comment only
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 ;-)

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,

Comment only
20 Aug 2007 Steve Eddins

Hi Wolfgang,

Do you have opinion about should be done with NaNs?

Thanks, Steve

Comment only
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

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.

10 Mar 2009

Version 1.4.1

* 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.

Contact us