function [scmean,cumean]=sccumask2(cll,cresw,wap500,lat,coef)

scmean=cll;
scmean(:,:,:)=nan;
cumean=cll;
cumean(:,:,:)=nan;
scfreq=cll;
scfreq(:,:,:)=nan;
cufreq=cll;
cufreq(:,:,:)=nan;
scfreqnorm(1:length(lat))=nan;
cufreqnorm(1:length(lat))=nan;

cll(wap500<0)=nan;
cresw(wap500<0)=nan;

allcld=cll;
yy=isnan(cll);
allcld(yy)=-1;
allcld(allcld>-1)=1;
allcld(allcld<1)=0;

scmask=cll;
thres=coef*nanmean(cll(:));
yy=find(scmask>thres);
scmask(:,:,:)=0;
scmask(yy)=1;

cumask=cll;
yy2=find(cumask<=thres);
cumask(:,:,:)=0;
cumask(yy2)=1;

cutmp=cresw;
cutmp(cumask==0)=nan;
cumean=cutmp;
cufreq=cumask;
sctmp=cresw;
sctmp(scmask==0)=nan;
scmean=sctmp;
scfreq=scmask;

ratiomask=(squeeze(nansum(scmask,3))./squeeze(nansum(allcld,3)));

tmp=squeeze(scfreq);
tmp=squeeze(nansum(nansum(tmp,1),3));
tmp=tmp./nansum(tmp(:));
scfreqnorm(:)=tmp;
clear tmp

tmp=squeeze(cufreq);
tmp=squeeze(nansum(nansum(tmp,1),3));
tmp=tmp./nansum(tmp(:));
cufreqnorm(:)=tmp;
clear tmp

cufreqnorm(cufreqnorm==0)=nan;
scfreqnorm(scfreqnorm==0)=nan;


end