Esempio n. 1
0
        static void Main(string[] args)
        {
            //string argFile = AppDomain.CurrentDomain.BaseDirectory + "\\ClearSkyArg.txt";
            string argFile = args[0];

            if (!File.Exists(argFile))
            {
                Console.WriteLine("参数配置文件不存在!");
                return;
            }
            Dictionary <string, string> argDic = GetArgsByFile(argFile);

            if (argDic == null || argDic.Count == 0)
            {
                Console.WriteLine("参数配置文件内容不正确!");
                return;
            }
            string path = argDic["BaseDir"];    //@"E:\NDVI"

            string[] fs = Directory.GetFiles(path, "*.ldf");
            if (fs == null || fs.Length == 0)
            {
                Console.WriteLine("输入目录下无数据文件!");
                return;
            }
            Executer            s   = new Executer();
            IRasterDataProvider prd = RasterDataDriver.Open(fs[0]) as IRasterDataProvider;

            int[] bands     = GetBands(prd, argDic);
            int[] ndviBands = GetNDVIBands(prd, argDic);
            if (ndviBands == null)
            {
                Console.WriteLine("参数配置文件中NDVI计算通道错误!");
                return;
            }
            s.StatFiles(fs, bands, GetOutDir(prd, argDic), ndviBands, (p, pstring) => { Console.WriteLine(pstring); });
            Console.ReadLine();
        }