In an earlier post at How to select features in a feature collection simultaneously row by row in Google Earth Engine?, I got help for creating a code to compare conflicts and bimonthly GIMMS imagery.
Now I received a different dataset, GIMMS annual maximum NDVI data, to use tor the time 1981-2015. The filtering from previously date ('system:time_start') which was added before, doesn't work now.
Also the NDVI (now called 'b1') band is now between -99999 to +9999.
//Dates for filtering the GIMMS Image Collection // With annual data no filtering nexessary, 1981-2015 used
var startDate = 1982 //adjust with time for the 35
var endDate = 2015
print(startDate);
//Loading and filtering (by date) the UCDP conflict data (CSV) 1989-2015
var conflicts = ee.FeatureCollection('users/welp1992/Conflicts_Deaths_Greater25')
.filterMetadata('year', 'greater_than', 1989)//min 6 years, but as long as possible
.filterMetadata('year', 'less_than', 2010) //including 2010, to 2015 = 6 years
print(conflicts.limit(1000),'conflicts');
//filter image GIMMS by date and band and add time 't' as a band
var timeSeries = ee.ImageCollection('users/welp1992/NDVI_Annual_Max_81_2015')
.select(['b1'])
.map(function (image) {
return image.addBands(
ee.Image(image.getNumber('system:time_start')) //'year'?
.subtract(ee.Date(startDate).millis())
.divide(1000*3600) // days (*365 = year)
.int() //casts the input value to a signed 32-bit integer
.rename('t')
)
})
print(timeSeries,'time');
This is the Error message I get:
ImageCollection (Error) Error in map(ID=Max_05): Image.constant: Parameter 'value' is required.
Unfortunately I cannot share the annual max NDVI data (which I have uploaded to GEE). The script is basically the same as the earlier version in the link I shared above.
Do you have any advice?
conflicts
andtimeseries
collections publicly readable. To share an asset, click on it, click share, and check the box "anyone can read". If you really can't share that asset for whatever reason, it is really difficult to help you without being able to reproduce your error. On first looks, the error seems to be related to casting error inside the function that maps ontimeseries
.image.getNumber('system:time_start')
because there is no property called 'system:time_start'. The only properties available for each image withintimeSeries
aresystem:asset_size
,system:footprint
.system:index
. I found this out usingprint(timesSeries.first())
.var Maxyears = ee.List.sequence(1981, 2015); var NDVIMax35 = ee.ImageCollection.addBands( ee.List.sequence(0, Stacked_Images_35.bandNames().length().subtract(1)) .map(function(i) { return Stacked_Images_35.select(ee.Number(i)) .rename('Max35') .set('year', Maxyears.get(i)); }) );
Something like this?