Beispiel #1
0
        private static void NdviLstPCStat(List <float> ndviList, out float minLst, out float maxLst, ArgumentItem lstArgItem, int LstFreq)
        {
            minLst = maxLst = 0;
            int                     length     = ndviList.Count;
            List <float>            resultTemp = new List <float>();
            Dictionary <float, int> freqDic    = new Dictionary <float, int>();
            bool                    isEnough   = false;

            for (int i = 0; i < length; i++)
            {
                if (!ValidValueHelper.IsVaild(ndviList[i], lstArgItem))
                {
                    continue;
                }
                if (!freqDic.ContainsKey(ndviList[i]))
                {
                    freqDic.Add(ndviList[i], 0);
                }
                freqDic[ndviList[i]] += 1;
                if (!isEnough && freqDic[ndviList[i]] > LstFreq)
                {
                    minLst   = ndviList[i];
                    isEnough = true;
                }
                if (freqDic[ndviList[i]] > LstFreq)
                {
                    maxLst = ndviList[i];
                }
            }
        }
Beispiel #2
0
        private static DryWetEdgeArgs DryWetEdgesArgsCalc(TVDIUCArgs ucArgs, NdviList[] NDVIHistograms)
        {
            List <Samples> minData    = new List <Samples>();
            List <Samples> maxData    = new List <Samples>();
            TVDIParaClass  tvdiP      = ucArgs.TVDIParas;
            ArgumentItem   ndviArgs   = tvdiP.NdviFile;
            int            ndviCloudy = ndviArgs.Cloudy;
            ArgumentItem   lstArgs    = tvdiP.LstFile;

            try
            {
                int rangeSize = (int)Math.Ceiling((double)(ndviArgs.Max - ndviArgs.Min) / tvdiP.Length);//区间个数
                if (rangeSize == 0)
                {
                    return(null);
                }
                int   key    = 0;
                float minLst = 0;
                float maxLst = 0;
                for (int rangeIndex = 0; rangeIndex < rangeSize; rangeIndex++)//每个步长区间,0~step;step~step*rangeIndex;step
                {
                    key = (int)(ndviArgs.Min + tvdiP.Length * rangeIndex - (-1000));
                    if (key >= NDVIHistograms.Length || NDVIHistograms[key] == null)
                    {
                        continue;
                    }
                    if (NDVIHistograms[key].Ndvi == ndviCloudy || NDVIHistograms[key].Ndvi == 0)
                    {
                        continue;
                    }
                    if (!ValidValueHelper.IsVaild(key, ndviArgs))
                    {
                        continue;
                    }
                    if (NDVIHistograms[key].Lst == null || NDVIHistograms[key].Lst.Count == 0)
                    {
                        continue;
                    }
                    NDVIHistograms[key].Lst.Sort();
                    NdviLstPCStat(NDVIHistograms[key].Lst, out minLst, out maxLst, ucArgs.TVDIParas.LstFile, tvdiP.LstFreq);
                    if (minLst == 0 && maxLst == 0)
                    {
                        continue;
                    }
                    minData.Add(new Samples(NDVIHistograms[key].Ndvi, minLst));
                    maxData.Add(new Samples(NDVIHistograms[key].Ndvi, maxLst));
                }
                GC.Collect();
                return(NihePara(maxData, minData, tvdiP.FLimit, tvdiP.HGYZ));
            }
            finally
            {
            }
        }
Beispiel #3
0
        private static DryWetEdgeArgs DryWetEdgesArgsCalc(TVDIUCArgs ucArgs, Dictionary <float, List <float> > NDVIHistograms)
        {
            List <Samples> minData  = new List <Samples>();
            List <Samples> maxData  = new List <Samples>();
            TVDIParaClass  tvdiP    = ucArgs.TVDIParas;
            ArgumentItem   ndviArgs = tvdiP.NdviFile;
            ArgumentItem   lstArgs  = tvdiP.LstFile;

            try
            {
                int rangeSize = (int)Math.Ceiling((double)(ndviArgs.Max - ndviArgs.Min) / tvdiP.Length);//区间个数
                if (rangeSize == 0)
                {
                    return(null);
                }
                float key    = 0;
                float minLst = 0;
                float maxLst = 0;
                for (int rangeIndex = 0; rangeIndex < rangeSize; rangeIndex++) //每个步长区间,0~step;step~step*rangeIndex;step
                {
                    key = (float)(ndviArgs.Min + tvdiP.Length * rangeIndex);   // / ndviArgs.Zoom;

                    if (!NDVIHistograms.ContainsKey(key))
                    {
                        continue;
                    }
                    if (key == 0 || !ValidValueHelper.IsVaild(key, ndviArgs))
                    {
                        continue;
                    }
                    if (NDVIHistograms[key] == null || NDVIHistograms[key].Count == 0)
                    {
                        continue;
                    }
                    NDVIHistograms[key].Sort();
                    minLst = 0;
                    maxLst = 0;
                    NdviLstPCStat(NDVIHistograms[key], out minLst, out maxLst, ucArgs.TVDIParas.LstFile, tvdiP.LstFreq);
                    if (minLst == 0 && maxLst == 0)
                    {
                        continue;
                    }
                    minData.Add(new Samples(key * ndviArgs.Zoom, minLst * lstArgs.Zoom));
                    maxData.Add(new Samples(key * ndviArgs.Zoom, maxLst * lstArgs.Zoom));
                }
                GC.Collect();
                return(NihePara(maxData, minData, ndviArgs, tvdiP.LstFile, tvdiP.FLimit, tvdiP.HGYZ));
            }
            finally
            {
            }
        }
Beispiel #4
0
        private static void NdviLstPCStat(List <Int16> ndviList, out float minLst, out float maxLst, ArgumentItem lstArgItem, int LstFreq)
        {
            minLst = maxLst = 0;
            int          length = ndviList.Count;
            List <float> resultTemp = new List <float>();
            bool         isEnough = false;
            int          start = lstArgItem.Min, end = lstArgItem.Max;

            Int16[] result = new short[end - start + 1];
            int     index  = 0;

            for (int i = 0; i < length; i++)
            {
                if (ndviList[i] == 9000 || ndviList[i] == 9998 ||
                    ndviList[i] == 9997 || ndviList[i] == 9999)
                {
                    continue;
                }
                if (!ValidValueHelper.IsVaild(ndviList[i], lstArgItem))
                {
                    continue;
                }
                index = ndviList[i] - start;
                if (index < 0 || index >= result.Length)
                {
                    continue;
                }
                result[index] += 1;
                if (!isEnough && result[index] > LstFreq)
                {
                    minLst   = ndviList[i];
                    isEnough = true;
                }
                if (result[index] > LstFreq)
                {
                    maxLst = ndviList[i];
                }
            }
        }