Ejemplo n.º 1
0
        public static void LoadData()
        {
            System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
            customCulture.NumberFormat.NumberDecimalSeparator = ".";

            System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;

            Console.WriteLine("Output works.");
            Console.WriteLine("Using " + (Environment.Is64BitProcess ? "x64" : "x32"));
            bool loadData = true;

            int numTimeSlices = 60;
            RedSea.Singleton.NumTimeSlices = numTimeSlices;
            //string locDataFolder = "E:/Anke/Dev/Data/Shaheen_8/s"; //"E:/Anke/Dev/Data/First/s";
            //string locFileName = "/Posterior_Diag.nc";
            //string locFolderName = "/advance_temp";
            //string locWFileName = ".0000000108.data";

            RedSea.Singleton.GetLoader = RedSeaLoader; //= (step, substep, var) => locDataFolder + (step + 1) + ((substep == null)?(var == RedSea.Variable.VELOCITY_Z? "/W" + locWFileName : locFileName) : (locFolderName + substep) + "/" + "S" + locWFileName);
            RedSea.Singleton.GetFilename = RedSeaFilenames;
            RedSea.Singleton.DonutFileName = "C:/Users/anke/Documents/VIS/Eddy/Results/Donut";
            RedSea.Singleton.CoreFileName = "C:/Users/anke/Documents/VIS/Eddy/Results/Core";
            RedSea.Singleton.SnapFileName = "C:/Users/anke/Documents/VIS/Eddy/Results/Screenshots/";
            RedSea.Singleton.RingFileName = "C:/Users/anke/Documents/VIS/Eddy/Results/Rings/";
            //Tests.CopyBeginningOfFile(RedSea.Singleton.GetFilename(0), 100000);

            //LoaderNCF ncFile = RedSea.Singleton.GetLoaderNCF(0);
            //ScalarField[] u = new ScalarField[numTimeSlices];
            //LoaderNCF.SliceRange sliceU = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.VELOCITY_X);
            //sliceU.SetMember(RedSea.Dimension.MEMBER, 0); // Average
            //sliceU.SetMember(RedSea.Dimension.TIME, 0);
            //sliceU.SetMember(RedSea.Dimension.CENTER_Z, 0);
            ////sliceU.SetRange(RedSea.Dimension.GRID_X, 300, 100);
            ////sliceU.SetRange(RedSea.Dimension.CENTER_Y, 20, 100);

            //ScalarField[] v = new ScalarField[numTimeSlices];
            //LoaderNCF.SliceRange sliceV = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.VELOCITY_Y);
            //sliceV.SetMember(RedSea.Dimension.MEMBER, 0);
            //sliceV.SetMember(RedSea.Dimension.TIME, 0);
            //sliceV.SetMember(RedSea.Dimension.CENTER_Z, 0);
            ////sliceV.SetRange(RedSea.Dimension.CENTER_X, 300, 100);
            ////sliceV.SetRange(RedSea.Dimension.GRID_Y, 20, 100);

            //ensembleU = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.VELOCITY_X);
            //ensembleU.SetMember(RedSea.Dimension.TIME, 0);
            //ensembleU.SetMember(RedSea.Dimension.CENTER_Z, 0);
            //ensembleU.SetRange(RedSea.Dimension.MEMBER, 2, 50);
            ////ensembleU.SetRange(RedSea.Dimension.GRID_X, 100, 160);
            ////ensembleU.SetRange(RedSea.Dimension.CENTER_Y, 10, 70);
            //ensembleV = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.VELOCITY_Y);
            //ensembleV.SetMember(RedSea.Dimension.TIME, 0);
            //ensembleV.SetMember(RedSea.Dimension.CENTER_Z, 0);
            //ensembleV.SetRange(RedSea.Dimension.MEMBER, 2, 50);
            ////ensembleV.SetRange(RedSea.Dimension.CENTER_X, 100, 160);
            ////ensembleV.SetRange(RedSea.Dimension.GRID_Y, 10, 70);

            Loader.SliceRange rawU = new LoaderRaw.SliceRangeRaw(RedSea.Variable.VELOCITY_X);
            rawU.SetMember(RedSea.Dimension.GRID_Z, 0);
            rawU.SetMember(RedSea.Dimension.MEMBER, 0);
            rawU.SetMember(RedSea.Dimension.SUBTIME, 0);
            Loader.SliceRange rawV = new LoaderRaw.SliceRangeRaw(RedSea.Variable.VELOCITY_Y);
            rawV.SetMember(RedSea.Dimension.GRID_Z, 0);
            rawV.SetMember(RedSea.Dimension.MEMBER, 0);
            rawV.SetMember(RedSea.Dimension.SUBTIME, 0);

            //rawU.SetMember(RedSea.Dimension.TIME, 40);

            //rawV.SetMember(RedSea.Dimension.TIME, 40);
            //ncFile.Close();

            //if (loadData)
            //{
            //    //velocity = LoaderRaw.LoadTimeSeries(new Loader.SliceRange[] { sliceU, sliceV }, 0, numTimeSlices);
            //    velocity = LoaderRaw.LoadTimeSeries(new Loader.SliceRange[] { rawU, rawV });

            //    // Scale the field from m/s to (0.1 degree per 3 days).
            //    velocity.ScaleToGrid(new Vec2(RedSea.Singleton.TimeScale));
            //}
            //else
            //{
            //    velocity = Tests.CreateCircle(new Vec2(0), 100, new Vec2(0/*.2f*/), numTimeSlices, 8);
            //    //velocity = Tests.CreatePathlineSpiral(99, 100, 2);
            //    velocity.ScaleToGrid(new Vec2(RedSea.Singleton.DomainScale));
            //}

            Console.WriteLine("Completed loading data.");

            CriticalPointSet2D[] cps = new CriticalPointSet2D[numTimeSlices];
            for (int time = 0; time < numTimeSlices; ++time)
            {
                //                cps[time] = FieldAnalysis.ComputeCriticalPointsRegularSubdivision2D(velocity.GetTimeSlice(time), 5, 0.3f);
                //                cps[time].SelectTypes(new CriticalPoint2D.TypeCP[] { CriticalPoint2D.TypeCP.ATTRACTING_FOCUS, CriticalPoint2D.TypeCP.REPELLING_FOCUS }).ToBasicSet();

                Console.WriteLine("Completed processing step " + time + '.');
            }

            redSea = new Plane(new Vector3(-10, -3, -5), Vector3.UnitX * 0.1f, Vector3.UnitY * 0.1f, -Vector3.UnitZ, 0.4f/*10f/size*/, 0.1f);
            //            mapperCP = new CriticalPointTracking(cps, velocity, redSea);
            //Console.WriteLine("Found CP.");
            //mapperPathCore = new PathlineCoreTracking(velocity, redSea);
            //Console.WriteLine("Found Pathline Cores.");
            mapperComparison = new MemberComparison(/*new LoaderNCF.SliceRange[] { sliceU, sliceV },*/ redSea);
            if (velocity != null)
            {
                mapperOW = new OkuboWeiss(velocity, redSea);
                Console.WriteLine("Computed Okubo-Weiss.");
            }

            Console.WriteLine("Computed all data necessary.");
        }
