Skip to content

Commit

Permalink
few corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
wschwanghart committed May 1, 2018
1 parent d375208 commit ebfe15c
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 115 deletions.
110 changes: 55 additions & 55 deletions @FLOWobj/validatealignment.m
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
function tf = validatealignment(FD,G)

%VALIDATEALIGNMENT validates whether instances of FLOWobj and GRIDobj are spatially aligned
%
% Syntax
%
% tf = validatealignment(FD,G)
% validatealignment(FD,G)
%
% Description
%
% returns true if instances of FLOWobj and GRIDobj are spatially
% aligned. When the function returns false and is called without
% output argument, the function returns an error message.
%
% Input arguments
%
% FD instance of FLOWobj
% G instance of GRIDobj
%
% Output arguments
%
% tf true or false
%
% See also: FLOWobj, GRIDobj
%
% Author: Wolfgang Schwanghart (w.schwanghart[at]geo.uni-potsdam.de)
% Date: 4. March, 2016

% check if geometric properties of a FLOWobj and GRIDobj instance are equal
if isa(G,'GRIDobj');
TF = isequal(FD.size,G.size) && isequal(FD.refmat,G.refmat);
else
TF = isequal(FD.size,size(G));
end

if nargout == 1;
tf = TF;
else
if ~TF
if isa(G,'GRIDobj')
error('TopoToolbox:incorrectinput',...
['FLOWobj and GRIDobj do not align each other. Make sure that \n' ...
'both instances have the same spatial reference. Both variables \n' ...
'are deemed to have the same reference if their properties ''size'' \n' ...
'and ''refmat'' are both equal.']);
else
error('TopoToolbox:incorrectinput',...
['FLOWobj and input matrix do not align each other. Make sure that \n' ...
'both instances have the same spatial reference. Both variables \n' ...
'are deemed to have the same reference if the FLOWobj''s property \n' ...
'''size'' and size(A) is equal.']);
end
end
end
function tf = validatealignment(FD,G)

%VALIDATEALIGNMENT validates whether instances of FLOWobj and GRIDobj are spatially aligned
%
% Syntax
%
% tf = validatealignment(FD,G)
% validatealignment(FD,G)
%
% Description
%
% returns true if instances of FLOWobj and GRIDobj are spatially
% aligned. When the function returns false and is called without
% output argument, the function returns an error message.
%
% Input arguments
%
% FD instance of FLOWobj
% G instance of GRIDobj
%
% Output arguments
%
% tf true or false
%
% See also: FLOWobj, GRIDobj
%
% Author: Wolfgang Schwanghart (w.schwanghart[at]geo.uni-potsdam.de)
% Date: 4. March, 2016

% check if geometric properties of a FLOWobj and GRIDobj instance are equal
if isa(G,'GRIDobj')
TF = isequal(FD.size,G.size) && isequal(FD.refmat,G.refmat);
else
TF = isequal(FD.size,size(G));
end

if nargout == 1
tf = TF;
else
if ~TF
if isa(G,'GRIDobj')
error('TopoToolbox:incorrectinput',...
['FLOWobj and GRIDobj do not align each other. Make sure that \n' ...
'both instances have the same spatial reference. Both variables \n' ...
'are deemed to have the same reference if their properties ''size'' \n' ...
'and ''refmat'' are both equal.']);
else
error('TopoToolbox:incorrectinput',...
['FLOWobj and input matrix do not align each other. Make sure that \n' ...
'both instances have the same spatial reference. Both variables \n' ...
'are deemed to have the same reference if the FLOWobj''s property \n' ...
'''size'' and size(A) is equal.']);
end
end
end
3 changes: 2 additions & 1 deletion @GRIDobj/fillsinks.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
% DEMfs = fillsinks(DEM)
% DEMfs = fillsinks(DEM,maxdepth)
% DEMfs = fillsinks(DEM,sinks)
% DEMfs = fillsinks(DEM,sinks,option)
%
% Description
%
Expand Down Expand Up @@ -153,7 +154,7 @@
end

% nans in the dem are set to nan again
try
if isfloat(demfs)
demfs(Inan) = nan;
end
DEM.Z = demfs;
2 changes: 1 addition & 1 deletion @GRIDobj/imageschs.m
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@

%% Default values can be changed here
% -----------------------------------
defaultcolormap = 'jet';
defaultcolormap = 'landcolor';
defaulttruecolor = [0 1 0];
defaultfalsecolor = [1 1 1];
defaultnancolor = [1 1 1];
Expand Down
110 changes: 55 additions & 55 deletions @GRIDobj/validatealignment.m
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
function tf = validatealignment(GRID1,GRID2)

%VALIDATEALIGNMENT validates whether instances of GRIDobj are spatially aligned
%
% Syntax
%
% tf = validatealignment(GRID1,GRID2)
% validatealignment(GRID1,GRID2)
%
% Description
%
% returns true if instances of GRIDobj are spatially
% aligned. When the function returns false and is called without
% output argument, the function returns an error message.
%
% Input arguments
%
% GRID1 instance of GRIDobj
% GRID2 instance of GRIDobj or matrix
%
% Output arguments
%
% tf true or false
%
% See also: GRIDobj
%
% Author: Wolfgang Schwanghart (w.schwanghart[at]geo.uni-potsdam.de)
% Date: 8. August, 2015

% check if geometric properties of a FLOWobj and GRIDobj instance are equal
if isa(GRID2,'GRIDobj');
TF = isequal(GRID1.size,GRID2.size) && isequal(GRID1.refmat,GRID2.refmat);
else
TF = isequal(GRID1.size,size(GRID2));
end

if nargout == 1;
tf = TF;
else
if ~TF
if isa(GRID2,'GRIDobj')
error('TopoToolbox:incorrectinput',...
['The two GRIDobj instances do not align each other. Make sure that \n' ...
'both instances have the same spatial reference. Both variables \n' ...
'are deemed to have the same reference if their properties ''size'' \n' ...
'and ''refmat'' are both equal.']);
else
error('TopoToolbox:incorrectinput',...
['GRIDobj and input matrix do not align each other. Make sure that \n' ...
'both instances have the same spatial reference. Both variables \n' ...
'are deemed to have the same reference if the GRIDobj''s property \n' ...
'''size'' and size(A) is equal.']);
end
end
end
function tf = validatealignment(GRID1,GRID2)

%VALIDATEALIGNMENT validates whether instances of GRIDobj are spatially aligned
%
% Syntax
%
% tf = validatealignment(GRID1,GRID2)
% validatealignment(GRID1,GRID2)
%
% Description
%
% returns true if instances of GRIDobj are spatially
% aligned. When the function returns false and is called without
% output argument, the function returns an error message.
%
% Input arguments
%
% GRID1 instance of GRIDobj
% GRID2 instance of GRIDobj or matrix
%
% Output arguments
%
% tf true or false
%
% See also: GRIDobj
%
% Author: Wolfgang Schwanghart (w.schwanghart[at]geo.uni-potsdam.de)
% Date: 8. August, 2015

% check if geometric properties of a FLOWobj and GRIDobj instance are equal
if isa(GRID2,'GRIDobj');
TF = isequal(GRID1.size,GRID2.size) && isequal(GRID1.refmat,GRID2.refmat);
else
TF = isequal(GRID1.size,size(GRID2));
end

if nargout == 1;
tf = TF;
else
if ~TF
if isa(GRID2,'GRIDobj')
error('TopoToolbox:incorrectinput',...
['The two GRIDobj instances do not align each other. Make sure that \n' ...
'both instances have the same spatial reference. Both variables \n' ...
'are deemed to have the same reference if their properties ''size'' \n' ...
'and ''refmat'' are both equal.']);
else
error('TopoToolbox:incorrectinput',...
['GRIDobj and input matrix do not align each other. Make sure that \n' ...
'both instances have the same spatial reference. Both variables \n' ...
'are deemed to have the same reference if the GRIDobj''s property \n' ...
'''size'' and size(A) is equal.']);
end
end
end
6 changes: 3 additions & 3 deletions @STREAMobj/ksn.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@
% Date: 18. August, 2017

narginchk(3,4);
if nargin == 3;
if nargin == 3
theta = 0.45;
end

% get node attribute list with elevation values
if isa(DEM,'GRIDobj')
validatealignment(S,DEM);
z = double(getnal(S,DEM));
elseif isnal(S,DEM);
elseif isnal(S,DEM)
z = double(DEM);
else
error('Imcompatible format of second input argument')
Expand All @@ -66,7 +66,7 @@
if isa(A,'GRIDobj')
validatealignment(S,A);
a = double(getnal(S,A));
elseif isnal(S,DEM);
elseif isnal(S,DEM)
a = double(DEM);
else
error('Imcompatible format of second input argument')
Expand Down

0 comments on commit ebfe15c

Please sign in to comment.