1

I am very new to Google Earth Engine and coding.

My goal is to run statistical analysis on a study & control area looking at Vegetation productivity loss across a time period.

I downloaded the ee.ImageCollection("LANDSAT/LC08/C02/T1_TOA") into my script and renamed it L8Data

I created two polygons for my study area var Somalia and Var Kenya

// Filter Landsat 8 Data temporally and spatially;
 
var SomaliaL8 = L8Data.filter(ee.Filter.bounds(Somalia));


var KenyaL8 = L8Data.filter(ee.Filter.bounds(Kenya));

var L8Som2013 = SomaliaL8.filter(ee.Filter.date('2013-04-01', '2013-06-30'));

var L8Ken2013 = KenyaL8.filter(ee.Filter.date('2013-04-01', '2013-06-30'));

var L8Som2021 = SomaliaL8.filter(ee.Filter.date('2021-04-01', '2021-06-30'));

var L8Ken2021 = KenyaL8.filter(ee.Filter.date('2021-04-01', '2021-06-30'));

I want a composite cloud free image for each of those time periods for both defined areas.

So I used this code below i found in a youtube video.

var S2013 = ee.Algorithms.Landsat.simpleComposite({
  collection: SomaliaL8, 
  asFloat: true
  });

var TCV = {min: 0, max: 0.3, bands: ['B4', 'B3', 'B2']};  

 Map.addLayer(S2013.clip(Somalia, TCV, 'S2013'));

 Map.centerObject(Somalia, 10);

I get the error code

Layer 1: Layer error: ImageCollection.reduce: Error in map(ID=LC08_165060_20130409): Landsat.TOA: Band 'B1' is Type, expected Type<Integer<0, 65535>>.

Also when I go to my console and look at the features in the image collection I made there should only be 6 images per year for my filtered dates but I have between 15-20 in each one. They look like replicates repeating the same dates over and over. This has given me hours of headaches.

I want to remove the duplicates and make my cloud free composites so I can finally run NDVI, NPP, GVI, & RDI on the images (probably in ENVI).

1
  • Setting asFloat parameter to false may help in removing the error.
    – Padmanabha
    Commented Oct 19, 2022 at 7:40

1 Answer 1

2

SimpleComposite computes TOA, you can't pass it TOA data. You need to use the raw collection instead:

ee.ImageCollection("LANDSAT/LC08/C02/T1")

Or, use your own compositing, like a median. SimpleComposite is pretty simple.

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.