


PURPOSE: colfilt function to calculate the mean of the highest 30% altitude values. Returns NaN if more than 50% of input cells are NaN, else removes NaN cells for calculation. See also: colfilt() Felix Hebeler, Geography Dept., University Zurich, Jan 2007.


0001 function [r] = hypsom_ut(X) 0002 % PURPOSE: colfilt function to calculate the mean of the highest 30% 0003 % altitude values. Returns NaN if more than 50% of input cells are NaN, 0004 % else removes NaN cells for calculation. 0005 % 0006 % See also: colfilt() 0007 % 0008 % Felix Hebeler, Geography Dept., University Zurich, Jan 2007. 0009 0010 %r=X(ceil(size(X,1)/2),:); 0011 n=sum(isnan(X(:))); 0012 if n>0 0013 if n>=numel(X)/2 0014 r=nan; 0015 return 0016 else 0017 X(isnan(X))=[]; 0018 end 0019 end 0020 r=quantile(X(:),0.85); 0021