Exemplo n.º 1
0
 def test_should_create_one_object(self):
     """Create an object from the first line of data"""
     luke = createOCOpoint(**{
         'latitude': self.dataset['latitude'][0],
         'longitude': self.dataset['longitude'][0],
         'xco2': self.dataset['xco2'][0],
         'date': self.dataset['date'][0],
     }
     )
     self.assertEqual(luke.latitude, self.dataset['latitude'][0])
     self.assertEqual(luke.longitude, self.dataset['longitude'][0])
     self.assertEqual(luke.xco2, self.dataset['xco2'][0])
     self.assertEqual(luke.timestamp, datetime(*map(int, self.dataset['date'][0])))
Exemplo n.º 2
0
 def test_should_create_one_object(self):
     """Create an object from the first line of data"""
     luke = createOCOpoint(
         **{
             'latitude': self.dataset['latitude'][0],
             'longitude': self.dataset['longitude'][0],
             'xco2': self.dataset['xco2'][0],
             'date': self.dataset['date'][0],
         })
     self.assertEqual(luke.latitude, self.dataset['latitude'][0])
     self.assertEqual(luke.longitude, self.dataset['longitude'][0])
     self.assertEqual(luke.xco2, self.dataset['xco2'][0])
     self.assertEqual(luke.timestamp,
                      datetime(*map(int, self.dataset['date'][0])))
Exemplo n.º 3
0
 def setUp(self):
     # insert some rows and return their pks
     samples = util_populate_table(self.dataset, self.test_length)
     # pick a random sample
     self.i, self.test_point_pk, self.test_areas_pk, self.long, self.lat = pick_random_sample(
         self.dataset, samples)
     from src.formatdata import createOCOpoint
     self.luke = createOCOpoint(
         **{
             'latitude': self.dataset['latitude'][self.i],
             'longitude': self.dataset['longitude'][self.i],
             'xco2': self.dataset['xco2'][self.i],
             'date': self.dataset['date'][self.i],
         })
Exemplo n.º 4
0
    def test_create_objects_from_netcdf(self):
        """Test creation of many object"""
        luke = (createOCOpoint(**{
            'latitude': self.dataset['latitude'][i],
            'longitude': self.dataset['longitude'][i],
            'xco2': self.dataset['xco2'][i],
            'date': self.dataset['date'][i],
        }) for i in range(5))

        for p in luke:
            print(p)
            try:
                next(luke)
            except StopIteration:
                break
 def setUp(self):
     # insert some rows and return their pks
     samples = util_populate_table(self.dataset, self.test_length)
     # pick a random sample
     self.i, self.test_point_pk, self.test_areas_pk, self.long, self.lat = pick_random_sample(
         self.dataset,
         samples
     )
     from src.formatdata import createOCOpoint
     self.luke = createOCOpoint(**{
         'latitude': self.dataset['latitude'][self.i],
         'longitude': self.dataset['longitude'][self.i],
         'xco2': self.dataset['xco2'][self.i],
         'date': self.dataset['date'][self.i],
         }
     )
Exemplo n.º 6
0
    def test_create_objects_from_netcdf(self):
        """Test creation of many object"""
        luke = (createOCOpoint(
            **{
                'latitude': self.dataset['latitude'][i],
                'longitude': self.dataset['longitude'][i],
                'xco2': self.dataset['xco2'][i],
                'date': self.dataset['date'][i],
            }) for i in range(5))

        for p in luke:
            print(p)
            try:
                next(luke)
            except StopIteration:
                break
Exemplo n.º 7
0
    def setUpClass(cls):
        print(cls.__doc__)
        _, cls.engine = start_postgre_engine('test', False)
        cls.conn = cls.engine.connect()

        cls.paths = return_files_paths()
        cls.dataset = return_dataset(cls.paths[0])

        # create an OCOpoint from the first record in the first file
        cls.luke = createOCOpoint(
            **{
                'latitude': cls.dataset['latitude'][0],
                'longitude': cls.dataset['longitude'][0],
                'xco2': cls.dataset['xco2'][0],
                'date': cls.dataset['date'][0],
            })
Exemplo n.º 8
0
    def setUpClass(cls):
        print(cls.__doc__)
        _, cls.engine = start_postgre_engine('test', False)
        cls.conn = cls.engine.connect()

        cls.paths = return_files_paths()
        cls.dataset = return_dataset(cls.paths[0])

        # create an OCOpoint from the first record in the first file
        cls.luke = createOCOpoint(**{
            'latitude': cls.dataset['latitude'][0],
            'longitude': cls.dataset['longitude'][0],
            'xco2': cls.dataset['xco2'][0],
            'date': cls.dataset['date'][0],
            }
        )