Exemplo n.º 1
0
        static void Main(string[] args)
        {
            if (args == null || args.Length == 0)
            {
                Console.WriteLine("请输入参数:文件目录及计算波段号!");
                return;
            }
            string[] argAry = args[0].Trim().Split(';');
            if (argAry == null || argAry.Length < 2)
            {
                Console.WriteLine("请输入有效的文件目录及计算波段号!");
                return;
            }
            string path = argAry[0];    //@"E:\NDVI"

            string[] fs      = Directory.GetFiles(path, "*.ldf");
            string[] bandNos = argAry[1].Trim().Split(new char[] { ',', ',' }, StringSplitOptions.RemoveEmptyEntries);
            if (bandNos == null || bandNos.Length != 2)
            {
                return;
            }
            Executer s = new Executer();

            s.StatFiles(fs, new int[] { int.Parse(bandNos[0]), int.Parse(bandNos[1]) }, (p, pstring) => { Console.WriteLine(pstring); });
            Console.ReadLine();
        }
Exemplo n.º 2
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();
        }