Skip to content

Commit

Permalink
Enhanced backwards compatibility by removing calls 'all' dimension fo…
Browse files Browse the repository at this point in the history
…r any and all
  • Loading branch information
JonKing93 committed Mar 11, 2021
1 parent 2e18c6c commit e658c07
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pdsi.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
args = {T, P, years, lats, awcs, awcu, cafecYears, dim};
names = {'T','P','years','lats','awcs','awcu','calibrationYears','dim'};
for k = 1:numel(args)
assert(isnumeric(args{k}) & ~any(isnan(args{k}),'all') & ~any(isinf(args{k}),'all') & all(isreal(args{k}),'all'), ...
assert(isnumeric(args{k}) & ~any(isnan(args{k}(:))) & ~any(isinf(args{k}(:))) & all(isreal(args{k}(:))), ...
sprintf('%s must be numeric and cannot contain NaN, Inf, or complex values', names{k}));
end

Expand All @@ -108,10 +108,10 @@
end

% Error check bounded quantities
assert(all(P>=0,'all'), 'P cannot have values less than 0');
assert(all(lats>=-90 & lats<=90, 'all'), 'Values in lats must be between -90 and 90 (inclusive).');
assert(all(awcs>=0, 'all'), 'awcs cannot have values less than 0');
assert(all(awcu>=0, 'all'), 'awcu cannot have values less than 0');
assert(all(P(:)>=0), 'P cannot have values less than 0');
assert(all(lats(:)>=-90 & lats<=90), 'Values in lats must be between -90 and 90 (inclusive).');
assert(all(awcs(:)>=0), 'awcs cannot have values less than 0');
assert(all(awcu(:)>=0), 'awcu cannot have values less than 0');

% Error check year args
assert(years(2)>=years(1), 'The second element of years cannot be smaller than the first element');
Expand Down

0 comments on commit e658c07

Please sign in to comment.