;***************************************************** ; Find the layers ;find_layer_idx,cutoff,mask_profile,idxb,idxt,numlayer ;***************************************************** pro find_layer_idx_ci_ev,nocloud,reflect_profile,idxs,idxe,$ numlayers ; Get the indexes of cloudy volumes result=where(reflect_profile ge nocloud,count) ; Start with the first layer base idxs=result[0] ; Loop through and get bases and tops j=0 for i=0,count-2 do begin if result[i+1] gt result[i]+1 then begin if j eq 0 then idxe=result[i] else idxe=[idxe,result[i]] idxs=[idxs,result[i+1]] j=j+1 endif endfor if j eq 0 then idxe=result[count-1] else idxe=[idxe,result[count-1]] ; Number of layers numlayers=n_elements(idxs) ;print,result ;print,idxs ;print,idxe return end