Ejemplo n.º 2
0
        public static void LoadData()
        {
            System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
            customCulture.NumberFormat.NumberDecimalSeparator = ".";

            System.Threading.Thread.CurrentThread.CurrentCulture = customCulture;

            Console.WriteLine("Output works.");
            Console.WriteLine("Using " + (Environment.Is64BitProcess ? "x64" : "x32"));
            bool loadData = true;

            int numTimeSlices = 60;

            RedSea.Singleton.NumTimeSlices = numTimeSlices;
            //string locDataFolder = "E:/Anke/Dev/Data/Shaheen_8/s"; //"E:/Anke/Dev/Data/First/s";
            //string locFileName = "/Posterior_Diag.nc";
            //string locFolderName = "/advance_temp";
            //string locWFileName = ".0000000108.data";

            RedSea.Singleton.GetLoader     = RedSeaLoader; //= (step, substep, var) => locDataFolder + (step + 1) + ((substep == null)?(var == RedSea.Variable.VELOCITY_Z? "/W" + locWFileName : locFileName) : (locFolderName + substep) + "/" + "S" + locWFileName);
            RedSea.Singleton.GetFilename   = RedSeaFilenames;
            RedSea.Singleton.DonutFileName = "D:/KTH/Projects/EddyRedo/Data/Donut";
            RedSea.Singleton.DiskFileName  = "D:/KTH/Projects/EddyRedo/Data/Disks/Disk";
            RedSea.Singleton.CoreFileName  = "D:/KTH/Projects/EddyRedo/Data/Core";
            RedSea.Singleton.SnapFileName  = "D:/KTH/Projects/EddyRedo/Data/Screenshots/";
            RedSea.Singleton.RingFileName  = "D:/KTH/Projects/EddyRedo/Data/Rings/";
            //Tests.CopyBeginningOfFile(RedSea.Singleton.GetFilename(0), 100000);

            //LoaderNCF ncFile = RedSea.Singleton.GetLoaderNCF(0);
            //ScalarField[] u = new ScalarField[numTimeSlices];
            //LoaderNCF.SliceRange sliceU = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.VELOCITY_X);
            //sliceU.SetMember(RedSea.Dimension.MEMBER, 0); // Average
            //sliceU.SetMember(RedSea.Dimension.TIME, 0);
            //sliceU.SetMember(RedSea.Dimension.CENTER_Z, 0);
            ////sliceU.SetRange(RedSea.Dimension.GRID_X, 300, 100);
            ////sliceU.SetRange(RedSea.Dimension.CENTER_Y, 20, 100);

            //ScalarField[] v = new ScalarField[numTimeSlices];
            //LoaderNCF.SliceRange sliceV = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.VELOCITY_Y);
            //sliceV.SetMember(RedSea.Dimension.MEMBER, 0);
            //sliceV.SetMember(RedSea.Dimension.TIME, 0);
            //sliceV.SetMember(RedSea.Dimension.CENTER_Z, 0);
            ////sliceV.SetRange(RedSea.Dimension.CENTER_X, 300, 100);
            ////sliceV.SetRange(RedSea.Dimension.GRID_Y, 20, 100);

            //ensembleU = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.VELOCITY_X);
            //ensembleU.SetMember(RedSea.Dimension.TIME, 0);
            //ensembleU.SetMember(RedSea.Dimension.CENTER_Z, 0);
            //ensembleU.SetRange(RedSea.Dimension.MEMBER, 2, 50);
            ////ensembleU.SetRange(RedSea.Dimension.GRID_X, 100, 160);
            ////ensembleU.SetRange(RedSea.Dimension.CENTER_Y, 10, 70);
            //ensembleV = new LoaderNCF.SliceRange(ncFile, RedSea.Variable.VELOCITY_Y);
            //ensembleV.SetMember(RedSea.Dimension.TIME, 0);
            //ensembleV.SetMember(RedSea.Dimension.CENTER_Z, 0);
            //ensembleV.SetRange(RedSea.Dimension.MEMBER, 2, 50);
            ////ensembleV.SetRange(RedSea.Dimension.CENTER_X, 100, 160);
            ////ensembleV.SetRange(RedSea.Dimension.GRID_Y, 10, 70);

            Loader.SliceRange rawU = new LoaderRaw.SliceRangeRaw(RedSea.Variable.VELOCITY_X);
            rawU.SetMember(RedSea.Dimension.GRID_Z, 0);
            rawU.SetMember(RedSea.Dimension.MEMBER, 0);
            rawU.SetMember(RedSea.Dimension.SUBTIME, 0);
            Loader.SliceRange rawV = new LoaderRaw.SliceRangeRaw(RedSea.Variable.VELOCITY_Y);
            rawV.SetMember(RedSea.Dimension.GRID_Z, 0);
            rawV.SetMember(RedSea.Dimension.MEMBER, 0);
            rawV.SetMember(RedSea.Dimension.SUBTIME, 0);

            //rawU.SetMember(RedSea.Dimension.TIME, 40);

            //rawV.SetMember(RedSea.Dimension.TIME, 40);
            //ncFile.Close();


            //if (loadData)
            //{
            //    //velocity = LoaderRaw.LoadTimeSeries(new Loader.SliceRange[] { sliceU, sliceV }, 0, numTimeSlices);
            //    velocity = LoaderRaw.LoadTimeSeries(new Loader.SliceRange[] { rawU, rawV });

            //    // Scale the field from m/s to (0.1 degree per 3 days).
            //    velocity.ScaleToGrid(new Vec2(RedSea.Singleton.TimeScale));
            //}
            //else
            //{
            //    velocity = Tests.CreateCircle(new Vec2(0), 100, new Vec2(0/*.2f*/), numTimeSlices, 8);
            //    //velocity = Tests.CreatePathlineSpiral(99, 100, 2);
            //    velocity.ScaleToGrid(new Vec2(RedSea.Singleton.DomainScale));
            //}


            Console.WriteLine("Completed loading data.");

            CriticalPointSet2D[] cps = new CriticalPointSet2D[numTimeSlices];
            for (int time = 0; time < numTimeSlices; ++time)
            {
                //                cps[time] = FieldAnalysis.ComputeCriticalPointsRegularSubdivision2D(velocity.GetTimeSlice(time), 5, 0.3f);
                //                cps[time].SelectTypes(new CriticalPoint2D.TypeCP[] { CriticalPoint2D.TypeCP.ATTRACTING_FOCUS, CriticalPoint2D.TypeCP.REPELLING_FOCUS }).ToBasicSet();

                Console.WriteLine("Completed processing step " + time + '.');
            }

            redSea = new Plane(new Vector3(-10, -3, -5), Vector3.UnitX * 0.1f, Vector3.UnitY * 0.1f, -Vector3.UnitZ, 0.4f /*10f/size*/, 0.1f);
            //            mapperCP = new CriticalPointTracking(cps, velocity, redSea);
            //Console.WriteLine("Found CP.");
            //mapperPathCore = new PathlineCoreTracking(velocity, redSea);
            //Console.WriteLine("Found Pathline Cores.");
            mapperComparison = new MemberComparison(/*new LoaderNCF.SliceRange[] { sliceU, sliceV },*/ redSea);
            if (velocity != null)
            {
                mapperOW = new OkuboWeiss(velocity, redSea);
                Console.WriteLine("Computed Okubo-Weiss.");
            }


            Console.WriteLine("Computed all data necessary.");
        }