Currently, the second example in the readme (code below) throws a KeyError when the max_classes are filtered
# Load a set of classified images
img_list = [
ee.Image("GOOGLE/DYNAMICWORLD/V1/20210616T185919_20210616T190431_T10TEQ"),
ee.Image("GOOGLE/DYNAMICWORLD/V1/20210706T185919_20210706T190638_T10TEQ")
]
# Which band contains the classified data?
band = "label"
# What labels correspond to which pixel values?
labels = {
0: "Water", 1: "Trees", 2: "Grass", 3: "Flooded", 4: "Crops",
5: "Shrub / Scrub", 6: "Build", 7: "Bare", 8: "Snow / Ice",
}
# What colors should be applied to which pixel values?
palette = {
0: "#419BDF", 1: "#397D49", 2: "#88B053", 3: "#7A87C6", 4: "#E49635",
5: "#DFC35A", 6: "#C4281B", 7: "#A59B8F", 8: "#B39FE1"
}
plot = sankee.sankify(
image_list=img_list,
band=band,
labels=labels,
palette=palette,
region=ee.Geometry.Point([-121.80183, 44.67655]).buffer(3000),
max_classes=3,
title="Mt. Jefferson Snow Loss - June 2021"
)
The root cause seems to be that sampling.collect_sankee_data returns mixed datatypes due to NaN sampled values. Casting to int after removing NaNs should resolve this.
Currently, the second example in the readme (code below) throws a
KeyError
when themax_classes
are filteredThe root cause seems to be that
sampling.collect_sankee_data
returns mixed datatypes due to NaN sampled values. Casting toint
after removing NaNs should resolve this.