Skip to content

Instantly share code, notes, and snippets.

@danhammer
Created March 28, 2020 20:35
Show Gist options
  • Save danhammer/39a05dd53fbea66634c8b392d634c093 to your computer and use it in GitHub Desktop.
Save danhammer/39a05dd53fbea66634c8b392d634c093 to your computer and use it in GitHub Desktop.
Plot timeseries of NO2 for Susanna Berkouwer from GEE
var COLOR = {
xinxiang: 'ff0000',
milan: '0000ff',
tehran: '00ff00'
};
var xinxiang = ee.Feature( // xinxiang
ee.Geometry.Rectangle(113.6, 35.1, 114.4, 35.5),
{label: 'xinxiang'});
var milan = ee.Feature( // milan
ee.Geometry.Rectangle(8.9, 45, 10, 45.4),
{label: 'milan'});
var tehran = ee.Feature( // tehran
ee.Geometry.Rectangle(51.2, 35.6, 51.5, 35.7),
{label: 'tehran'});
var myRegions = new ee.FeatureCollection([xinxiang, milan, tehran]);
// Sentinel-5P NRTI NO2: Near Real-Time Nitrogen Dioxide
var collection = ee.ImageCollection('COPERNICUS/S5P/NRTI/L3_NO2');
var sno = collection.filterBounds(myRegions)
.filterDate('2018-09-01', '2019-03-01')
.select('NO2_column_number_density');
var densitySeries = ui.Chart.image.seriesByRegion({
imageCollection: sno,
regions: myRegions,
reducer: ee.Reducer.mean(),
band: 'NO2_column_number_density',
scale: 200,
xProperty: 'system:time_start',
seriesProperty: 'label'
});
densitySeries.setChartType('ScatterChart');
densitySeries.setOptions({
title: 'Sentinel-5P NRTI NO2',
vAxis: {
title: 'S5P N02'
},
lineWidth: 1,
pointSize: 2,
series: {
0: {color: COLOR.xinxiang},
1: {color: COLOR.milan},
2: {color: COLOR.tehran}
}
});
print(densitySeries);
Map.addLayer(xinjiang, {color: COLOR.xinjiang});
Map.addLayer(milan, {color: COLOR.milan});
Map.addLayer(tehran, {color: COLOR.tehran});
Map.setCenter(51.2, 35.6, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment