Beispiel #1
0
 def test_nentries(self):
     with GD.open(self.gridfile, GD.DFACC_READ) as gdfid:
         with GD.attach(gdfid, 'TOMS Level 3') as gridid:
             ndims, _ = GD.nentries(gridid, core.HDFE_NENTDIM)
             self.assertEqual(ndims, 2)
             nfields, _ = GD.nentries(gridid, core.HDFE_NENTFLD)
             self.assertEqual(nfields, 4)
Beispiel #2
0
 def test_inqfields(self):
     with GD.open(self.gridfile, GD.DFACC_READ) as gdfid:
         with GD.attach(gdfid, 'TOMS Level 3') as gridid:
             fields, ranks, numbertypes = GD.inqfields(gridid)
             self.assertEqual(fields,
                              ['Ozone', 'Reflectivity', 'Aerosol',
                               'Erythemal'])
             self.assertEqual(ranks, [2, 2, 2, 2])
             self.assertEqual(numbertypes, [core.DFNT_FLOAT] * 4)
Beispiel #3
0
 def test_projinfo(self):
     # Verify GDprojinfo
     with GD.open(self.gridfile, GD.DFACC_READ) as gdfid:
         with GD.attach(gdfid, 'TOMS Level 3') as gridid:
             projcode, zonecode, spherecode, projparms = GD.projinfo(gridid)
             self.assertEqual(projcode, 0)
             self.assertEqual(zonecode, -1)
             self.assertEqual(spherecode, 0)
             np.testing.assert_array_equal(projparms,
                                           np.zeros(13, dtype=np.float64));
Beispiel #4
0
 def test_gridinfo(self):
     with GD.open(self.gridfile, GD.DFACC_READ) as gdfid:
         with GD.attach(gdfid, 'TOMS Level 3') as gridid:
             gridsize, upleft, lowright = GD.gridinfo(gridid)
             self.assertEqual(gridsize, (180, 288))
             np.testing.assert_array_equal(upleft,
                                           np.array([-180000000.0,
                                                     90000000.0]))
             np.testing.assert_array_equal(lowright,
                                           np.array([180000000.0,
                                                     -90000000.0]))
Beispiel #5
0
    def test_ij2ll(self):
        with GD.open(self.gridfile, GD.DFACC_READ) as gdfid:
            with GD.attach(gdfid, 'TOMS Level 3') as gridid:
                projcode, zonecode, spherecode, projparms = GD.projinfo(gridid)
                (nrow, ncol), upleft, lowright = GD.gridinfo(gridid)
                pixcen = GD.pixreginfo(gridid)
                pixcnr = GD.origininfo(gridid)

                row = np.array([[0, 0], [179, 179]], np.int32)
                col = np.array([[0, 287], [287, 0]], np.int32)
                lon, lat = GD.ij2ll(projcode, zonecode, projparms, spherecode,
                                    ncol, nrow, upleft, lowright, row, col,
                                    pixcen, pixcnr)
                np.testing.assert_array_equal(lon, 
                                              np.array([[-179.375, 179.375],
                                                        [179.375, -179.375]]))
                np.testing.assert_array_equal(lat, 
                                              np.array([[89.5, 89.5],
                                                        [-89.5, -89.5]]))
Beispiel #6
0
 def test_pixreginfo(self):
     # Verify GDpixreginfo
     with GD.open(self.gridfile, GD.DFACC_READ) as gdfid:
         with GD.attach(gdfid, 'TOMS Level 3') as gridid:
             pixregcode = GD.pixreginfo(gridid)
             self.assertEqual(pixregcode, core.HDFE_CENTER)
Beispiel #7
0
 def test_origininfo(self):
     # Verify GDorigininfo
     with GD.open(self.gridfile, GD.DFACC_READ) as gdfid:
         with GD.attach(gdfid, 'TOMS Level 3') as gridid:
             origincode = GD.origininfo(gridid)
             self.assertEqual(origincode, core.HDFE_GD_UL)
Beispiel #8
0
 def test_basic(self):
     with GD.open(self.gridfile, GD.DFACC_READ) as gdfid:
         with GD.attach(gdfid, 'TOMS Level 3') as gdid:
             self.assertTrue(True)