I am trying to download time series data of AVI using Sentinel 2 also I want to make a time series chart?
This is my code:
var batch = require('users/fitoprincipe/geetools:batch')
var avi = function(image) {
return image.select().addBands(image.expression(
'NIR * ((1 - RED) * (NIR - RED))**(1/3)', {
'NIR': image.select('B8'),
'RED': image.select('B4')
}).float()).rename('AVI')};
// Import all available Sentinel 2 surface reflectance imagery as an ee.ImageCollection
// and filter for images within your study area
var S2_SR = ee.ImageCollection('COPERNICUS/S2_SR').filter(ee.Filter.date('2015-10-01', '2021-12-31')).select([
// Make this list whichever bands you want to view or analyze
'B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8','B8A','B9','B11','B12'
]).map(avi)
var clippedSAR= S2_SR.map(function(im){
return im.clip(geometry);
});
// Center your map at your study area
var visParams = {
min: 0,
max: 20000,
gamma: 1.2,
bands: ['B4', 'B8', 'B2'],
};
Map.addLayer(geometry);
Map.centerObject(geometry);
var chart = Chart.image.series(avi, geometry, ee.Reducer.mean(),1000, 'system:time_start').setOptions({
title: 'AVI',
vAxis: {title: 'NIR & RED'},
});
print(chart)
batch.Download.ImageCollection.toDrive(avi, 'work',
{scale: 30,
region: geometry,
type: 'float',
description: 'Landsat8',
maxPixels: 1e13,
fileFormat: 'GeoTIFF',
})