[GIS] Timelapse in Google Earth Engine

google-earth-enginesentinel 5pvideo

I've wrote below code for an aerosol changes video, using Sentinel-5 products. When I'm going to save the video in Google Drive this error occurred:

Task details: myvideo

State: Failed

Started 17s ago (2019-08-27 20:18:34 +0430)

Runtime: 9s

Id: ZTMTUZWKR2TUL3TXP0E57VBZ

Source script

Error: ImageCollection must have 3 or 4 bands

code link: https://code.earthengine.google.com/9127141eaed10f0c40b485f488c202e9

var dust = ee.ImageCollection('COPERNICUS/S5P/NRTI/L3_AER_AI')
.filterBounds(table)
.filterDate('2018-01-01','2020-01-01')
.select('absorbing_aerosol_index');


var dust_test = dust.map(function(img){
return img.clip(table);
});

var coll4Video = dust_test
  .map(function(image) {
    return image.uint8();   // need to make it 8-bit
  });

Export.video.toDrive({
    collection: coll4Video,
    description: "myvideo" ,
    scale: 1000,
    framesPerSecond: 2,
    region: table
});

Best Answer

As the error says, Video export requires your images must have 3 bands (r,g,b) or 4 bands (r,g,b,alpha). Your image has only 1 band. You can call visualize() on it to apply a visualization and convert it to a 3-band image appropriate for export.

var dust = ee.ImageCollection('COPERNICUS/S5P/NRTI/L3_AER_AI')
.filterBounds(table)
.filterDate('2018-01-01','2020-01-01')
.select('absorbing_aerosol_index');


var dust_test = dust.map(function(img){
return img.clip(table);
});

var val_max = 2.0;
var val_min = -1;
var band_viz = {
  min: val_min,
  max: val_max,
  opacity: 1.0,
  palette: ["black", "blue", "purple", "cyan", "green", "yellow", "red"]
};

var coll4Video = dust_test
  .map(function(image) {
    return image.visualize(band_viz);
  });

Map.addLayer(coll4Video)
Export.video.toDrive({
    collection: coll4Video,
    description: "myvideo" ,
    scale: 1000,
    framesPerSecond: 2,
    region: table
});

Code link https://code.earthengine.google.com/7366d0ea6c24f3bcf3f3c0bf4eb623e9

Related Question