Пример #1
0
        private RegionArg GetRegionSetting()
        {
            RegionArg args = new RegionArg();

            args.CK001Days   = ckDay.Checked;
            args.CK007Days   = ckWeek.Checked;
            args.CK010Days   = ck10Days.Checked;
            args.CK030Days   = ckMonth.Checked;
            args.CK090Days   = ck90Days.Checked;
            args.CK365Days   = ckYear.Checked;
            args.CKSatellite = ckSatellite.Checked;
            args.CKTime      = ckTime.Checked;
            args.CycType     = (enumProcessType)(Enum.Parse(typeof(enumProcessType), cbCycType.SelectedIndex.ToString()));
            if (lbxValues.Items.Count != 0)
            {
                List <string> regions = new List <string>();
                foreach (object item in lbxValues.Items)
                {
                    if (item.ToString() != null)
                    {
                        regions.Add(item.ToString());
                    }
                }
                args.TimeRegion = GetValues(regions);
            }
            return(args);
        }
Пример #2
0
 private void InitRegionArgs(RegionArg args)
 {
     ckDay.Checked       = args.CK001Days;
     ckWeek.Checked      = args.CK007Days;
     ck10Days.Checked    = args.CK010Days;
     ckMonth.Checked     = args.CK030Days;
     ck90Days.Checked    = args.CK090Days;
     ckYear.Checked      = args.CK365Days;
     ckSatellite.Checked = args.CKSatellite;
     ckTime.Checked      = args.CKTime;
     foreach (object e in Enum.GetValues(typeof(enumProcessType)))
     {
         cbCycType.Items.Add(RegionArg.GetEnumDescription(e));
     }
     cbCycType.Text = RegionArg.GetEnumDescription(args.CycType);
 }
Пример #3
0
        private static string GetTimeRegion(RegionArg args, string time)
        {
            if (!args.CKTime || args.TimeRegion == null || args.TimeRegion.Count == 0)
            {
                return("_0000_2400");
            }

            foreach (string key in args.TimeRegion.Keys)
            {
                if (time.CompareTo(key) < 0 || time.CompareTo(args.TimeRegion[key]) >= 0)
                {
                    continue;
                }
                return("_" + key + "_" + args.TimeRegion[key]);
            }
            return("_0000_2400");
        }
Пример #4
0
        /*
         *分卫星 传感器
         *日信息:卫星_传感器_年_季_月_旬_日_时间起_时间止
         *旬信息: 卫星_传感器_年_季_月_旬_时间起_时间止
         *月信息:卫星_传感器_年_季_月_时间起_时间止
         * 季信息:卫星_传感器_年_季_时间起_时间止
         * 年信息:卫星_传感器_年_时间起_时间止
         *
         * 周信息:卫星_传感器_年_周_时间起_时间止
         */
        public static CYCAFileListInfo GeneralFileList(string[] files, RegionArg args, SubProductDef subPro, string outSubProIdentify)
        {
            CYCAFileListInfo result = new CYCAFileListInfo();

            GetMaxCyctime(args, ref result);
            if (result.Days001Files == null)
            {
                return(null);
            }
            DataIdentify   di       = null;
            string         fileInfo = string.Empty;
            RasterIdentify ri       = null;

            foreach (string file in files)
            {
                di = DataIdentifyMatcher.Match(file);
                string days001file = AddDays001FilesInfo(ref result, di, args, subPro, file, out ri, out fileInfo, outSubProIdentify);
                if (result.Days007Files != null && !string.IsNullOrEmpty(days001file))
                {
                    AddDays007FilesInfo(ref result, ri, args, subPro, days001file, fileInfo);
                }
                string days010file = string.Empty;
                if (result.Days010Files != null && !string.IsNullOrEmpty(days001file))
                {
                    days010file = AddDays010FilesInfo(ref result, ri, args, subPro, days001file, ref fileInfo);
                }
                string days030file = string.Empty;
                if (result.Days030Files != null && !string.IsNullOrEmpty(days010file))
                {
                    days030file = AddDays030FilesInfo(ref result, ri, args, subPro, days010file, ref fileInfo);
                }
                string days090file = string.Empty;
                if (result.Days090Files != null && !string.IsNullOrEmpty(days030file))
                {
                    days090file = AddDays090FilesInfo(ref result, ri, args, subPro, days030file, ref fileInfo);
                }
                string days365file = string.Empty;
                if (result.Days365Files != null && !string.IsNullOrEmpty(days090file))
                {
                    days365file = AddDays365FilesInfo(ref result, ri, args, subPro, days090file, ref fileInfo);
                }
            }
            return(result);
        }
