Skip to content

Commit

Permalink
Test tasseledCap (r-earthengine#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
aazuspan committed Sep 24, 2021
1 parent 88a499d commit 92ce442
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/test_Spectral.py
Expand Up @@ -32,6 +32,23 @@
"MODIS/006/MCD43A4",
]

tasseledcap_datasets = [
"COPERNICUS/S2",
"MODIS/006/MCD43A4",
"LANDSAT/LC08/C01/T1_TOA",
"LANDSAT/LC08/C01/T1_RT_TOA",
"LANDSAT/LC08/C01/T2_TOA",
"LANDSAT/LE07/C01/T1_TOA",
"LANDSAT/LE07/C01/T1_RT_TOA",
"LANDSAT/LE07/C01/T2_TOA",
"LANDSAT/LT05/C01/T1",
"LANDSAT/LT05/C01/T2",
"LANDSAT/LT04/C02/T1_L2",
"LANDSAT/LT04/C02/T2_L2",
"LANDSAT/LT04/C01/T1",
"LANDSAT/LT04/C01/T2",
]


class Test(unittest.TestCase):
"""Tests for ee_extra package."""
Expand All @@ -56,6 +73,16 @@ def test_listIndices(self):
self.assertIsInstance(listIndices(), list)
self.assertIsInstance(listIndices(True), list)

def test_tasseledCap(self):
"""Test the tasseledCap() method"""
for dataset in tasseledcap_datasets:
with self.subTest(i=dataset):
x = ee.ImageCollection(dataset).filterBounds(point).limit(10)
self.assertIsInstance(tasseledCap(x), ee.imagecollection.ImageCollection)

x = ee.ImageCollection(dataset).filterBounds(point).first()
self.assertIsInstance(tasseledCap(x), ee.image.Image)


if __name__ == "__main__":
unittest.main()

0 comments on commit 92ce442

Please sign in to comment.