I'm trying to clip and export climate data (annual max) from one ImageCollection to an already existing table with (annual max) NDVI values and clip them with conflict points stored in FeatureCollection. The script works for the NDVI, which I have as an asset in GEE. But since I'm creating annual max images in the script without saving them as an Asset, I have problems to use it.
//Calc annual max for TerraClimate for Temp, soil and prec and clip with conflicts 25
var annual_max_temp = ee.ImageCollection(ee.List.sequence(1981, 2015).map(function (year){
var date_start = ee.Date.fromYMD(year, 1, 1);
var date_end = date_start.advance(1, "year");
return(ee.ImageCollection('IDAHO_EPSCOR/TERRACLIMATE')
.select(['tmmx','soil', 'pr'])
.filterDate(date_start, date_end)
.max()
.set({year: year, 'system:time_start':date_start.millis()})
.set({year: year, 'system:time_end':date_end.millis()}));
}));
print(annual_max_temp,'at');
Map.addLayer(annual_max_temp,{color: '0036FF', pointRadius: 6}, 'at');
//Clipping the Climate IC with the Conflict FC and adding them to the NDVI_Slopes_Table
var GIMMSConfl25 = NDVI_Slopes
.map(function(f) {
var maxNDVI = annual_max_temp //when I use this it works: var maxNDVI = ee.ImageCollection('users/welp1992/GIMMS_Max_Annual_NDVI')
.filterDate('1982-01-01', '2015-12-31')
.map(function(img) {return img.clip(Conf25)})
(['tmmx','soil', 'pr'])
.map(function(img) {
var d = img.reduceRegion({
reducer: ee.Reducer.first(),
geometry: f.geometry(),
scale: 8000
});
return f.set(d).set('GIMMSdate', img.date().format('yyyyMMdd'));
});
return maxNDVI; //global variable, use later in script
}).flatten();
// Get Info
//print(NDVI_Slopes.limit(650));
print('Annual_Max_Clipped',Annual_Max_Clipped.limit(650));
print('Annual_Max_Clipped',Annual_Max_Clipped.size())
Export.table.toDrive({
collection: GIMMSConfl25,
description: 'annual_max_temp_table',
fileFormat: 'CSV'
});
I get this error. annual_max_temp.filterDate(...).map(...) is not a function
How do I replace the ImageCollection in the code? I think it's a simple problem in the code. But if needed I can share the code and the assets.