Пример #5
0
        private static string AddDays365FilesInfo(ref CYCAFileListInfo result, RasterIdentify ri, RegionArg args, SubProductDef subPro, string days090file, ref string fileInfo)
        {
            string days90FLag = "_" + GetSeason(ri.OrbitDateTime.AddHours(8).Month) + "_";

            fileInfo = fileInfo.Replace(days90FLag, "_");
            if (result.Days365Files.ContainsKey(fileInfo))
            {
                result.Days365Files[fileInfo].Add(days090file);
            }
            else
            {
                List <string> files = new List <string>();
                files.Add(days090file);
                result.Days365Files.Add(fileInfo, files);
                ri.CYCFlag = args.CycType == enumProcessType.AVG ? "AOAY" : args.CycType == enumProcessType.MAX ? "MAAY" : args.CycType == enumProcessType.MIN ? "MNAY" : "POAY";
                string outFilename = ri.ToWksFullFileName(ri.Format);
                result.OutFilename.Add(fileInfo, outFilename);
                return(outFilename);
            }
            return(string.Empty);
        }
Пример #6
0
        private static string AddDays007FilesInfo(ref CYCAFileListInfo result, RasterIdentify ri, RegionArg args, SubProductDef subPro, string days001file, string fileInfo)
        {
            string days10FLag = GetDays010(ri.OrbitDateTime.AddHours(8).Day) + "_";
            string dayFlag    = ri.OrbitDateTime.AddHours(8).Day + "_";

            fileInfo = fileInfo.Replace("_" + days10FLag + dayFlag, "_" + WeekOfYear(ri.OrbitDateTime.AddHours(8)) + "_");
            if (result.Days007Files.ContainsKey(fileInfo))
            {
                result.Days007Files[fileInfo].Add(days001file);
            }
            else
            {
                List <string> files = new List <string>();
                files.Add(days001file);
                result.Days007Files.Add(fileInfo, files);
                ri.CYCFlag = args.CycType == enumProcessType.AVG ? "AOSD" : args.CycType == enumProcessType.MAX ? "MASD" : args.CycType == enumProcessType.MIN ? "MNSD" : "POSD";
                string outFilename = ri.ToWksFullFileName(ri.Format);
                result.OutFilename.Add(fileInfo, outFilename);
                return(outFilename);
            }
            return(string.Empty);
        }
