Skip to content

Commit

Permalink
update of readme and few other changes
Browse files Browse the repository at this point in the history
  • Loading branch information
wschwanghart committed Mar 14, 2019
1 parent a0c91e0 commit 49b5d07
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 28 deletions.
39 changes: 21 additions & 18 deletions @GRIDobj/localtopography.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,17 @@
% 'prctile', 'std' (standard deviation)
% 'prc' scalar between 0 and 100 [%]. Only applicable if 'prctile'
% is chosen as 'type'.
% 'N' enable speed improvement for 'max', 'min' and 'range'.
% N must be 0, 4, 6,or 8. When N is greater than 0, the
% disk-shaped structuring element is approximated by a sequence
% of N periodic-line structuring elements. When N equals 0,
% no approximation is used, and the structuring element members
% consist of all pixels whose centers are no greater than R
% away from the origin. If N is not specified, the default
% value is 0.
% 'N' enable speed improvement for 'max', 'min' and 'range'.
% N must be 0, 4, 6,or 8 (default). When N is greater than 0,
% the disk-shaped structuring element is approximated by a
% sequence of N periodic-line structuring elements. When N
% equals 0, no approximation is used, and the structuring
% element members consist of all pixels whose centers are no
% greater than R away from the origin. Choosing N entails a
% trade-off between how well the shape of the disc-shaped
% moving window is approximated and computational efficiency.
% If you choose a large radius, then N=0 can take a while to
% evaluate.
%
% Output arguments
%
Expand Down Expand Up @@ -70,7 +73,7 @@
addOptional(p,'radius',5000,@(x) isscalar(x) && x>DEM.cellsize);

addParamValue(p,'type','range',@(x) ischar(validatestring(x,expectedTypes)));
addParamValue(p,'N',0,@(x) isscalar(x) && ismember(x,[0 4 6 8]));
addParamValue(p,'N',8,@(x) isscalar(x) && ismember(x,[0 4 6 8]));
addParamValue(p,'thin',1,@(x) x>0.1 && x<=1);
addParamValue(p,'prc',90,@(x) x>0 && x<100);

Expand All @@ -91,35 +94,35 @@
switch p.Results.type
case 'max'
% Maximum filter
if flaginan;
if flaginan
dem(INAN) = -inf;
end
H = imdilate(dem,SE);
case 'min'
% Minimum filter
if flaginan;
if flaginan
dem(INAN) = inf;
end
H = imerode(dem,SE);
case 'range'
if flaginan;
if flaginan
dem(INAN) = -inf;
end
H1 = imdilate(dem,SE);
if flaginan;
if flaginan
dem(INAN) = inf;
end
H2 = imerode(dem,SE);
H = H1-H2;
case {'mean','average'}
if flaginan;
if flaginan
[~,L] = bwdist(~INAN,'e');
dem = dem(L);
end
H = fspecial('disk',radiuspx);
H = imfilter(dem,H,'symmetric','same','conv');
case 'median'
if flaginan;
if flaginan
[~,L] = bwdist(~INAN,'e');
dem = dem(L);
end
Expand All @@ -128,7 +131,7 @@
H = ordfilt2(dem,n,H,'symmetric');

case 'prctile'
if flaginan;
if flaginan
[~,L] = bwdist(~INAN,'e');
dem = dem(L);
end
Expand All @@ -137,7 +140,7 @@
H = ordfilt2(dem,n,H,'symmetric');

case 'std'
if flaginan;
if flaginan
[~,L] = bwdist(~INAN,'e');
dem = dem(L);
end
Expand All @@ -147,7 +150,7 @@


% Handle nans
if flaginan;
if flaginan
H(INAN) = nan;
end

Expand Down
10 changes: 5 additions & 5 deletions @STREAMobj/distance.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
%
% Description
%
% This function returns a node attribute list with a distance value for
% This function returns a node-attribute list with a distance value for
% each node in the stream network S. Since distance can be calculated
% in different ways for a channelnetwork, the second input argument
% allows choosing between a number of different distance metrics. If
% lets you choose between a number of different distance metrics. If
% the second input argument S2 is a STREAMobj, distances will be based
% on the distances of S2. Note that S must be a subset of S2 then!
%
% If the second input argument is IX or xy then d will not be a
% node-attribute list, but a vector with as many locations in IX or
% xy.
% If the second input argument is IX or xy then d will not be a
% node-attribute list, but a vector with as many locations in IX or
% xy.
%
% Input arguments
%
Expand Down
4 changes: 2 additions & 2 deletions @STREAMobj/plotc.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
addParameter(p,'xyscale',1,@(x) isscalar(x));
addParameter(p,'xoffset',0,@(x) isscalar(x));
addParameter(p,'yoffset',0,@(x) isscalar(x));
addParameter(p,'linewidth',2);
addParameter(p,'linewidth',1.5);
parse(p,varargin{:});

