예제 #1
0
 def test_gdt40_computed(self):
     fname = tests.get_data_path(('GRIB', 'gaussian', 'regular_gg.grib2'))
     with open(fname, 'rb') as grib_fh:
         self.grib_id = gribapi.grib_new_from_file(grib_fh)
         section = _Section(self.grib_id, None, [])
     latitudes = section.get_computed_key('latitudes')
     self.assertTrue(88.55 < latitudes[0] < 88.59)
예제 #2
0
 def test_array(self):
     section = _Section(self.grib_id, None, self.keys)
     for key in self.keys:
         value = section[key]
         self.assertIsInstance(value, np.ndarray)
         self.assertEqual(value.shape, (1,))
예제 #3
0
 def test_numberOfSection(self):
     n = 4
     section = _Section(self.grib_id, n, ['numberOfSection'])
     self.assertEqual(section['numberOfSection'], n)
예제 #4
0
 def test_invalid(self):
     section = _Section(self.grib_id, None, ['Ni'])
     with self.assertRaisesRegexp(KeyError, 'Nii'):
         section['Nii']
예제 #5
0
 def test_array(self):
     section = _Section(self.grib_id, None, ['codedValues'])
     codedValues = section['codedValues']
     self.assertEqual(codedValues.shape, (1551,))
     self.assertArrayAlmostEqual(codedValues[:3],
                                 [-1.78140259, -1.53140259, -1.28140259])
예제 #6
0
 def test_typeOfFirstFixedSurface(self):
     section = _Section(self.grib_id, None, ['typeOfFirstFixedSurface'])
     self.assertEqual(section['typeOfFirstFixedSurface'], 100)
예제 #7
0
파일: test__Section.py 프로젝트: cdr30/iris
 def test_array(self):
     section = _Section(self.grib_id, None, self.keys)
     for key in self.keys:
         value = section[key]
         self.assertIsInstance(value, np.ndarray)
         self.assertEqual(value.shape, (1, ))
예제 #8
0
 def test_scalar(self):
     section = _Section(self.grib_id, None, ['Ni'])
     self.assertEqual(section['Ni'], 47)
예제 #9
0
파일: test__Section.py 프로젝트: cdr30/iris
 def test_invalid(self):
     section = _Section(self.grib_id, None, ['Ni'])
     with self.assertRaisesRegexp(KeyError, 'Nii'):
         section['Nii']
예제 #10
0
파일: test__Section.py 프로젝트: cdr30/iris
 def test_numberOfSection(self):
     n = 4
     section = _Section(self.grib_id, n, ['numberOfSection'])
     self.assertEqual(section['numberOfSection'], n)
예제 #11
0
파일: test__Section.py 프로젝트: cdr30/iris
 def test_typeOfFirstFixedSurface(self):
     section = _Section(self.grib_id, None, ['typeOfFirstFixedSurface'])
     self.assertEqual(section['typeOfFirstFixedSurface'], 100)
예제 #12
0
파일: test__Section.py 프로젝트: cdr30/iris
 def test_array(self):
     section = _Section(self.grib_id, None, ['codedValues'])
     codedValues = section['codedValues']
     self.assertEqual(codedValues.shape, (1551, ))
     self.assertArrayAlmostEqual(codedValues[:3],
                                 [-1.78140259, -1.53140259, -1.28140259])
예제 #13
0
파일: test__Section.py 프로젝트: cdr30/iris
 def test_scalar(self):
     section = _Section(self.grib_id, None, ['Ni'])
     self.assertEqual(section['Ni'], 47)