function [mnSLATc,mxSLATc,mnSLONc,mxSLONc,nsScV,xsScV]=calXNMVAL(minLAT,maxLAT,minLON,maxLON,SLAT,SLON,ScV,dic,dil)
ia=0;
for ilat=minLAT:dil:maxLAT
%--------------------------------------------------------------------------
    ia=ia+1;
    io=0;
    %----------------------------------------------------------------------
    for ilon=minLON:dil:maxLON
    %----------------------------------------------------------------------
        io=io+1;
        arclenCC = distance('gc',ilat,ilon,SLAT,SLON);
        mScV(ia,io)=nanmean(ScV(arclenCC<=dic/2));
        nScV(ia,io)=nanmin(ScV(arclenCC<=dic/2));
        xScV(ia,io)=nanmax(ScV(arclenCC<=dic/2));
    end
end

% average min/max
% To find min/max circle of average
mnScVc=nanmin(nanmin(mScV))
mxScVc=nanmax(nanmax(mScV))
[inyc,inxc]=find(mScV==mnScVc);
[ixyc,ixxc]=find(mScV==mxScVc);
%------------------------------
mnSLATc=SLAT(inyc,inxc); 
mxSLATc=SLAT(ixyc,ixxc); 
mnSLONc=SLON(inyc,inxc); 
mxSLONc=SLON(ixyc,ixxc); 
%------------------------------
% average min/max datasets
arclenCCn = distance('gc',mnSLATc,mnSLONc,SLAT,SLON);
arclenCCx = distance('gc',mxSLATc,mxSLONc,SLAT,SLON);
nsScV=ScV(arclenCCn<=dic/2); 
xsScV=ScV(arclenCCx<=dic/2); 
%--------------------------------------------------------------------------
% min max min/max
nnScVc=nanmin(nanmin(nScV))
xnScVc=nanmax(nanmax(nScV))
%------------------------------
anScVc=nanmean(reshape(nScV,size(nScV,1)*size(nScV,2),1));
dnScVc=nanmedian(reshape(nScV,size(nScV,1)*size(nScV,2),1));
%-----------------------------------------------------------
xxScVc=nanmax(nanmax(xScV))
nxScVc=nanmin(nanmin(xScV))
%------------------------------
axScVc=nanmean(reshape(xScV,size(xScV,1)*size(xScV,2),1));
dxScVc=nanmedian(reshape(xScV,size(xScV,1)*size(xScV,2),1));

end
%%
