Beispiel #1
0
        public bool TestDefine() {
            NcFile file = null;
            try {
                file = new NcFile(filePath, NcFileMode.replace, NcFileFormat.classic);
                NcDim timeDim = file.AddDim("time", 20); 
                NcVar timeVar = file.AddVar("time", NcDouble.Instance, timeDim);
                timeVar.PutAtt("units", "minutes since 2000-01-01 00:00:00");
                timeVar.PutAtt("long_name", "Time");
                timeVar.CheckData();
                NcArray vals = NcArray.Arange(NcDouble.Instance, 20);
                timeVar.PutVar(vals);
                Assert.Equals(timeVar.GetAtt("long_name"), "Time");

                NcVar data = file.AddVar("data", NcDouble.Instance, timeDim);
            } finally {
                file.Close();
            }
            CheckDelete(filePath);
            return true;
        }
Beispiel #2
0
 private void FileSetup(ref NcFile file, ref NcDim dim1, ref NcVar var1, string type="int") {
     file = TestHelper.NewFile(filePath);
     dim1 = file.AddDim("time", 20);
     var1 = file.AddVar("temp",type,"time");
 }
Beispiel #3
0
 private void FileSetup(ref NcFile file, ref NcDim dim1, ref NcVar var1, NcType type, int len=20) {
     file = TestHelper.NewFile(filePath);
     dim1 = file.AddDim("time", len);
     var1 = file.AddVar("temp", type, dim1);
 }
Beispiel #4
0
        public bool TestGroupDefine() {
            NcFile file = null;
            NcDim dim;
            NcVar var;
            try {
                file = new NcFile(filePath, NcFileMode.replace, NcFileFormat.classic);
                file.CheckData();
                dim = file.AddDim("dim1", 1);
                file.CheckData();
                var = file.AddVar("var1", NcInt.Instance, dim);
                file.CheckData();
                var.PutAtt("blah","blah");
                file.CheckDefine();
                NcArray array = NcArray.Arange(NcInt.Instance, 1);
                var.PutVar(array);

            } finally {
                file.Close();
            }
            CheckDelete(filePath);
            return true;
        }