I have a code which creates a value for several different variables for a specific time period (usually over 1 month) and exports these as a CSV to my Google drive. You can find a link to the code here.
At the moment, if I want to create the code for different dates I just do this manually, by altering the startDate and endDate line in my code.
// select dates
var startDate = ee.Date('2016-01-01');
var endDate = ee.Date('2016-02-01');
var startyear = 2016; //
var endyear = 2016;
Export.table.toDrive({
collection: Dat,
description: 'Dat',
selectors: cols,
fileFormat: 'CSV'
});
The above would then create the data values for January 2016, and export it as a task which I then run in the google earth engine console.
I'm looking to automate this so I can get monthly values over a number of years, or values for specific months within each year, with out having to do this manually. So rather than changing the startDate, endDate, startyear and endyear manually, it would run the code and start again.
I'm aware in some coding systems you can do this with for loops, but I'm not familiar with them at all, and in Google Earth Engine these are not recommended.
Is it simple enough to set up a function that calculates the score for four months (e.g. for Jan, April, July and October) for a set number of years (say 2003-2019), so it would run the score for Jan 2003, then for April 2003, July 2003, etc?