I have created a grid and I want to plot a time series for each of the squares of this evenly distributed grid.
But I keep getting the same error:
Line 20: ImageCollection.fromImages, argument 'images': Invalid type.
Expected type: List<Image<unknown bands>>.
Actual type: List<ImageCollection>.
Actual value: [<ImageCollection>, <ImageCollection>, <ImageCollection>, <ImageCollection>, <ImageCollection>, <ImageCollection>]
If anyone is kind to provide some help, Id really appreciate it.
This is what I got so far:
var grid = ee.FeatureCollection("projects/ee-moreirarmt/assets/grid")
Map.centerObject(grid)
var chirps_col = ee.ImageCollection("UCSB-CHG/CHIRPS/PENTAD")
.select("precipitation")
.filterDate("2020-01-01", "2021-01-01")
var seq = ee.List.sequence(1, ee.Number(grid.size()))
var vizparam = ({bands:"precipitation",min: 13.39358901977539, max: 27.54470443725586,
palette: ['001137', '0aab1e', 'e7eb05', 'ff4a2d', 'e90000']})
var split_by_each_grid = seq.map(function(x){
var fil = grid.filterMetadata('id', 'equals', x)
var split_chirps_col = chirps_col.filterBounds(fil)
return split_chirps_col.set('id', x)})
var splitted_chirps_col = ee.ImageCollection.fromImages(split_by_each_grid)
for(var a = 1; a < splitted_chirps_col.size().getInfo() + 1; a++){
Map.addLayer(splitted_chirps_col.median().filter(ee.Filter.eq('id',a)), vizparam, "Chirps_per_grid"+a)
}
for(var a = 1; a < final_col.size().getInfo() + 1; a++){
var chart = Chart.image.seriesByRegion(splitted_chirps_col.filter(ee.Filter.eq('id',a)), grid, ee.Reducer.mean(), "precipitation", 5500)
print(chart)
}
Here's the code: https://code.earthengine.google.com/fbdf0b0e9e1f395eaa8435b805bdc809
Thanks in advance and stay safe.