|
群里有位小伙伴咨詢Landsat與Modis兩種數(shù)據(jù)源計算的結(jié)果如何展示在同一個chart。小編決定拿Modis的LST和NDVI產(chǎn)品作為示例,大家照著方法修改即可。 還是以廣東省為例,MOD11A1地表溫度產(chǎn)品和MOD13Q1植被指數(shù)產(chǎn)品共同計算各自的年平均值。因為MOD13Q1是16天產(chǎn)品,而MOD11A1是日尺度產(chǎn)品,要把他們統(tǒng)一在同一時間尺度下。 //公眾號:GEEer成長日記//還是老樣子哈,以廣東省為目標(biāo)var geometry = ee.FeatureCollection('users/ZhengkunWang/guangdongsheng')Map.centerObject(geometry,6) // 選擇數(shù)據(jù)集并進(jìn)行波段比例換算var years = ee.List.sequence(2010, 2020);var collectYear = ee.ImageCollection(years .map(function(y) { var start = ee.Date.fromYMD(y, 1, 1); var end = start.advance(12, 'month'); var LST = ee.ImageCollection('MODIS/006/MOD11A1') .select('LST_Day_1km') .filterDate(start, end) .map(function(image){ return image.multiply(0.02).subtract(273.15).set(image.toDictionary(image.propertyNames())); }).mean().rename('LST') var NDVI = ee.ImageCollection("MODIS/006/MOD13Q1") .filterDate(start, end) .select("NDVI") .map(function(image){ return image.multiply(0.0001).set(image.toDictionary(image.propertyNames())) }).mean(); return LST.addBands(NDVI).set('year',y)}));print (collectYear);
// 計算研究區(qū)域內(nèi)的波段時間序列var Yearlychart = ui.Chart.image.series({ imageCollection : collectYear.select('NDVI','LST'), region : geometry, reducer:ee.Reducer.mean(), scale:1000, xProperty: 'year',}) .setChartType('LineChart').setOptions({ interpolateNulls: true, title: 'LST & NDVI time series', hAxis: {title: 'DATE'}, vAxis: {title: 'LST & NDVI',viewWindowMode: 'explicit'} });print('LST & NDVI時間序列',Yearlychart);
本期內(nèi)容就介紹到這里,大家可以根據(jù)自己的研究區(qū)域和研究內(nèi)容進(jìn)行修改。 確定 |
|
|