Monthly Evapotranspiration

What is the monthly variability in ET?

Step 1: import the mod16 data

Step 2: Set the date variables

// set start and end year
var startyear = 2000;
var endyear = 2014;

// make a date object
var startdate = ee.Date.fromYMD(startyear, 1, 1);
var enddate = ee.Date.fromYMD(endyear + 1, 1, 1);

// make a list with years
var years = ee.List.sequence(startyear, endyear);
// make a list with months
var months = ee.List.sequence(1, 12);

Step 3: Set the geography

// Specify Country names
var country_names = ['Indonesia'];

// Get the country boundaries
var countries = ee.FeatureCollection('ft:1tdSwUL7MVpOauSgRzqVTOwdfy17KDbw-1d9omPw');

// Filter for country
var Indonesia = countries.filter(ee.Filter.inList('Country', country_names));

// Get the geometry
var Indonesia = Indonesia.geometry();

// Get ET
var ET = mod16.select("ET")

Step 4: Calculate monthly precipitation

var monthlyET = ee.ImageCollection.fromImages(
 years.map(function (y) {
 return months.map(function(m) {
 var w = ET.filter(ee.Filter.calendarRange(y, y, 'year'))
 .filter(ee.Filter.calendarRange(m, m, 'month'))
 .sum()
 .multiply(0.1);
 return w.set('year', y)
 .set('month', m)
 .set('system:time_start', ee.Date.fromYMD(y, m, 1));

 });
 }).flatten()
);

Step 5: Calculate monthly precipitation

var meanMonthlyP =  ee.ImageCollection.fromImages(
  months.map(function (m) {
    var w = monthlyPrecip.filter(ee.Filter.eq('month', m)).mean();
    return w.set('month', m)
            .set('system:time_start',ee.Date.fromYMD(1, m, 1));
  }).flatten()
);

 

Step 6: Create and plot the chart

var title = {
title: 'Monthly ET',
hAxis: {title: 'Time'},
vAxis: {title: 'ET (mm)'},
};


var chartMonthly = ui.Chart.image.seriesByRegion({
imageCollection: meanMonthlyET,
regions: Indonesia,
reducer: ee.Reducer.mean(),
band: 'ET',
scale: 2500,
xProperty: 'system:time_start',
seriesProperty: 'SITE'
}).setOptions(title)
.setChartType('ColumnChart');

print(chartMonthly);

See an example here

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s