Ejemplo n.º 1
0
 def test_get_images(self):
     provider = GleamProvider(CubeConfig(end_time=datetime(2001, 12, 31, 23, 0)), dir=SOURCE_DIR, var="S")
     provider.prepare()
     images = provider.compute_variable_images(datetime(2001, 1, 1), datetime(2001, 1, 9))
     self.assertIsNotNone(images)
     self.assertTrue('evaporative_stress' in images)
     image = images['evaporative_stress']
     self.assertEqual((720, 1440), image.shape)
Ejemplo n.º 2
0
 def test_get_high_res_images(self):
     provider = GleamProvider(
         CubeConfig(grid_width=4320, grid_height=2160, spatial_res=1 / 12, end_time=datetime(2001, 12, 31, 23, 0)),
         dir=SOURCE_DIR, var="S")
     provider.prepare()
     images = provider.compute_variable_images(datetime(2001, 1, 1), datetime(2001, 1, 9))
     self.assertIsNotNone(images)
     self.assertTrue('evaporative_stress' in images)
     image = images['evaporative_stress']
     self.assertEqual((2160, 4320), image.shape)
Ejemplo n.º 3
0
 def test_source_time_ranges(self):
     provider = GleamProvider(CubeConfig(end_time=datetime(2001, 12, 31, 23, 0)), dir=SOURCE_DIR, var="E")
     provider.prepare()
     source_time_ranges = provider.source_time_ranges
     self.assertEqual(365, len(source_time_ranges))
     self.assert_source_time_ranges(source_time_ranges[3],
                                    datetime(2001, 1, 4, 0, 0),
                                    datetime(2001, 1, 5, 0, 0),
                                    self.get_source_dir_list(SOURCE_DIR) + ['2001', 'E_2001_GLEAM_v3a_BETA.nc'],
                                    3)
     self.assert_source_time_ranges(source_time_ranges[364],
                                    datetime(2001, 12, 31, 0, 0),
                                    datetime(2002, 1, 1, 0, 0),
                                    self.get_source_dir_list(SOURCE_DIR) + ['2001', 'E_2001_GLEAM_v3a_BETA.nc'],
                                    364)
Ejemplo n.º 4
0
 def test_temporal_coverage(self):
     provider = GleamProvider(CubeConfig(end_time=datetime(2001, 12, 31, 23, 0)), dir=SOURCE_DIR, var="S")
     provider.prepare()
     self.assertEqual((datetime(2001, 1, 1, 0, 0), datetime(2002, 1, 1, 0, 0)),
                      provider.temporal_coverage)