How about using a ee.Join
to do a join?
var point = ee.Geometry.Point([-94.73665965557193, 35.915990354302]);
print('Point Geometry:', point);
var startDate = ee.Date('2016-01-01');
var endDate = ee.Date('2016-12-31');
var lstDataset = ee.ImageCollection('OREGONSTATE/PRISM/AN81d')
.select('tmean')
.filterDate(startDate, endDate)
.filterBounds(point)
.map(function(image) { return image.clip(point); });
print("lstDataset", lstDataset)
var NTTempdataset = ee.ImageCollection('NASA/VIIRS/002/VNP21A1N')
.select("LST_1KM") // Select the LST_1KM band
.filterDate(startDate, endDate) // Filter by date
.filterBounds(point) // Filter by region
.map(function(image) {
return image
.clip(point) // Clip to the region
.rename("LST_1KM_Night"); // Rename the band to LST_1KM_Night
});
print("NTTempdataset", NTTempdataset)
var joined = ee.Join.saveBest({
matchKey: 'other',
measureKey: 'garbage',
outer: true
}).apply({
primary: lstDataset,
secondary: NTTempdataset,
condition: ee.Filter.maxDifference({
difference: 100000000,
leftField: 'system:time_start',
rightField: 'system:time_start'})
})
// Do something to these:
var withMatches = joined.filter(ee.Filter.neq('other', null))
print(withMatches.size())
// Do something else to these:
var withoutMatches = joined.filter(ee.Filter.eq('other', null))
print(withoutMatches.size())