[x,y,c] = STREAMobj2XY(S,DEM);
Expand All @@ -73,6 +73,6 @@
'facecolor','none',...
'edgecolor','flat',...
'linewidth',p.Results.linewidth);
if nargout == 1;
if nargout == 1
h = ht;
end
5 changes: 4 additions & 1 deletion @STREAMobj/smooth.m
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,10 @@
if ~p.Results.positive
zs = C\b;
else
zs = lsqlin(C,b,[],[],[],[],zeros(nr,1),[]);

options = optimset('Display','off');
zs = lsqlin(C,b,[],[],[],[],zeros(nr,1),[],[],options);

end

case 'movmean'
Expand Down
33 changes: 31 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,44 @@ exchange with GIS software.
When you use TopoToolbox in your work, please reference following
publication:

Schwanghart, W., Scherler, D. (2014): TopoToolbox 2 – MATLAB-based
- Schwanghart, W., Scherler, D. (2014): TopoToolbox 2 – MATLAB-based
software for topographic analysis and modeling in Earth surface sciences.
Earth Surface Dynamics, 2, 1-7. DOI: [10.5194/esurf-2-1-2014](https://dx.doi.org/10.5194/esurf-2-1-2014)

If you are using version 1, then please refer to this publication:

Schwanghart, W., Kuhn, N.J. (2010): TopoToolbox: a set of MATLAB
- Schwanghart, W., Kuhn, N.J. (2010): TopoToolbox: a set of MATLAB
functions for topographic analysis. Environmental Modelling & Software,
25, 770-781. DOI: [10.1016/j.envsoft.2009.12.002](https://dx.doi.org/10.1016/j.envsoft.2009.12.002)

In addition, various models and algorithms used in TopoToolbox have been published in the following articles.

### DEM preprocessing and carving

- Schwanghart, W., Groom, G.B., Kuhn, N.J., Heckrath, G. (2013): Flow network derivation from a high
resolution DEM in a low relief, agrarian landscape. Earth Surface Processes and Landforms, 38,
1576-1586. DOI: [10.1002/esp.3452](https://dx.doi.org/10.1002/esp.3452)

- Schwanghart, W., Scherler, D., 2017. Bumps in river profiles: uncertainty assessment and smoothing
using quantile regression techniques. Earth Surface Dynamics, 5, 821-839. DOI: [10.5194/esurf-5-821-2017](https://doi.org/10.5194/esurf-5-821-2017)

### TopoToolbox Landscape Evolution Modelling (TTLEM)

- Campforts, B., Schwanghart, W., Govers, G. (2017): Accurate simulation of transient
landscape evolution by eliminating numerical diffusion: the TTLEM 1.0 model.
Earth Surface Dynamics, 5, 47-66. DOI: [10.5194/esurf-5-47-2017](https://dx.doi.org/10.5194/esurf-5-47-2017)

### Excess topography

- Blöthe, J.H., Korup, O., Schwanghart, W. (2015): Large landslides lie low: Excess topography in the

### Knickpointfinder

- Stolle, A., Schwanghart, W., Andermann, C., Bernhardt, A., Fort, M., Jansen, J.D., Wittmann, H.,
Merchel, S., Rugel, G., Adhikari, B.R., Korup, O., 2019. Protracted river response to medieval earthquakes.
Earth Surface Processes and Landforms, 44, 331-341. DOI: [10.1002/esp.4517](https://doi.org/10.1002/esp.4517)
(The description here is very terse, yet)

## Getting started

Before working with TopoToolbox the directories and functions must be on the search
Expand All @@ -57,6 +85,7 @@ sections (e.g. `help gradient8` or `help STREAMobj/modify`. An additional
resource for code and examples is the [TopoToolbox blog](https://topotoolbox.wordpress.com).


***
## Version History

### pre 2.3
Expand Down

0 comments on commit 49b5d07

Please sign in to comment.