Skip to content

Commit

Permalink
Fix references to deprecated Landsat Collection 1.
Browse files Browse the repository at this point in the history
This fixes broken tests in xee.ext_integration_test.py

The tests were broken because the Landsat collection LANDSAT/LC08/C01/T1 was removed from Earth Engine. PR #157 was supposed to fix this but missed some references to "C01". This replaces all references to "C01" with "C02" which is available in the data catalog.

PiperOrigin-RevId: 655690325
  • Loading branch information
KMarkert authored and Xee authors committed Jul 25, 2024
1 parent 53cb53b commit 39e0d7d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions xee/ext_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def init_ee_for_tests():
init_params = {
'opt_url': ee.data.HIGH_VOLUME_API_BASE_URL,
}
if not os.environ.get(_USE_ADC_CREDENTIALS_KEY, False):
init_params['credentials'] = _read_identity_pool_creds()
# if not os.environ.get(_USE_ADC_CREDENTIALS_KEY, False):
# init_params['credentials'] = _read_identity_pool_creds()
ee.Initialize(**init_params)


Expand Down Expand Up @@ -319,7 +319,7 @@ def setUp(self):
def test_guess_can_open__collection_name(self):
self.assertTrue(self.entry.guess_can_open('LANDSAT/LC08/C02/T1'))
self.assertFalse(
self.entry.guess_can_open('LANDSAT/SomeRandomCollection/C01/T1')
self.entry.guess_can_open('LANDSAT/SomeRandomCollection/C02/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'))
Expand All @@ -336,7 +336,7 @@ def test_guess_can_open__image_collection(self):

def test_open_dataset__sanity_check(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=3,
projection=ee.Projection('EPSG:4326', [25, 0, 0, 0, -25, 0]),
Expand All @@ -345,7 +345,8 @@ def test_open_dataset__sanity_check(self):
self.assertNotEmpty(dict(ds.coords))
self.assertEqual(
list(ds.data_vars.keys()),
[f'B{i}' for i in range(1, 3)] + ['BQA'],
[f'B{i}' for i in range(1, 3)] +
['QA_PIXEL', 'QA_RADSAT', 'SAA', 'SZA', 'VAA', 'VZA'],
)
for v in ds.values():
self.assertIsNotNone(v.data)
Expand All @@ -354,7 +355,7 @@ def test_open_dataset__sanity_check(self):

def test_open_dataset__sanity_check_with_negative_scale(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)),
scale=-25.0, # in degrees
n_images=3,
Expand All @@ -363,7 +364,8 @@ def test_open_dataset__sanity_check_with_negative_scale(self):
self.assertNotEmpty(dict(ds.coords))
self.assertEqual(
list(ds.data_vars.keys()),
[f'B{i}' for i in range(1, 3)] + ['BQA'],
[f'B{i}' for i in range(1, 3)] +
['QA_PIXEL', 'QA_RADSAT', 'SAA', 'SZA', 'VAA', 'VZA'],
)
for v in ds.values():
self.assertIsNotNone(v.data)
Expand Down

0 comments on commit 39e0d7d

Please sign in to comment.