Skip to content

Commit

Permalink
Update tests to Landsat Collection 2
Browse files Browse the repository at this point in the history
Simply changes the Landsat image collections used in the tests from Collection 1 which are deprecated to Collection 2

PiperOrigin-RevId: 626139080
  • Loading branch information
KMarkert authored and Xee authors committed Apr 18, 2024
1 parent c5bd12e commit 8d8c249
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions xee/ext_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ def setUp(self):
super().setUp()
init_ee_for_tests()
self.store = xee.EarthEngineStore(
ee.ImageCollection('LANDSAT/LC08/C01/T1').filterDate(
ee.ImageCollection('LANDSAT/LC08/C02/T1').filterDate(
'2017-01-01', '2017-01-03'
),
n_images=64,
getitem_kwargs={'max_retries': 10, 'initial_delay': 1500},
)
self.store_with_neg_mask_value = xee.EarthEngineStore(
ee.ImageCollection('LANDSAT/LC08/C01/T1').filterDate(
ee.ImageCollection('LANDSAT/LC08/C02/T1').filterDate(
'2017-01-01', '2017-01-03'
),
n_images=64,
Expand All @@ -91,7 +91,7 @@ def setUp(self):
getitem_kwargs={'max_retries': 9},
)
self.all_img_store = xee.EarthEngineStore(
ee.ImageCollection('LANDSAT/LC08/C01/T1').filterDate(
ee.ImageCollection('LANDSAT/LC08/C02/T1').filterDate(
'2017-01-01', '2017-01-03'
)
)
Expand Down Expand Up @@ -271,7 +271,7 @@ def __getitem__(self, params):

def test_geometry_bounds_with_and_without_projection(self):
image = (
ee.ImageCollection('LANDSAT/LC08/C01/T1')
ee.ImageCollection('LANDSAT/LC08/C02/T1')
.filterDate('2017-01-01', '2017-01-03')
.first()
)
Expand Down Expand Up @@ -317,16 +317,16 @@ def setUp(self):
self.entry = xee.EarthEngineBackendEntrypoint()

def test_guess_can_open__collection_name(self):
self.assertTrue(self.entry.guess_can_open('LANDSAT/LC08/C01/T1'))
self.assertTrue(self.entry.guess_can_open('LANDSAT/LC08/C02/T1'))
self.assertFalse(
self.entry.guess_can_open('LANDSAT/SomeRandomCollection/C01/T1')
)
self.assertTrue(self.entry.guess_can_open('ee://LANDSAT/LC08/C01/T1'))
self.assertTrue(self.entry.guess_can_open('ee:LANDSAT/LC08/C01/T1'))
self.assertFalse(self.entry.guess_can_open('ee::LANDSAT/LC08/C01/T1'))
self.assertTrue(self.entry.guess_can_open('ee://LANDSAT/LC08/C02/T1'))
self.assertTrue(self.entry.guess_can_open('ee:LANDSAT/LC08/C02/T1'))
self.assertFalse(self.entry.guess_can_open('ee::LANDSAT/LC08/C02/T1'))

def test_guess_can_open__image_collection(self):
ic = ee.ImageCollection('LANDSAT/LC08/C01/T1').filterDate(
ic = ee.ImageCollection('LANDSAT/LC08/C02/T1').filterDate(
'2017-01-01', '2017-01-03'
)

Expand Down Expand Up @@ -372,7 +372,7 @@ def test_open_dataset__sanity_check_with_negative_scale(self):

def test_open_dataset__n_images(self):
ds = self.entry.open_dataset(
pathlib.Path('LANDSAT') / 'LC08' / 'C01' / 'T1',
pathlib.Path('LANDSAT') / 'LC08' / 'C02' / 'T1',
drop_variables=tuple(f'B{i}' for i in range(3, 12)),
n_images=1,
scale=25.0, # in degrees
Expand Down Expand Up @@ -469,14 +469,14 @@ def test_expected_precise_transform(self):

def test_parses_ee_url(self):
ds = self.entry.open_dataset(
'ee://LANDSAT/LC08/C01/T1',
'ee://LANDSAT/LC08/C02/T1',
drop_variables=tuple(f'B{i}' for i in range(3, 12)),
scale=25.0, # in degrees
n_images=3,
)
self.assertEqual(dict(ds.dims), {'time': 3, 'lon': 14, 'lat': 7})
ds = self.entry.open_dataset(
'ee:LANDSAT/LC08/C01/T1',
'ee:LANDSAT/LC08/C02/T1',
drop_variables=tuple(f'B{i}' for i in range(3, 12)),
scale=25.0, # in degrees
n_images=3,
Expand All @@ -498,7 +498,7 @@ def test_data_sanity_check(self):

def test_validate_band_attrs(self):
ds = self.entry.open_dataset(
'ee:LANDSAT/LC08/C01/T1',
'ee:LANDSAT/LC08/C02/T1',
drop_variables=tuple(f'B{i}' for i in range(3, 12)),
scale=25.0, # in degrees
n_images=3,
Expand Down

0 comments on commit 8d8c249

Please sign in to comment.