function mn = global_mean(input);

sz=size(input(:,:,1));
mn=ones(sz)*NaN;
for r=1:sz(1);
 for c=1:sz(2);
  cp = input(r,c,:); cp=cp(:); 
   bidx = find(isnan(cp) | cp == 0); cp(bidx)=[];
  if(~isempty(cp))
   mn(r,c)=mean(cp);
  end
end
end

% load landidx_r
% mn(LANDIDX)=LANDIDX*NaN;

