% get_ascend_decend_node Gets ascending/dedcending node Purpose: Create a logical array, the same size as latitude -matrix that indicates whether a pixel is in the ascending mode containing whether a pixel is ascending or not. FORMAT: ascend = get_ascend_decend_node(latitude) IN: Latitude (ungridded (size = [scanline,scanposition])) OUT: ascend (logical). true for ascend, false for descend. Note: 1) Latitude must have the dimensions size = [scanline,scanposition] 2) This is for ungridded data. I.e. the latitude-matrix is a matrix (or vector) read straight from a satellite data file (therfore ungridded) 3) If there is only one latitude scanline or if it's empty, ascend = NaN 4) The node is based on the centre scanposition, i.e for amsub column 45, for CloudSat column 1. That means that the entire scanline will always have the same node 2010-10-13 created by Salomon Eliasson
0001 function ascend = get_ascend_decend_node(latitude) 0002 %% get_ascend_decend_node Gets ascending/dedcending node 0003 % Purpose: Create a logical array, the same size as latitude -matrix that 0004 % indicates whether a pixel is in the ascending mode containing whether a pixel 0005 % is ascending or not. 0006 % 0007 % FORMAT: ascend = get_ascend_decend_node(latitude) 0008 % 0009 % IN: Latitude (ungridded (size = [scanline,scanposition])) 0010 % 0011 % OUT: ascend (logical). true for ascend, false for descend. 0012 % 0013 % Note: 1) Latitude must have the dimensions size = [scanline,scanposition] 0014 % 2) This is for ungridded data. I.e. the latitude-matrix is a matrix (or 0015 % vector) read straight from a satellite data file (therfore ungridded) 0016 % 3) If there is only one latitude scanline or if it's empty, ascend = NaN 0017 % 4) The node is based on the centre scanposition, i.e for amsub column 0018 % 45, for CloudSat column 1. That means that the entire scanline will 0019 % always have the same node 0020 % 0021 % 2010-10-13 created by Salomon Eliasson 0022 0023 lat=latitude(:,round(end/2)); %always a vector 0024 ascend=false(size(latitude)); 0025 0026 if size(latitude,1)<=1 0027 ascend = NaN; 0028 return 0029 end 0030 0031 % this line checks if the next latitude is higher or not (using indexing). 0032 % the second last and last scanlines are set to be equally ascending or 0033 % descending to their neighbouring point 0034 i = 1:length(lat)-1; 0035 ascend(i,:)=repmat(lat(i+1) > lat(i),1,size(ascend,2)); 0036 ascend(end,:) = ascend(end-1,:);