GEE开发之ERA5(气温、降水、压力、风速等)数据获取和分析
- 1.ERA5介绍
- 2.初始ERA5数据
-
- 2.1 DAILY代码
- 2.2 MONTHLY代码
- 3.遥感影像查看(DAILY之mean_2m_air_temperature)
- 4.逐日数据分析和获取(以mean_2m_air_temperature为例)
- 5.逐月数据分析和获取(以mean_2m_air_temperature为例)
-
- 5.1 代码一(ERA5/MONTHLY)
- 5.2 代码二(ERA5/DAILY)
- 5.3 代码三(ERA5/DAILY)
- 6.逐年数据分析和获取(以mean_2m_air_temperature为例)
-
- 6.1 代码一(ERA5/MONTHLY)
- 6.2 代码二(ERA5/DAILY)
- 6.3 代码三 (ERA5/MONTHLY)(下载遥感影像推荐)
- 6.4 代码四(ERA5/DAILY)(下载遥感影像推荐)
前言:ERA5主要提供DAILY和MONTHLY两大类别数据,其中主要包括“mean_2m_air_temperature"、“minimum_2m_air_temperature”、“maximum_2m_air_temperature”、“dewpoint_2m_temperature”、“total_precipitation”、“surface_pressure”、“mean_sea_level_pressure”、“u_component_of_wind_10m”、"v_component_of_wind_10m"数据。
本博客参考《 GEE数据集:ERA5 每日汇总 - 由 ECMWF / Copernicus Climate Change Service制作的最新气候再分析数据集》
1.ERA5介绍
- ERA5是ECMWF(欧洲中期天气预报中心)对全球气候的第五代大气再分析。再分析将模型数据与来自世界各地的观测数据结合起来,形成一个全球完整的、一致的数据集。ERA5取代了其前身ERA-Interim再分析。
- ERA5 DAILY提供每天7个ERA5气候再分析参数的汇总值:2米空气温度、2米露点温度、总降水量、平均海平面气压、表面气压、10米u风分量和10米v风分量。(参数较多,其他参数可自行查看)此外,根据每小时的2米空气温度数据,计算出2米处的每日最低和最高空气温度。每日总降水值以每日总和给出。所有其他参数都以日平均数提供。
- ERA5 MONTHLY提供的都是月数据。
- ERA5的数据从1979年到实时的三个月都有。
- 空间分辨率:0.1°×0.1°
- 时间跨度:1950年1月-至今
2.初始ERA5数据
2.1 DAILY代码
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
var dataset = ee.ImageCollection('ECMWF/ERA5/DAILY')
.filterDate('2019-01-01', '2019-12-31')
.filterBounds(geometry);
print(dataset)
2.2 MONTHLY代码
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
var dataset = ee.ImageCollection('ECMWF/ERA5/MONTHLY')
.filterDate('2019-01-01', '2019-12-31')
.filterBounds(geometry);
print(dataset)
3.遥感影像查看(DAILY之mean_2m_air_temperature)
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
Map.centerObject(geometry,7);
var dataset = ee.ImageCollection('ECMWF/ERA5/DAILY').select('mean_2m_air_temperature')
.filterDate('2019-05-01', '2019-05-31')
.filterBounds(geometry);
var vis2mt = {
min: 250,
max: 320,
palette: [
'#000080', '#0000D9', '#4000FF', '#8000FF', '#0080FF', '#00FFFF', '#00FF80',
'#80FF00', '#DAFF00', '#FFFF00', '#FFF500', '#FFDA00', '#FFB000', '#FFA400',
'#FF4F00', '#FF2500', '#FF0A00', '#FF00FF'
]
}
Map.addLayer(dataset.mean().clip(geometry), vis2mt,'mean_2m_air_temperature');
4.逐日数据分析和获取(以mean_2m_air_temperature为例)
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
Map.centerObject(geometry,7);
var dataset = ee.ImageCollection('ECMWF/ERA5/DAILY')
.filterDate('2018-05-01', '2018-05-31')
.filterBounds(geometry)
.select('mean_2m_air_temperature');
var subtract= function(image){
var img = image.subtract(273.15);
return img.set('system:time_start',image.get('system:time_start'));
};
dataset = dataset.map(subtract);
print(ui.Chart.image.series(dataset, geometry, ee.Reducer.mean(), 1000));
function exportImageCollection(imgCol) {
var indexList = imgCol.reduceColumns(ee.Reducer.toList(), ["system:index"]).get("list");
indexList.evaluate(function(indexs) {
for (var i=0; i<indexs.length; i++) {
var image = imgCol.filter(ee.Filter.eq("system:index", indexs[i])).first();
image = image.clip(geometry);
Export.image.toDrive({
image: image,
description: 'mean_2m_air_temperature_'+indexs[i],
fileNamePrefix: 'mean_2m_air_temperature_'+indexs[i],
folder: 'mean_2m_air_temperature',
region: geometry,
scale: 1000,
crs: "EPSG:4326",
maxPixels: 1e13
});
}
});
}
exportImageCollection(dataset);
5.逐月数据分析和获取(以mean_2m_air_temperature为例)
5.1 代码一(ERA5/MONTHLY)
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
Map.centerObject(geometry,7);
var dataset = ee.ImageCollection('ECMWF/ERA5/MONTHLY')
.filterDate('2018-01-01', '2018-12-31')
.filterBounds(geometry)
.select('mean_2m_air_temperature');
var subtract= function(image){
var img = image.subtract(273.15);
return img.set('system:time_start',image.get('system:time_start'));
};
dataset = dataset.map(subtract);
print(ui.Chart.image.series(dataset, geometry, ee.Reducer.mean(), 1000));
function exportImageCollection(imgCol) {
var indexList = imgCol.reduceColumns(ee.Reducer.toList(), ["system:index"]).get("list");
indexList.evaluate(function(indexs) {
for (var i=0; i<indexs.length; i++) {
var image = imgCol.filter(ee.Filter.eq("system:index", indexs[i])).first();
image = image.clip(geometry);
Export.image.toDrive({
image: image,
description: 'mean_2m_air_temperature_'+indexs[i],
fileNamePrefix: 'mean_2m_air_temperature_'+indexs[i],
folder: 'mean_2m_air_temperature',
region: geometry,
scale: 1000,
crs: "EPSG:4326",
maxPixels: 1e13
});
}
});
}
exportImageCollection(dataset);
5.2 代码二(ERA5/DAILY)
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
var dataset = ee.ImageCollection('ECMWF/ERA5/DAILY').filterBounds(geometry).select('mean_2m_air_temperature');
var years = ee.List.sequence(2018, 2018);
var months = ee.List.sequence(1, 12);
var monthlysum = ee.ImageCollection.fromImages(
years.map(function (y) {
return months.map(function(m) {
return dataset.filter(ee.Filter.calendarRange(y,y, 'year'))
.filter(ee.Filter.calendarRange(m, m, 'month'))
.mean().set('year', y).set('month', m).set('system:time_start', ee.Date.fromYMD(y, m, 1));
});
}).flatten());
var subtract= function(image){
var img = image.subtract(273.15);
return img.set('system:time_start',image.get('system:time_start'));
};
dataset = monthlysum.map(subtract);
print(dataset);
print(ui.Chart.image.series(dataset, geometry, ee.Reducer.mean(), 1000));
function exportImageCollection(imgCol) {
var indexList = imgCol.reduceColumns(ee.Reducer.toList(), ["system:index"]).get("list");
indexList.evaluate(function(indexs) {
for (var i=0; i<indexs.length; i++) {
var image = imgCol.filter(ee.Filter.eq("system:index", indexs[i])).first();
image = image.clip(geometry);
Export.image.toDrive({
image: image,
description: 'pre_2020_'+indexs[i],
fileNamePrefix: 'pre_2020_'+indexs[i],
folder: 'pre',
region: geometry,
scale: 1000,
crs: "EPSG:4326",
maxPixels: 1e13
});
}
});
}
exportImageCollection(dataset);
5.3 代码三(ERA5/DAILY)
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
Map.centerObject(geometry,6);
var dataset =ee.ImageCollection("ECMWF/ERA5/DAILY");
for(var i=2018;i<=2020;i++){
for(var j=1;j<=12;j++){
var data_collection = null;
switch(j){
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
data_collection = dataset.filterDate(i+'-'+j+'-01',i+'-'+j+'-31').select('mean_2m_air_temperature');
break;
case 4:
case 6:
case 9:
case 11:
data_collection = dataset.filterDate(i+'-'+j+'-01',i+'-'+j+'-30').select('mean_2m_air_temperature');
break;
case 2:
data_collection = dataset.filterDate(i+'-'+j+'-01',i+'-'+j+'-28').select('mean_2m_air_temperature');
break;
}
var YR_collection = data_collection.mean().subtract(273.15).clip(geometry);
Export.image.toDrive({
image: YR_collection,
description: i+'-'+j,
fileNamePrefix: i+'-'+j,
scale: 1000,
region: geometry,
maxPixels: 1e13,
crs: "EPSG:4326",
folder: 'mean_2m_air_temperature'
})
}
}
6.逐年数据分析和获取(以mean_2m_air_temperature为例)
6.1 代码一(ERA5/MONTHLY)
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
var collection = ee.ImageCollection("ECMWF/ERA5/MONTHLY").filterDate('2000-01-01', '2010-12-31').select("mean_2m_air_temperature");
var subtract = function(image){
var img = image.subtract(273.15);
return img.set(image.toDictionary(image.propertyNames()));
};
collection = collection.map(subtract);
var years = ee.List.sequence(2000, 2010);
var collectYear = ee.ImageCollection(years
.map(function(y) {
var start = ee.Date.fromYMD(y, 1, 1);
var end = start.advance(12, 'month');
return collection.filterDate(start, end).reduce(ee.Reducer.mean()).float().set('system:time_start',y).set('year',y);
}));
print(collectYear);
var Yearly_chart = ui.Chart.image.series({
imageCollection: collectYear.select('mean_2m_air_temperature_mean'),
region: geometry,
reducer: ee.Reducer.mean(),
scale: 500,
xProperty: 'year',
}).setOptions({
interpolateNulls: true,
lineWidth: 2,
title: 'temperature Yearly Seires',
vAxis: {title: 'temperature'},
hAxis: {title: 'Date'},
});
print(Yearly_chart);
function exportImageCollection(imgCol) {
var indexList = imgCol.reduceColumns(ee.Reducer.toList(), ["system:index"]).get("list");
indexList.evaluate(function(indexs) {
for (var i=0; i<indexs.length; i++) {
var image = imgCol.filter(ee.Filter.eq("system:index", indexs[i])).first();
image = image.clip(geometry);
Export.image.toDrive({
image: image,
description: 'mean_2m_air_temperature_mean'+indexs[i],
fileNamePrefix: 'mean_2m_air_temperature_mean'+indexs[i],
folder: 'tem',
region: geometry,
scale: 1000,
crs: "EPSG:4326",
maxPixels: 1e13
});
}
});
}
exportImageCollection(collectYear);
6.2 代码二(ERA5/DAILY)
在6.1的基础上把MONTHLY改成DAILY即可
6.3 代码三 (ERA5/MONTHLY)(下载遥感影像推荐)
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
Map.centerObject(geometry,6);
var dataset=ee.ImageCollection("ECMWF/ERA5/MONTHLY");
for(var i=2010;i<=2015;i++){
var data_collection = dataset.filterDate(i+'-01-01',i+'-12-31').select('mean_2m_air_temperature');
print(data_collection)
var YR_collection = data_collection.mean().subtract(273.15).clip(geometry);
Export.image.toDrive({
image: YR_collection,
description: i,
fileNamePrefix: i,
scale: 1000,
region: geometry,
maxPixels: 1e13,
crs: "EPSG:4326",
folder: 'temperature'
});
}
6.4 代码四(ERA5/DAILY)(下载遥感影像推荐)
var geometry = ee.FeatureCollection('users/www1573979951/luyixian');
Map.centerObject(geometry,6);
var dataset=ee.ImageCollection("ECMWF/ERA5/DAILY");
for(var i=2010;i<=2015;i++){
var data_collection = dataset.filterDate(i+'-01-01',i+'-12-31').select('mean_2m_air_temperature');
print(data_collection)
var YR_collection = data_collection.mean().subtract(273.15).clip(geometry);
Export.image.toDrive({
image: YR_collection,
description: i,
fileNamePrefix: i,
scale: 1000,
region: geometry,
maxPixels: 1e13,
crs: "EPSG:4326",
folder: 'temperature'
});
}