Geographic Information Systems Asked on April 6, 2021
I am fairly new to coding.
I have the below code to generate monthly NDVI data for each of the 15 regions. I can do them all individually, but it does take some time.
Are there any method of shortening l the process?
Also then I open each chart and download in CSV individually.
Also any code that can help to shorten this process?
IE I do the print chart 15 times.
var roi = ee.FeatureCollection([
ee.Feature(ee.Geometry.Point(18.445709161313030,-33.301100219893542), {name: '00'}),
ee.Feature(ee.Geometry.Point(18.3283136995220101,-33.496446074764073), {name: '01'}),
ee.Feature(ee.Geometry.Point(18.3283136995220101,-33.363695665206592), {name: '02'}),
ee.Feature(ee.Geometry.Point(18.358508029205840,-33.477911798216702), {name: '03'}),
ee.Feature(ee.Geometry.Point(18.555547014896824,-32.963288018732484), {name: '04'}),
ee.Feature(ee.Geometry.Point(18.784147795713817,-33.421796302215846), {name: '05'}),
ee.Feature(ee.Geometry.Point(18.797906906920584,-33.084616837828598), {name: '06'}),
ee.Feature(ee.Geometry.Point(18.736492301824644,-33.379593144167053), {name: '07'}),
ee.Feature(ee.Geometry.Point(18.608583989022776,-33.304010136472058), {name: '08'}),
ee.Feature(ee.Geometry.Point(18.606336164825368,-33.520022728206399), {name: '09'}),
ee.Feature(ee.Geometry.Point(18.919324659544490,-33.313052298558752), {name: '10'}),
ee.Feature(ee.Geometry.Point(18.239021712114891,-33.161666295743785), {name: '11'}),
ee.Feature(ee.Geometry.Point(18.298810314491927,-33.220923915024990), {name: '12'}),
ee.Feature(ee.Geometry.Point(18.519748581700082,-33.348942987836971), {name: '13'}),
ee.Feature(ee.Geometry.Point(18.784555700711259,-33.282413353935581), {name: '14'}),
]);
Map.addLayer(roi);
var startDate = ee.Date('1982-01-01'); // set start time for analysis
var endDate = ee.Date('2020-12-30'); // set end time for analysis
var nMonths = ee.Number(endDate.difference(startDate,'month')).round();
var ndvi = ee.ImageCollection('NOAA/CDR/AVHRR/NDVI/V5').select('NDVI')
.filterDate(startDate, endDate);
var byMonth = ee.ImageCollection(
ee.List.sequence(0,nMonths).map(function (n) {
var ini = startDate.advance(n,'month');
var end = ini.advance(1,'month');
return ndvi.filterDate(ini,end)
.select(0).mean()
.set('system:time_start', ini);
}));
// plot full time series
print(
ui.Chart.image.series({
imageCollection: byMonth,
region: table0,
reducer: ee.Reducer.mean(),
scale: 1000
}).setOptions({title: 'NDVI over time 0'})
);
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP