Exemple #1
0
        public static string CloneDataSet(Microsoft.Research.Science.Data.DataSet source, string fileName, int year)
        {
            var cloneFileName = MakeYearlyFileName(fileName, year);
            var targetUri     = "msds:nc?file=" + cloneFileName + "&openMode=create";

            var dataSet  = source.Clone("msds:memory");
            var dataSet2 = dataSet.Clone(targetUri);

            dataSet.Dispose();
            dataSet = null;

            dataSet2.Dispose();
            dataSet2 = null;

            return(cloneFileName);
        }
Exemple #2
0
        //convert NetCDF to csv
        private string convertToCSV(string path)
        {
            //return if file has already been converted
            if (File.Exists(path + ".csv"))
            {
                return(path + ".csv");
            }

            //register providers with scientific dataset
            string currentPath = Application.StartupPath + "\\Plugins\\ClimateAnalysis\\Scientific DataSet 1.3\\Microsoft.Research.Science.Data.NetCDF4.dll";

            Microsoft.Research.Science.Data.Factory.DataSetFactory.RegisterAssembly(currentPath);
            currentPath = Application.StartupPath + "\\Plugins\\ClimateAnalysis\\Scientific DataSet 1.3\\Microsoft.Research.Science.Data.CSV.dll";
            Microsoft.Research.Science.Data.Factory.DataSetFactory.RegisterAssembly(currentPath);

            Microsoft.Research.Science.Data.DataSet dataSet = Microsoft.Research.Science.Data.DataSet.Open(path);
            dataSet.Clone(path + ".csv");
            return(path + ".csv");
        }