Exemplo n.º 1
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);
 }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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> >();
     }
 }
Exemplo n.º 6
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);
        }