google earth engine 統計點的長期溫度

背景:我想統計海水的長期溫度,一共有70個左右的點,這個點數據是我上傳的shp文件。

下圖是我的一個點在2000年到2019年每個月的溫度合成數據,可以看到效果挺不錯的。

要完成這個代碼需要以下幾個步驟:

1.篩選數據;

var sst = modis
    .select('sst')
    .filterDate(ee.Date('2000-01-01'), ee.Date('2019-12-31'));

2.獲得每一月的合成值;

var years = ee.List.sequence(2000, 2019);

//獲得每一月的合成值
var byMonthYear = ee.ImageCollection.fromImages(
    years.map(function(y) {
    return months.map(function (m) {
      return sst
        .filter(ee.Filter.calendarRange(y, y, 'year'))
        .filter(ee.Filter.calendarRange(m, m, 'month'))
        .mean()
        .set('system:month', m).set('system:year', y);
          });}).flatten());

3.根據每個月的合成值製表格;

//根據每個月的合成值製表格
var temp_trend = ui.Chart.image.series({
  imageCollection: byMonthYear,
  region: roi,
  reducer: ee.Reducer.median(),
  scale: 1000,
  // xProperty: 'system:time_start'
  xProperty: 'system:index'
})
  .setOptions({
    lineWidth: 1,
    pointSize: 3,
    trendlines: {0: {
        color: 'CC0000'
      }},
     title: "每個月的合成溫度"+Point_name,
     vAxis: {title:"單位:攝氏度℃"}});
print(temp_trend);
}

4.循環所有矢量點,獲取所有點的溫度。

//循環矢量
print(river)
var woredaNames = river.aggregate_array("FID");
for (var woreda=0; woreda < 1 ;woreda++){
    // Focus on one region:
    var point_name=woreda;
    var focusRegion = river.filter(ee.Filter.eq('FID', woreda));
    point_tem(focusRegion,point_name)
  
}

這個鏈接是我的gee溫度統計代碼,可以給讀者參考一下。https://code.earthengine.google.com/67f51240c6bfdb613ed94fc1f2c47929

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章