0

I am trying to find, clip and download some GEDI data from GEE and I'm getting a casting error. My simple code is:

var GEDI = ee.ImageCollection('LARSE/GEDI/GEDI02_A_002_MONTHLY')
        .filter(ee.Filter.date('2019-06-01','2021-12-31'))
        .filterBounds(geometry)
        
var GEDI_bands = GEDI.mean().toFloat()

var rh100 = GEDI_bands.select('rh100')
Map.addLayer(rh100, {min:0,max:20})

I'm sure I've attempted to fix this by using .toFloat() but I keep getting the error:

Layer 1: Tile error: Expected a homogeneous image collection, but an image with an incompatible band was encountered. Mismatched type for band 'beam': Expected type: Integer. Actual type: Float. Image ID: 201908_036E_024S This band might require an explicit cast.

How can I fix this?

2 Answers 2

1

I'm not really sure why the 'beam' band is giving trouble. However, you can make use of a regular expression to select all the bands that are not 'beam' to avoid the error and continue with the clipping and exporting processes.

var GEDI_bands = GEDI.select('[^(beam)].*').mean();
3
  • Yeah looks like there's an issue with the 'beam' band. Your solution to get around it would work but I also found a way around it that allows me to keep the band
    – GeoMonkey
    Dec 17, 2021 at 14:59
  • Could you post your workaround as an answer? Dec 17, 2021 at 15:03
  • posted above :)
    – GeoMonkey
    Dec 17, 2021 at 15:07
1

This GEDI data is still under testing so there may be an issue with the 'beam' band. In the meantime, this worked:

var GEDI = ee.ImageCollection('LARSE/GEDI/GEDI02_A_002_MONTHLY')
        .filter(ee.Filter.date('2019-06-01','2021-12-31'))
        .filterBounds(geometry)
        
var GEDI_bands = GEDI.map(function(img){
var int = img.select(['beam','degrade_flag']).toInt()
var float = img.select(['rh.*'])
return int.addBands(float)
}).reduce(ee.Reducer.mean())

Map.addLayer(GEDI_bands, {min:0,max:20})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.