Пример #7
0
 private static void GetMaxCyctime(RegionArg args, ref CYCAFileListInfo result)
 {
     if (args.CK365Days)
     {
         result.Days365Files = new Dictionary <string, List <string> >();
         if (result.Days090Files == null)
         {
             result.Days090Files = new Dictionary <string, List <string> >();
         }
         if (result.Days030Files == null)
         {
             result.Days030Files = new Dictionary <string, List <string> >();
         }
         if (result.Days010Files == null)
         {
             result.Days010Files = new Dictionary <string, List <string> >();
         }
         if (result.Days001Files == null)
         {
             result.Days001Files = new Dictionary <string, List <string> >();
         }
     }
     if (args.CK090Days)
     {
         result.Days090Files = new Dictionary <string, List <string> >();
         if (result.Days030Files == null)
         {
             result.Days030Files = new Dictionary <string, List <string> >();
         }
         if (result.Days010Files == null)
         {
             result.Days010Files = new Dictionary <string, List <string> >();
         }
         if (result.Days001Files == null)
         {
             result.Days001Files = new Dictionary <string, List <string> >();
         }
     }
     if (args.CK030Days)
     {
         result.Days030Files = new Dictionary <string, List <string> >();
         if (result.Days010Files == null)
         {
             result.Days010Files = new Dictionary <string, List <string> >();
         }
         if (result.Days001Files == null)
         {
             result.Days001Files = new Dictionary <string, List <string> >();
         }
     }
     if (args.CK010Days)
     {
         result.Days010Files = new Dictionary <string, List <string> >();
         if (result.Days001Files == null)
         {
             result.Days001Files = new Dictionary <string, List <string> >();
         }
     }
     if (args.CK007Days)
     {
         result.Days007Files = new Dictionary <string, List <string> >();
         if (result.Days001Files == null)
         {
             result.Days001Files = new Dictionary <string, List <string> >();
         }
     }
     if (args.CK001Days)
     {
         result.Days001Files = new Dictionary <string, List <string> >();
     }
 }
Пример #8
0
 private static string AddDays001FilesInfo(ref CYCAFileListInfo result, DataIdentify di, RegionArg args, SubProductDef subPro, string file, out RasterIdentify ri, out string fileInfo, string outSubProIdnetify)
 {
     fileInfo = null;
     ri       = null;
     if (args.CKSatellite)
     {
         fileInfo = string.Format("{0}_{1}_{2}_{3}_{4}_{5}_{6}{7}", di.Satellite, di.Sensor, di.OrbitDateTime.AddHours(8).Year, GetSeason(di.OrbitDateTime.AddHours(8).Month),
                                  di.OrbitDateTime.AddHours(8).Month, GetDays010(di.OrbitDateTime.AddHours(8).Day), di.OrbitDateTime.AddHours(8).Day, GetTimeRegion(args, di.OrbitDateTime.AddHours(8).ToString("HHdd")));
     }
     else
     {
         fileInfo = string.Format("{0}_{1}_{2}_{3}_{4}{5}", di.OrbitDateTime.AddHours(8).Year, GetSeason(di.OrbitDateTime.AddHours(8).Month),
                                  di.OrbitDateTime.AddHours(8).Month, GetDays010(di.OrbitDateTime.AddHours(8).Day), di.OrbitDateTime.AddHours(8).Day, GetTimeRegion(args, di.OrbitDateTime.AddHours(8).ToString("HHdd")));
     }
     if (result.Days001Files.ContainsKey(fileInfo))
     {
         result.Days001Files[fileInfo].Add(file);
     }
     else
     {
         List <string> files = new List <string>();
         files.Add(file);
         result.Days001Files.Add(fileInfo, files);
         string exInfo      = args.CycType == enumProcessType.AVG ? "AOAD" : args.CycType == enumProcessType.MAX ? "MAAD" : args.CycType == enumProcessType.MIN ? "MNAD" : "POAD";
         string outFilename = GetResultFilename(out ri, file, di, subPro, exInfo, outSubProIdnetify);
         result.OutFilename.Add(fileInfo, outFilename);
         return(outFilename);
     }
     return(string.Empty);
 }
Пример #9
0
        public object ParseArgumentValue(System.Xml.Linq.XElement ele)
        {
            if (ele == null)
            {
                return(null);
            }
            RegionArg args   = new RegionArg();
            XElement  segEle = ele.Element(XName.Get("CycType"));

            if (segEle != null)
            {
                if (segEle.Attribute(XName.Get("type")) != null)
                {
                    args.CycType = (enumProcessType)Enum.Parse(typeof(enumProcessType), segEle.Attribute(XName.Get("type")).Value);
                }
            }
            segEle = ele.Element(XName.Get("CycFlag"));
            if (segEle != null)
            {
                if (segEle.Attribute(XName.Get("days001")) != null)
                {
                    args.CK001Days = bool.Parse(segEle.Attribute(XName.Get("days001")).Value);
                }
                if (segEle.Attribute(XName.Get("days007")) != null)
                {
                    args.CK007Days = bool.Parse(segEle.Attribute(XName.Get("days007")).Value);
                }
                if (segEle.Attribute(XName.Get("days010")) != null)
                {
                    args.CK010Days = bool.Parse(segEle.Attribute(XName.Get("days010")).Value);
                }
                if (segEle.Attribute(XName.Get("days030")) != null)
                {
                    args.CK030Days = bool.Parse(segEle.Attribute(XName.Get("days030")).Value);
                }
                if (segEle.Attribute(XName.Get("days090")) != null)
                {
                    args.CK090Days = bool.Parse(segEle.Attribute(XName.Get("days090")).Value);
                }
                if (segEle.Attribute(XName.Get("days365")) != null)
                {
                    args.CK365Days = bool.Parse(segEle.Attribute(XName.Get("days365")).Value);
                }
            }
            segEle = ele.Element(XName.Get("TypeFlag"));
            if (segEle != null)
            {
                if (segEle.Attribute(XName.Get("satellite")) != null)
                {
                    args.CKSatellite = bool.Parse(segEle.Attribute(XName.Get("satellite")).Value);
                }
                if (segEle.Attribute(XName.Get("time")) != null)
                {
                    args.CKTime = bool.Parse(segEle.Attribute(XName.Get("time")).Value);
                }
            }
            segEle = ele.Element(XName.Get("Segements"));
            InitRegionArgs(args);
            if (segEle == null)
            {
                return(args);
            }
            IEnumerable <XElement> segs = segEle.Elements(XName.Get("Segement"));

            if (segs == null || segs.Count() == 0)
            {
                return(null);
            }
            args.TimeRegion = new SortedDictionary <string, string>();
            foreach (XElement seg in segs)
            {
                ParseMinMaxValue(seg, ref args.TimeRegion);
            }
            return(args);
        }
