项目 使用HBase进行NOAA OISST 海洋表面温度 数据集存储 数据可视化

        GEE中包含了完整的OISST 海温数据,考虑GEE。        

        GEE国内资料较少,考虑官方教程即可

        以81年到19年的NOAA OISST 海洋表面温度为例(制作出来的是动态海洋热力图)

        

        GEE使用js语言,规则和js基本一致,但是在处理数据集时也做了filter等更加方便地补充,上图代码如下:

// Define an area of interest geometry with a global non-polar extent.
var aoi = ee.Geometry.Polygon(
  [[[-179.0, 78.0], [-179.0, -58.0], [179.0, -58.0], [179.0, 78.0]]], null,
  false);
var geometry = /* color: #d63000 */ee.Geometry.Point([3.663621145272657, -42.364883474766835]);

// Import hourly predicted temperature image collection for northern winter
// solstice. Note that predictions extend for 384 hours; limit the collection
// to the first 24 hours.
var tempCol = ee.ImageCollection('NOAA/CDR/OISST/V2_1')
  // .filterDate('2018-12-1', '2018-12-23')
  // .limit(24)
  // .select('sst');
    // .filterDate('2017-01-01', '2017-12-31')
  .filter(ee.Filter.calendarRange(1981,2019,'year'))
  .filter(ee.Filter.calendarRange(3,3,'month'))
  .filter(ee.Filter.calendarRange(15,15,'DAY_OF_MONTH'))
  // .filter(ee.Filter.calendarRange(1,12,'month'))
  // .mean()
  .select('sst');

print(tempCol)

// Define arguments for animation function parameters.
var videoArgs = {
  dimensions: 768,
  region: aoi,
  framesPerSecond: 5,
  crs: 'EPSG:3857',
};

var text = require('users/gena/packages:text'); // Import gena's package which allows text overlay on image

var annotations = [
  {position: 'right', offset: '1%', margin: '1%', property: 'label', scale: 200000} //large scale because image if of the whole world. Use smaller scale otherwise
  ]
  
function addText(image){
  
  // var timeStamp = ee.Number(image.get(Date)).toByte(); // get the time stamp of each frame. This can be any string. Date, Years, Hours, etc.
  // var timeStamp = ee.String('Forecast: ').cat(ee.String(timeStamp)).cat(ee.String(' hours')); //convert time stamp to string 
  var timeStamp = ee.String('Observe: ').cat(ee.String(image.get('system:index')).slice(0,4)).cat(ee.String(' years'));
  
  var image = image.visualize({ //convert each frame to RGB image explicitly since it is a 1 band image
      forceRgbOutput: true,
      min: -180.0,
      max: 3000.0,
      palette: ['blue', 'purple', 'cyan', 'green', 'yellow', 'red']
    }).set({'label':timeStamp}); // set a property called label for each image
  
  var annotated = text.annotateImage(image, {}, geometry, annotations); // create a new image with the label overlayed using gena's package

  return annotated 
}

var tempCol = tempCol.map(addText) //add time stamp to all images
print(tempCol)
  
print(ui.Thumbnail(tempCol, videoArgs)); //print gif

        语法规则基本和js一致。

        接下来以一年内海洋变化为例,考虑可视化的更多优化方法:        

// Define an area of interest geometry with a global non-polar extent.
var aoi = ee.Geometry.Polygon(
  [[[-179.0, 78.0], [-179.0, -58.0], [179.0, -58.0], [179.0, 78.0]]], null,
  false);
var geometry = /* color: #d63000 */ee.Geometry.Point([19.663621145272657, -42.364883474766835]);

// Import hourly predicted temperature image collection for northern winter
// solstice. Note that predictions extend for 384 hours; limit the collection
// to the first 24 hours.
var tempCol = ee.ImageCollection('NOAA/CDR/OISST/V2_1')
  // .filterDate('2018-12-1', '2018-12-23')
  // .limit(24)
  // .select('sst');
  
    // .filterDate('2017-01-01', '2017-12-31')
  .filter(ee.Filter.calendarRange(2017,2017,'year'))
  .filter(ee.Filter.calendarRange(15,15,'DAY_OF_MONTH'))
  // .filter(ee.Filter.calendarRange(1,12,'month'))
  // .mean()
  .limit(24)
  .select('sst');

print(tempCol)

// Define arguments for animation function parameters.
var videoArgs = {
  dimensions: 768,
  region: aoi,
  framesPerSecond: 7,
  crs: 'EPSG:3857',
};

var text = require('users/gena/packages:text'); // Import gena's package which allows text overlay on image

var annotations = [
  {position: 'right', offset: '1%', margin: '1%', property: 'label', scale: 200000} //large scale because image if of the whole world. Use smaller scale otherwise
  ]
  
function addText(image){
  
  // var timeStamp = ee.Number(image.get(Date)).toByte(); // get the time stamp of each frame. This can be any string. Date, Years, Hours, etc.
  // var timeStamp = ee.String('Forecast: ').cat(ee.String(timeStamp)).cat(ee.String(' hours')); //convert time stamp to string 
  var timeStamp = ee.String('Observe: ').cat(ee.String(image.get('system:index')).slice(4,6)).cat(ee.String(' months'));
  
  var image = image.visualize({ //convert each frame to RGB image explicitly since it is a 1 band image
      forceRgbOutput: true,
      min: -180.0,
      max: 3000.0,
      palette: ['blue', 'purple', 'cyan', 'green', 'yellow', 'red']
    }).set({'label':timeStamp}); // set a property called label for each image
  
  var annotated = text.annotateImage(image, {}, geometry, annotations); // create a new image with the label overlayed using gena's package

  return annotated 
}

var tempCol = tempCol.map(addText) //add time stamp to all images
print(tempCol)
  
print(ui.Thumbnail(tempCol, videoArgs)); //print gif

        这样的可视化方法并不平滑,可以考虑使用更多数据处理的方法使图像更加平滑。

        效果图:

        

        

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值