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
这样的可视化方法并不平滑,可以考虑使用更多数据处理的方法使图像更加平滑。
效果图: