Mapping over an image collection (NO2 in this case), for .clip
, is simple:
var NO2NL=NO2.map(function(im){
return im.clip(NL);
});
Replacing .clip
with .resample(bilinear)
works too, however using .reproject(scale=1000)
always produces an error: Variable must be declared with "var": scale. Any idea how I can reproject over an image collection?
Entire script for reference:
//Set variables
var countries = ee.FeatureCollection("FAO/GAUL/2015/level0");
var NL = countries.filterMetadata('ADM0_NAME', 'equals', 'Netherlands');
var start_period = ee.Date('2018-07-01');
var end_period = ee.Date(new Date().getTime());
var NO2 = ee.ImageCollection('COPERNICUS/S5P/OFFL/L3_NO2')
.select('tropospheric_NO2_column_number_density')
.filterDate(start_period, end_period);
var NO2NL=NO2.map(function(im){
return im.clip(NL);
});
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Date slider parameters
ee.Dictionary({start: start_period, end: end_period})
.evaluate(renderSlider);
function renderSlider(dates) {
var slider = ui.DateSlider({
start: dates.start.value,
end: dates.end.value,
period: 14, // Every 14 days
onChange: renderDateRange,
style: {
position: 'top-left',
}
});
Map.add(slider);
}
function renderDateRange(dateRange) {
var image = NO2NL
.filterDate(dateRange.start(), dateRange.end())
.median();
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Visual parameters and mapping
var vis = {min: 0, max: 0.0001, palette: [
'black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red']};
var layer = ui.Map.Layer(image, vis, 'Tropospheric NO2');
Map.layers().reset([layer]);
}
Map.setCenter(5.5, 52.2, 7.5);
Eventually I hope that the time slider shows only dates on which the data is available. I also want to use ECMWF data for wind speed and join the datasets so that only days with wind speed <10kph are shown!