You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Discovered this serious issue with how XEE deals with image bands. A typical GEE workflow is to add new bands to existing images after computing indices or for other dependent vairables for classificaiton. When one adds a new band, the 'system:id' doesn't change and XEE uses that to fetch the list of bands for further processing. For example, consider the following snippet
def addNDVI(image):
ndvi = image.normalizedDifference(['B8', 'B4']).rename('ndvi')
return image.addBands(ndvi)
# Map the function over the collection
withNdvi = filtered.map(addNDVI)
This results in errors such as
EEException: Image.addBands: Cannot add band 'ndvi' because it doesn't appear in srcImg.
If one modifies the image in any way, the system:id gets overwritten and this problem doesn't arise. See example below
# Modify the function to create a 'new' image
def addNDVI(image):
ndvi = image.normalizedDifference(['B8', 'B4']).rename('ndvi')
return image.multiply(0.0001).addBands(ndvi).copyProperties(image, ['system:time_start'])
# Map the function over the collection
withNdvi = filtered.map(addNDVI)
My guess is due to the fact that XEE gets the metadata based on 'system:id'. This behavior is problematic and can cause a lot of very hard-to-debug errors.
Add a new `fast_time_slicing` parameter. If True, Xee performs an optimization that makes slicing an ImageCollection across time faster. This optimization loads EE images in a slice by ID, so any modifications to images in a computed ImageCollection will not be reflected.
For those familiar with the code before, the else flow in `_slice_collection` was only entered when images in the collection didn't have IDs. Clearing the image IDs triggered the else block.
Also adds several new warnings:
- if a user enables `fast_time_slicing` but there are no image IDs, and
- if a user is indexing into a very large ImageCollection.
Fixes#88 and #145.
PiperOrigin-RevId: 623280839
Discovered this serious issue with how XEE deals with image bands. A typical GEE workflow is to add new bands to existing images after computing indices or for other dependent vairables for classificaiton. When one adds a new band, the 'system:id' doesn't change and XEE uses that to fetch the list of bands for further processing. For example, consider the following snippet
This results in errors such as
EEException: Image.addBands: Cannot add band 'ndvi' because it doesn't appear in srcImg.
If one modifies the image in any way, the
system:id
gets overwritten and this problem doesn't arise. See example belowMy guess is due to the fact that XEE gets the metadata based on 'system:id'. This behavior is problematic and can cause a lot of very hard-to-debug errors.
Here's a full notebook that reproduces this error https://colab.research.google.com/drive/1MvayipJAwiYWWyMfGwiRiPy8RmUaCqc6?usp=sharing
The text was updated successfully, but these errors were encountered: