def testNcMLFile(self): init_jnius() testpath, file_name = os.path.split(__file__) testfile = os.path.join(testpath, "testremote.ncml") sd = NcMLFile(testfile) val = sd['votemper'][0, 0, 0, 0] self.assertAlmostEqual(val, 18.945175, 6, "First value should be 18.9")
def testTimeCounter(self): init_jnius() testpath, file_name = os.path.split(__file__) testfile = os.path.join(testpath, "testremote.ncml") sd = Reader(testfile, 0).grid dataset = Data2(sd.dataset, "time_counter") self.assertEqual(len(dataset), 8, "There should 8 datasets")
def testRepoMatching(self): init_jnius() testpath, file_name = os.path.split(__file__) testfile = os.path.join(testpath, "testremote.ncml") repo = Reader(testfile, 0) self.assertAlmostEqual(repo['t']['votemper'][0, 0, 0, 0], 18.945175, 6, "First value should be 18.9") self.assertAlmostEqual(repo['t']['votemper'][2, 10, 0, 0], 20.314891, 5, "2, 10, 0,0 value should be 18.9")
def testSrcDataVariable(self): init_jnius() testpath, file_name = os.path.split(__file__) testfile = os.path.join(testpath, "testremote.ncml") sd = Reader(testfile, 0).grid dataset = sd["votemper"] val = dataset[0, 0, 0, 0] val2 = dataset[2, 10, 0, 0] self.assertAlmostEqual(dataset[0, 0, 0, 0], 18.945175, 6, "First value should be 18.9") self.assertAlmostEqual(dataset[2, 10, 0, 0], 20.314891, 5, "2, 10, 0,0 value should be 18.9")
def testGridGroupTimeCounter(self): init_jnius() testpath, file_name = os.path.split(__file__) testfile = os.path.join(testpath, "testremote.ncml") repo = Reader(testfile, 0) self.assertEqual(len(repo['t'].time_counter), 8, "Time counter should be 8") self.assertEqual(repo['t'].time_counter[0], 691416000, "The first time value doesn't match") repo = Reader(testfile, 100) self.assertEqual(len(repo['t'].time_counter), 8, "Time counter should be 8") self.assertEqual(repo['t'].time_counter[0], 691416100, "The first time value doesn't match")