Wednesday 20 December 2017

Google Earth Engine chart error: No features contain non-null values of “year”



I'm trying to plot a chart from a collection I have created. While the data from this collection maps fine, I can't seem to produce a chart for it. Here is the code:


var l5_coll = ee.ImageCollection('LANDSAT/LT5_L1T_TOA'); 
var f1 = ee.Filter.dateRangeContains('1986-01-01','1998-08-31');
var f2 = ee.Filter.dateRangeContains('1998-10-15','2019-12-31');
var f3 = ee.Filter.dateRangeContains('f1','f2');
var f4 = l5_coll.filter(f3);

var merged_collection = ee.ImageCollection(f4);
// filter the ImageCollection with the boundary of the selected country
var iC = merged_collection.filterBounds(selectedCountry.geometry());
iC = iC.map(function(img){
var year = img.date().format("Y"); // get the acquisition year
var CC = img.get('CLOUD_COVER')
return img.set('year', ee.Number.parse(year)).set('clouds', ee.Number.parse(CC)); //
});

var iC_FC = ee.FeatureCollection(iC);

var iC_FC_size = iC_FC.size();
var options1 = {
title: 'Landsat Mission 4-8 - GEE image availability',
hAxis: {title: 'Year'},
vAxis: {title: 'Image count'},
colors: ['red']
};

var histogram = ui.Chart.feature.histogram({
features: iC_FC,

property: 'year',
minBucketWidth: 1
}).setOptions(options1);

//panel.widgets().set(0, histogram);
print (histogram);[codelink][1]


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...