Skip to content

Commit

Permalink
Update LCMS datasets to v2022.8 (#43) (#44)
Browse files Browse the repository at this point in the history
The issue in #43 was caused by outdated LCMS datasets. This updates
to the new versions. Additionally, the year ranges for LCMS and LCMAP
datasets are extended to include newly added years.
  • Loading branch information
aazuspan authored Jun 28, 2023
1 parent f28e686 commit 5e8230e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions sankee/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def get_year(self, year: int) -> ee.Image:

LCMS_LU = LCMS_Dataset(
name="LCMS LU - Land Change Monitoring System Land Use",
id="USFS/GTAC/LCMS/v2021-7",
id="USFS/GTAC/LCMS/v2022-8",
band="Land_Use",
labels={
1: "Agriculture",
Expand All @@ -251,14 +251,14 @@ def get_year(self, year: int) -> ee.Image:
6: "#c2b34a",
7: "#1B1716",
},
years=tuple(range(1985, 2022)),
years=tuple(range(1985, 2023)),
nodata=7,
)

# https://developers.google.com/earth-engine/datasets/catalog/USFS_GTAC_LCMS_v2020-5
LCMS_LC = LCMS_Dataset(
name="LCMS LC - Land Change Monitoring System Land Cover",
id="USFS/GTAC/LCMS/v2021-7",
id="USFS/GTAC/LCMS/v2022-8",
band="Land_Cover",
labels={
1: "Trees",
Expand Down Expand Up @@ -294,7 +294,7 @@ def get_year(self, year: int) -> ee.Image:
14: "#4780f3",
15: "#1B1716",
},
years=tuple(range(1985, 2022)),
years=tuple(range(1985, 2023)),
nodata=15,
)

Expand Down Expand Up @@ -663,7 +663,7 @@ def get_year(self, year: int) -> ee.Image:
7: "#FFFFFF",
8: "#B3B0A3",
},
years=tuple(range(1985, 2021)),
years=tuple(range(1985, 2022)),
)

CORINE = Dataset(
Expand Down
12 changes: 6 additions & 6 deletions tests/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ def test_get_year_nlcd():
def test_get_year_LCMS_LC():
dataset = sankee.datasets.LCMS_LC
img = dataset.get_year(2016)
assert img.get("system:id").getInfo() == "USFS/GTAC/LCMS/v2021-7/LCMS_CONUS_v2021-7_2016"
assert img.get("system:id").getInfo() == "USFS/GTAC/LCMS/v2022-8/LCMS_CONUS_v2022-8_2016"
assert img.bandNames().getInfo() == [dataset.band]


def test_get_year_LCMS_LU():
dataset = sankee.datasets.LCMS_LU
img = dataset.get_year(2016)
assert img.get("system:id").getInfo() == "USFS/GTAC/LCMS/v2021-7/LCMS_CONUS_v2021-7_2016"
assert img.get("system:id").getInfo() == "USFS/GTAC/LCMS/v2022-8/LCMS_CONUS_v2022-8_2016"
assert img.bandNames().getInfo() == [dataset.band]


Expand Down Expand Up @@ -66,7 +66,7 @@ def test_get_year_LCMAP():
img = dataset.get_year(2016)
assert (
img.get("system:id").getInfo()
== "projects/sat-io/open-datasets/LCMAP/LCPRI/LCMAP_CU_2016_V12_LCPRI"
== "projects/sat-io/open-datasets/LCMAP/LCPRI/LCMAP_CU_2016_V13_LCPRI"
)
assert img.bandNames().getInfo() == [dataset.band]

Expand All @@ -80,9 +80,9 @@ def test_get_year_CORINE():
assert img.bandNames().getInfo() == [dataset.band]


def test_years():
for dataset in sankee.datasets.datasets:
assert dataset.years == tuple(dataset.list_years().getInfo())
@pytest.mark.parametrize("dataset", sankee.datasets.datasets, ids=lambda d: d.name)
def test_years(dataset):
assert dataset.years == tuple(dataset.list_years().getInfo())


def test_get_unsupported_year():
Expand Down

0 comments on commit 5e8230e

Please sign in to comment.