Пример #10
0
        private IExtractResult CYCAAlgorithm(Action <int, string> progressTracker)
        {
            string[] files = null;
            Dictionary <string, string[]> pathDic = _argumentProvider.GetArg("FileSelectType") as Dictionary <string, string[]>;

            if (pathDic == null || pathDic.Count == 0)
            {
                PrintInfo("请点击\"确定\"按钮,以确定文件参数设置完毕!");
                return(null);
            }
            if (pathDic.Keys.Contains("DirectoryPath")) //选择局地文件夹路径
            {
                files = GetFiles(pathDic["DirectoryPath"][0]);
            }
            else if (pathDic.Keys.Contains("FileNames")) //选择多个文件进行计算
            {
                files = pathDic["FileNames"];
            }
            if (files == null || files.Length == 0)
            {
                PrintInfo("待合成的数据文件不存在,请检查路径或文件设置!");
                return(null);
            }
            RegionArg args = _argumentProvider.GetArg("RegionArgs") as RegionArg;

            if (args == null)
            {
                PrintInfo("请点击\"确定\"按钮,以确定周期参数设置完毕!");
                return(null);
            }
            if (progressTracker != null)
            {
                progressTracker.Invoke(10, "正在整理文件列表,请稍后...");
            }
            CYCAFileListInfo cycaFileInfo = GeneralCYCAFileList.GeneralFileList(files, args, _subProductDef, "DBLV");

            if (cycaFileInfo == null || cycaFileInfo.OutFilename.Count == 0)
            {
                return(null);
            }
            UInt16[]        cloudValues    = GetNanValues("CloudyValue");
            UInt16[]        waterValues    = GetNanValues("WaterValue");
            IBandNameRaster bandNameRaster = _argumentProvider.DataProvider as IBandNameRaster;//
            int             bandNo         = TryGetBandNo(bandNameRaster, "LstBand");

            IExtractResultArray array = new ExtractResultArray("LST");

            if (cycaFileInfo.Days001Files != null && cycaFileInfo.Days001Files.Count != 0)
            {
                if (progressTracker != null)
                {
                    progressTracker.Invoke(25, "正在处理日数据,请稍后...");
                }
                foreach (string key in cycaFileInfo.Days001Files.Keys)
                {
                    array.Add(LSTDataProcessor.DataProcessor(progressTracker, _contextMessage, args.CK001Days, cycaFileInfo.Days001Files[key].ToArray(), bandNo, _subProductDef.Identify, cloudValues, waterValues, cycaFileInfo.OutFilename[key], args.CycType) as FileExtractResult);
                }
            }
            if (cycaFileInfo.Days007Files != null && cycaFileInfo.Days007Files.Count != 0)
            {
                if (progressTracker != null)
                {
                    progressTracker.Invoke(40, "正在处理周数据,请稍后...");
                }
                foreach (string key in cycaFileInfo.Days007Files.Keys)
                {
                    array.Add(LSTDataProcessor.DataProcessor(progressTracker, _contextMessage, args.CK007Days, cycaFileInfo.Days007Files[key].ToArray(), bandNo, _subProductDef.Identify, cloudValues, waterValues, cycaFileInfo.OutFilename[key], args.CycType) as FileExtractResult);
                }
            }
            if (cycaFileInfo.Days010Files != null && cycaFileInfo.Days010Files.Count != 0)
            {
                if (progressTracker != null)
                {
                    progressTracker.Invoke(55, "正在处理旬数据,请稍后...");
                }
                foreach (string key in cycaFileInfo.Days010Files.Keys)
                {
                    array.Add(LSTDataProcessor.DataProcessor(progressTracker, _contextMessage, args.CK010Days, cycaFileInfo.Days010Files[key].ToArray(), bandNo, _subProductDef.Identify, cloudValues, waterValues, cycaFileInfo.OutFilename[key], args.CycType) as FileExtractResult);
                }
            }
            if (cycaFileInfo.Days030Files != null && cycaFileInfo.Days030Files.Count != 0)
            {
                if (progressTracker != null)
                {
                    progressTracker.Invoke(70, "正在处理月数据,请稍后...");
                }
                foreach (string key in cycaFileInfo.Days030Files.Keys)
                {
                    array.Add(LSTDataProcessor.DataProcessor(progressTracker, _contextMessage, args.CK030Days, cycaFileInfo.Days030Files[key].ToArray(), bandNo, _subProductDef.Identify, cloudValues, waterValues, cycaFileInfo.OutFilename[key], args.CycType) as FileExtractResult);
                }
            }
            if (cycaFileInfo.Days090Files != null && cycaFileInfo.Days090Files.Count != 0)
            {
                if (progressTracker != null)
                {
                    progressTracker.Invoke(80, "正在处理季数据,请稍后...");
                }
                foreach (string key in cycaFileInfo.Days090Files.Keys)
                {
                    array.Add(LSTDataProcessor.DataProcessor(progressTracker, _contextMessage, args.CK090Days, cycaFileInfo.Days090Files[key].ToArray(), bandNo, _subProductDef.Identify, cloudValues, waterValues, cycaFileInfo.OutFilename[key], args.CycType) as FileExtractResult);
                }
            }
            if (cycaFileInfo.Days365Files != null && cycaFileInfo.Days365Files.Count != 0)
            {
                if (progressTracker != null)
                {
                    progressTracker.Invoke(90, "正在处理年数据,请稍后...");
                }
                foreach (string key in cycaFileInfo.Days365Files.Keys)
                {
                    array.Add(LSTDataProcessor.DataProcessor(progressTracker, _contextMessage, args.CK365Days, cycaFileInfo.Days365Files[key].ToArray(), bandNo, _subProductDef.Identify, cloudValues, waterValues, cycaFileInfo.OutFilename[key], args.CycType) as FileExtractResult);
                }
            }
            return(array);
        }