Skip to content

Commit

Permalink
projectGRIDobj -> project
Browse files Browse the repository at this point in the history
  • Loading branch information
wschwanghart committed Dec 4, 2018
1 parent 75bcc63 commit 6ec1229
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 108 deletions.
20 changes: 19 additions & 1 deletion @FLOWobj/drainagebasins.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,24 @@
% D = drainagebasins(FD,S,3);
% imageschs(DEM,D)
%
% Example 3: map values to drainage basins (e.g. basin wide erosion rates).
%
% DEM = GRIDobj('srtm_bigtujunga30m_utm11.tif');
% FD = FLOWobj(DEM,'preprocess','carve');
% S = STREAMobj(FD,'minarea',1000);
% IX = randlocs(S,10);
% erosrate = rand(size(IX));
% D = drainagebasins(FD,IX);
% E = GRIDobj(DEM)*nan;
% E.Z(D.Z~=0) = erosrate(D.Z(D.Z~=0));
% imageschs(DEM,E)
%
%
% See also: FLOWobj, GRIDobj/snap2stream, FLOWobj/streamorder,
% GRIDobj/shufflelabel
%
% Author: Wolfgang Schwanghart (w.schwanghart[at]geo.uni-potsdam.de)
% Date: 30. September, 2016
% Date: 3. December, 2018



Expand All @@ -83,6 +94,8 @@

% 30/9/2016: bug removed when called with 2 or 3 outputs

% 3/12/2018: new example and some additional error checking

narginchk(1,3);

switch lower(FD.type)
Expand Down Expand Up @@ -141,6 +154,11 @@
IX = coord2ind(FD,varargin{1},varargin{2});
end
end

if any(IX<1) || any(IX>prod(FD.size))
error('TopoToolbox:drainagebasins',...
'Some of the locations are outside the grid boundaries.')
end

D = zeros(FD.size,'uint32');
D(IX) = cast(1:numel(IX),'uint32');
Expand Down
4 changes: 2 additions & 2 deletions @GRIDobj/project.m
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
% true (default) or false. If true, the OUT grid will be
% spatially aligned with TARGET. This means, they have
% the same extent and spatial alignment of cells. If
% 'align, true then setting the resolution 'res' will
% 'align', true then setting the resolution 'res' will
% have no effect.
%
% Output arguments
%
% OUT instance of GRIDobj
%
%
% See also: GRIDobj, reproject2utm
% See also: GRIDobj, reproject2utm, egm96heights
%
% Author: Dirk Scherler (scherler[at]gfz-potsdam.de) and Wolfgang
% Schwanghart (w.schwanghart[at]geo.uni-potsdam.de)
Expand Down
105 changes: 0 additions & 105 deletions @GRIDobj/projectGRIDobj.m

This file was deleted.

2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ resource for code and examples is the [TopoToolbox blog](https://topotoolbox.word
- new function: STREAMobj/nal2nal
- new function: GRIDobj/GRIDobj2im
- new function: GRIDobj/getextent
- renamed GRIDobj/project2GRIDobj to GRIDobj/project. In addition, the function has
a number of new functionalities.
- changes to readopentopo, getcoordinates, getoutline, polygon2GRIDobj, line2GRIDobj
- new function: hydrosheds2FLOWobj (see in IOtools)
- new function: egm96heights including the grid ww15mgh.grd that contains global geoid
Expand Down

0 comments on commit 6ec1229

Please sign in to comment.