Пример #1
0
        public void Start(int tilesize)
        {
            Console.WriteLine("Compression Size Test For Specific Raster");

            // this is set up for erdas imagine with a spillfile.
            FileInfo f  = new FileInfo(filename);
            FileInfo f2 = new FileInfo(filename.Substring(0, filename.Length - 4) + ".ige");

            Console.WriteLine("Present Filename: " + filename);
            Console.WriteLine("Size: " + ((f.Length + f2.Length) / 1024 / 1024).ToString() + " Mb");

            GDALRead r = new GDALRead(filename);

            r.OpenFile();

            report = new Dictionary <double, TimePieces>();

            var total = Selections.Select(o => o.Value.Count).Sum();

            Console.WriteLine("Running tests for {0} selections", total);
            Console.WriteLine("Encoding for tile size: {0}", tilesize);

            int counted = 0;

            foreach (var sel in Selections)
            {
                Console.WriteLine("On Panel Start: {0}", sel.Key);

                TimePieces summary = new TimePieces();

                foreach (var l in sel.Value)
                {
                    counted++;

                    Console.CursorLeft = 0;
                    Console.Write("                                                      ");
                    Console.CursorLeft = 0;
                    Console.Write("On sample #{0} of {1}", counted, total);

                    var test = r.GetTileTest(l.x, l.y, tilesize);

                    summary.Pieces.Add(test);
                    summary.OfMeasures++;
                    summary.PngSize  += test.PngSize;
                    summary.TiffSize += test.TiffSize;
                    summary.PngTime   = summary.PngTime + test.PngTime;
                    summary.TiffTime  = summary.TiffTime + test.TiffTime;
                    summary.CopyTime  = summary.CopyTime + test.CopyTime;
                }

                report.Add(sel.Key, summary);
                Console.WriteLine();
            }


            Console.WriteLine("Calulated Sizes.");
        }
Пример #2
0
        public void Start()
        {
            GDALRead gr = new GDALRead(fname);

            gr.OpenFile();

            var start = DateTime.Now;

            variances = TileVariance.GetTileVariances(gr, 512, lim);

            var endd = DateTime.Now;


            // why ? because I want to store the results in something I can open, there is no text to worry about
            // json is bloated and the serializer bombs and if I'm gonna do row by row might as well do this.
            // since i'll be generating this all but once per raster and using the results directly.


            Console.WriteLine("Writing Variance Data To File.");

            var fs = File.Create("bytevariance.txt");

            StreamWriter s = new StreamWriter(fs);

            s.Write("X\tY\tCount\tTileSize\tStdDev\tAvg\tMax Percentage\tMin Percentage\t");

            for (int x = 0; x < 256; x++)
            {
                s.Write(x.ToString() + "\t");
            }

            s.WriteLine();


            for (int y = 0; y < variances.Count; y++)
            {
                var vy = variances[y];

                for (int x = 0; x < vy.Count; x++)
                {
                    var item = vy[x];

                    item.WriteRow(s);
                }
            }

            fs.Flush();
            fs.Close();

            Console.WriteLine("Calculation of Variances took: " + (endd - start).ToString());
        }