Escribí el siguiente código donde una ImageCollection se multiplica por diferentes factores de escala (469 en total). He creado una lista con todos los factores y la he combinado con la ImageCollection para multiplicar cada mes con su correspondiente factor. Los resultados muestran una colección final con el factor de escala aplicado.
https://code.earthengine.google.com/203deb3d2f9c19afe9236f4e53efbd0c
Sin embargo, en la ImageCollection final falta la propiedad system:time_index. Estaba tratando de usar .CopyProperties pero honestamente, no sé dónde.
¿Alguna sugerencia?
var sum_month = ee.List.sequence(0, 39*12).map(function(n) { // .sequence: number of years from starting year to present
var start = ee.Date('1981-01-01').advance(n, 'month'); // Starting date
var end = start.advance(1, 'month'); // Step by each iteration
return ee.ImageCollection("UCSB-CHG/CHIRPS/DAILY")
.filterDate(start, end)
.sum()
.set('system:time_start', start.millis());
});
var collection = ee.ImageCollection(sum_month)
var list = ee.List([
0.884748080310752,
0.884748080310752,
0.884748080310752,
0.884748080310752,
0.884748080310752,
0.884748080310752,
0.884748080310752,
0.884748080310752,
0.884748080310752,
0.884748080310752,
0.884748080310752,
0.839632014230907,
0.839632014230907,
0.839632014230907,
0.839632014230907,
0.839632014230907,
0.839632014230907,
0.839632014230907,
0.839632014230907,
0.839632014230907,
0.839632014230907,
0.839632014230907,
0.839632014230907,
1.1229204406206,
1.1229204406206,
1.1229204406206,
1.1229204406206,
1.1229204406206,
1.1229204406206,
1.1229204406206,
1.1229204406206,
1.1229204406206,
1.1229204406206,
1.1229204406206,
1.1229204406206,
0.940763778922923,
0.940763778922923,
0.940763778922923,
0.940763778922923,
0.940763778922923,
0.940763778922923,
0.940763778922923,
0.940763778922923,
0.940763778922923,
0.940763778922923,
0.940763778922923,
0.940763778922923,
0.74844803241941,
0.74844803241941,
0.74844803241941,
0.74844803241941,
0.74844803241941,
0.74844803241941,
0.74844803241941,
0.74844803241941,
0.74844803241941,
0.74844803241941,
0.74844803241941,
0.74844803241941,
0.72039682140522,
0.72039682140522,
0.72039682140522,
0.72039682140522,
0.72039682140522,
0.72039682140522,
0.72039682140522,
0.72039682140522,
0.72039682140522,
0.72039682140522,
0.72039682140522,
0.72039682140522,
0.783237079191968,
0.783237079191968,
0.783237079191968,
0.783237079191968,
0.783237079191968,
0.783237079191968,
0.783237079191968,
0.783237079191968,
0.783237079191968,
0.783237079191968,
0.783237079191968,
0.783237079191968,
0.731030391679879,
0.731030391679879,
0.731030391679879,
0.731030391679879,
0.731030391679879,
0.731030391679879,
0.731030391679879,
0.731030391679879,
0.731030391679879,
0.731030391679879,
0.731030391679879,
0.731030391679879,
0.9502595494971,
0.9502595494971,
0.9502595494971,
0.9502595494971,
0.9502595494971,
0.9502595494971,
0.9502595494971,
0.9502595494971,
0.9502595494971,
0.9502595494971,
0.9502595494971,
0.9502595494971,
0.717754884271775,
0.717754884271775,
0.717754884271775,
0.717754884271775,
0.717754884271775,
0.717754884271775,
0.717754884271775,
0.717754884271775,
0.717754884271775,
0.717754884271775,
0.717754884271775,
0.717754884271775,
0.748972997706123,
0.748972997706123,
0.748972997706123,
0.748972997706123,
0.748972997706123,
0.748972997706123,
0.748972997706123,
0.748972997706123,
0.748972997706123,
0.748972997706123,
0.748972997706123,
0.748972997706123,
0.731569637966974,
0.731569637966974,
0.731569637966974,
0.731569637966974,
0.731569637966974,
0.731569637966974,
0.731569637966974,
0.731569637966974,
0.731569637966974,
0.731569637966974,
0.731569637966974,
0.731569637966974,
0.82600544303205,
0.82600544303205,
0.82600544303205,
0.82600544303205,
0.82600544303205,
0.82600544303205,
0.82600544303205,
0.82600544303205,
0.82600544303205,
0.82600544303205,
0.82600544303205,
0.82600544303205,
0.860265230004144,
0.860265230004144,
0.860265230004144,
0.860265230004144,
0.860265230004144,
0.860265230004144,
0.860265230004144,
0.860265230004144,
0.860265230004144,
0.860265230004144,
0.860265230004144,
0.860265230004144,
0.862360483501427,
0.862360483501427,
0.862360483501427,
0.862360483501427,
0.862360483501427,
0.862360483501427,
0.862360483501427,
0.862360483501427,
0.862360483501427,
0.862360483501427,
0.862360483501427,
0.862360483501427,
0.81595650516483,
0.81595650516483,
0.81595650516483,
0.81595650516483,
0.81595650516483,
0.81595650516483,
0.81595650516483,
0.81595650516483,
0.81595650516483,
0.81595650516483,
0.81595650516483,
0.81595650516483,
0.821726883652184,
0.821726883652184,
0.821726883652184,
0.821726883652184,
0.821726883652184,
0.821726883652184,
0.821726883652184,
0.821726883652184,
0.821726883652184,
0.821726883652184,
0.821726883652184,
0.821726883652184,
1.00465118580511,
1.00465118580511,
1.00465118580511,
1.00465118580511,
1.00465118580511,
1.00465118580511,
1.00465118580511,
1.00465118580511,
1.00465118580511,
1.00465118580511,
1.00465118580511,
1.00465118580511,
1.01705694232554,
1.01705694232554,
1.01705694232554,
1.01705694232554,
1.01705694232554,
1.01705694232554,
1.01705694232554,
1.01705694232554,
1.01705694232554,
1.01705694232554,
1.01705694232554,
1.01705694232554,
1.1700312418641,
1.1700312418641,
1.1700312418641,
1.1700312418641,
1.1700312418641,
1.1700312418641,
1.1700312418641,
1.1700312418641,
1.1700312418641,
1.1700312418641,
1.1700312418641,
1.1700312418641,
1.03065226648825,
1.03065226648825,
1.03065226648825,
1.03065226648825,
1.03065226648825,
1.03065226648825,
1.03065226648825,
1.03065226648825,
1.03065226648825,
1.03065226648825,
1.03065226648825,
1.03065226648825,
0.984661287553648,
0.984661287553648,
0.984661287553648,
0.984661287553648,
0.984661287553648,
0.984661287553648,
0.984661287553648,
0.984661287553648,
0.984661287553648,
0.984661287553648,
0.984661287553648,
0.984661287553648,
1.10198473295472,
1.10198473295472,
1.10198473295472,
1.10198473295472,
1.10198473295472,
1.10198473295472,
1.10198473295472,
1.10198473295472,
1.10198473295472,
1.10198473295472,
1.10198473295472,
1.10198473295472,
1.19921300316797,
1.19921300316797,
1.19921300316797,
1.19921300316797,
1.19921300316797,
1.19921300316797,
1.19921300316797,
1.19921300316797,
1.19921300316797,
1.19921300316797,
1.19921300316797,
1.19921300316797,
0.976655549015761,
0.976655549015761,
0.976655549015761,
0.976655549015761,
0.976655549015761,
0.976655549015761,
0.976655549015761,
0.976655549015761,
0.976655549015761,
0.976655549015761,
0.976655549015761,
0.976655549015761,
1.00965253592154,
1.00965253592154,
1.00965253592154,
1.00965253592154,
1.00965253592154,
1.00965253592154,
1.00965253592154,
1.00965253592154,
1.00965253592154,
1.00965253592154,
1.00965253592154,
1.00965253592154,
0.906334059359132,
0.906334059359132,
0.906334059359132,
0.906334059359132,
0.906334059359132,
0.906334059359132,
0.906334059359132,
0.906334059359132,
0.906334059359132,
0.906334059359132,
0.906334059359132,
0.906334059359132,
1.14708067935416,
1.14708067935416,
1.14708067935416,
1.14708067935416,
1.14708067935416,
1.14708067935416,
1.14708067935416,
1.14708067935416,
1.14708067935416,
1.14708067935416,
1.14708067935416,
1.14708067935416,
0.955497703496012,
0.955497703496012,
0.955497703496012,
0.955497703496012,
0.955497703496012,
0.955497703496012,
0.955497703496012,
0.955497703496012,
0.955497703496012,
0.955497703496012,
0.955497703496012,
0.955497703496012,
0.804850441796246,
0.804850441796246,
0.804850441796246,
0.804850441796246,
0.804850441796246,
0.804850441796246,
0.804850441796246,
0.804850441796246,
0.804850441796246,
0.804850441796246,
0.804850441796246,
0.804850441796246,
0.887492658652853,
0.887492658652853,
0.887492658652853,
0.887492658652853,
0.887492658652853,
0.887492658652853,
0.887492658652853,
0.887492658652853,
0.887492658652853,
0.887492658652853,
0.887492658652853,
0.887492658652853,
0.946400263687437,
0.946400263687437,
0.946400263687437,
0.946400263687437,
0.946400263687437,
0.946400263687437,
0.946400263687437,
0.946400263687437,
0.946400263687437,
0.946400263687437,
0.946400263687437,
0.946400263687437,
0.921730362937116,
0.921730362937116,
0.921730362937116,
0.921730362937116,
0.921730362937116,
0.921730362937116,
0.921730362937116,
0.921730362937116,
0.921730362937116,
0.921730362937116,
0.921730362937116,
0.921730362937116,
1.03023550595632,
1.03023550595632,
1.03023550595632,
1.03023550595632,
1.03023550595632,
1.03023550595632,
1.03023550595632,
1.03023550595632,
1.03023550595632,
1.03023550595632,
1.03023550595632,
1.03023550595632,
0.921572456964006,
0.921572456964006,
0.921572456964006,
0.921572456964006,
0.921572456964006,
0.921572456964006,
0.921572456964006,
0.921572456964006,
0.921572456964006,
0.921572456964006,
0.921572456964006,
0.921572456964006,
0.889937018095707,
0.889937018095707,
0.889937018095707,
0.889937018095707,
0.889937018095707,
0.889937018095707,
0.889937018095707,
0.889937018095707,
0.889937018095707,
0.889937018095707,
0.889937018095707,
0.889937018095707,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386,
0.916992726360386
]);
//Create an Image Collection, each image.constant(value of list)
var Image_Multiplication = function(collection,valuelist){
var list_size = valuelist.size();
var sequence = ee.List.sequence(0,list_size.subtract(ee.Number(1)));
var value_collection = ee.ImageCollection(sequence.map(function(i){
return ee.Image.constant(list.get(i));
}));
var value_collection_list = value_collection.toList(value_collection.size());
var collection_list = collection.toList(collection.size());
return ee.ImageCollection(sequence.map(function(i){
var image = ee.Image(collection_list.get(ee.Number(i)));
var value_image = ee.Image(value_collection_list.get(ee.Number(i)));
var multiplication_image = image.multiply(value_image);
return ee.Image(multiplication_image);
}));
};
var value_collection = Image_Multiplication(collection,list);
print(value_collection);
Map.addLayer(collection.first(),{},'Original Images',false);
Map.addLayer(value_collection.first(),{},'Multiplied Image',false);