コード例 #1
0
        private static void ReadAllFormats(string watershedName)
        {
            //TODO - compare validateWatershed data with computed

            File.AppendAllText(logFile, NL);
            File.AppendAllText(logFile, "---------- Reading  Ensembles ----------" + NL);
            string fn;

            // TimeSeriesOfEnsembleLocations wshedData=null;
            DateTime startTime = DateTime.MinValue;
            DateTime endTime   = DateTime.MaxValue;

            // DSS
            fn = "ensemble_V7_" + tag + ".dss";
            ReadTimed(fn, () =>
            {
                return(DssEnsemble.Read(watershedName, startTime, endTime, fn));
            });

            fn = "ensemble_V7_profiles_" + tag + ".dss";
            ReadTimed(fn, () =>
            {
                return(DssEnsemble.ReadTimeSeriesProfiles(watershedName, startTime, endTime, fn));
            });

            // SQLITE
            fn = "ensemble_sqlite_blob_" + tag + ".db";
            ReadTimed(fn, () =>
            {
                return(SqLiteEnsemble.Read(watershedName, startTime, endTime, fn));
            });

            // Pisces
            fn = "ensemble_pisces_" + tag + ".pdb";
            ReadTimed(fn, () =>
            {
                return(SqLiteEnsemble.Read(watershedName, startTime, endTime, fn));
            });

            // Serial HDF5
            fn = "ensemble_serial_1RowPerChunk.h5";
            ReadTimed(fn, () =>
            {
                using (var hr = new H5Reader(fn))
                    return(HDF5Ensemble.Read(hr, watershedName));
            });


            // Parallel HDF5
            foreach (int c in new[] { 1, 10, -1 })
            {
                fn = "ensemble_parallel_" + c.ToString() + "RowsPerChunk.h5";
                ReadTimed(fn, () =>
                {
                    using (var hr = new H5Reader(fn))
                        return(HDF5Ensemble.Read(hr, watershedName));
                });
            }
        }
コード例 #2
0
        private static void WriteAllFormats(Watershed waterShedData, bool delete)
        {
            File.AppendAllText(logFile, NL);
            string fn, dir;

            // DSS 6/7
            fn = "ensemble_V7_" + tag + ".dss";
            if (delete)
            {
                File.Delete(fn);
            }
            WriteTimed(fn, tag, () => DssEnsemble.Write(fn, waterShedData));

            fn = "ensemble_V7_profiles_" + tag + ".dss";
            if (delete)
            {
                File.Delete(fn);
            }
            WriteTimed(fn, tag, () => DssEnsemble.WriteToTimeSeriesProfiles(fn, waterShedData));


            bool compress = true;

            // SQLITE
            fn = "ensemble_sqlite_" + tag + ".db";
            if (delete)
            {
                File.Delete(fn);
            }
            WriteTimed(fn, tag, () =>
            {
                SqLiteEnsemble.Write(fn, waterShedData, compress, false);
            });

            fn = "ensemble_pisces_" + tag + ".pdb";
            if (delete)
            {
                File.Delete(fn);
            }
            WriteTimed(fn, tag, () =>
            {
                SqLiteEnsemble.WriteWithDataTable(fn, waterShedData, compress, true);
            });


            // Serial HDF5
            fn = "ensemble_serial_1RowPerChunk.h5";
            WriteTimed(fn, tag, () =>
            {
                using (var h5w = new H5Writer(fn))
                    HDF5Ensemble.Write(h5w, waterShedData);
            });


            // Parallel HDF5
            foreach (int c in new[] { 1, 10, -1 })
            {
                fn = "ensemble_parallel_" + c.ToString() + "RowsPerChunk.h5";
                WriteTimed(fn, tag, () =>
                {
                    using (var h5w = new H5Writer(fn))
                        HDF5Ensemble.WriteParallel(h5w, waterShedData, c);
                });
            }
        }