降雨数据数据源导航 · 脚本与工作流

GEE 降雨数据脚本示例

本页把常见降雨科研处理任务整理为可读的 GEE JavaScript 示例。示例只用于理解参数和流程,不托管第三方大型数据,正式研究仍需回到官方数据源核对版本、许可和引用。

不托管第三方大型数据,只提供官方来源导航、脚本生成和科研工作流说明

下面的示例只做科研工作流说明,不托管 CHIRPS、GPM IMERG 或 ERA5-Land 数据。所有下载、许可、版本和引用请以官方平台为准;工程设计、洪涝预警或灾害决策前必须经过独立验证。

示例 1

CHIRPS 流域月降雨统计

适用场景

适合需要长期日降雨转月累计、制作流域水文模型输入或对比多年季节变化的研究。

数据源

CHIRPS Daily

关键参数

  • · 时间范围:2020-01-01 至 2020-12-31
  • · 研究区:GeoJSON 面边界示例,正式研究应替换为可信流域边界
  • · 统计方式:月降雨累计 CSV

注意事项

  • · CHIRPS 是准全球产品,正式使用前应检查研究区是否在有效覆盖范围内。
  • · 月累计结果应结合站点观测或已有研究做合理性检查。

相关工具推荐

GEE JavaScript 示例代码

// Generated by kuaigongju.com for research workflow drafting.
// 数据源名称: CHIRPS Daily
// 单位说明: CHIRPS precipitation 为日降雨量,常用单位 mm/day;按月或年累计时脚本使用 sum 得到 mm。
// 时间范围: 2020-01-01 至 2020-12-31(结束日期按 UTC 包含处理)
// 研究区说明: 用户粘贴的 GeoJSON;请确认边界来源、坐标系和拓扑质量
// 引用和许可证提醒: 请按 UCSB Climate Hazards Center 与 CHIRPS 官方页面要求引用数据和论文。 同时核对 Google Earth Engine 平台条款。
// 免责声明: 不建议未经验证直接用于工程或灾害决策。
// 请在正式成果中记录数据版本、访问日期、参数、空间边界和质量控制过程。
var regionGeoJSON = {"type":"Polygon","coordinates":[[[104,20],[112,20],[112,27],[104,27],[104,20]]]};
var region = ee.Geometry(regionGeoJSON);
var regionLabel = 'geojson_geometry';

var startDate = ee.Date('2020-01-01');
var endDate = ee.Date('2020-12-31').advance(1, 'day'); // inclusive end date in UTC

var collection = ee.ImageCollection('UCSB-CHG/CHIRPS/DAILY')
  .filterDate(startDate, endDate)
  .filterBounds(region);

// CHIRPS is quasi-global, not complete global coverage. Common coverage is about 50S-50N.
// The precipitation band is daily rainfall in mm/day.
var rainfall = collection.select('precipitation');

print('CHIRPS Daily', rainfall);


// Monthly rainfall total: sum rainfall images in each month, then export regional mean total as CSV.
Map.centerObject(region, 7);
Map.addLayer(region, {color: 'red'}, 'analysis region');

var periodCount = endDate.difference(startDate, 'month').ceil();
var periodOffsets = ee.List.sequence(0, periodCount.subtract(1));

var monthlySeries = periodOffsets.map(function(offset) {
  var periodStart = startDate.advance(offset, 'month');
  var rawPeriodEnd = periodStart.advance(1, 'month');
  var periodEnd = ee.Date(ee.Algorithms.If(rawPeriodEnd.millis().gt(endDate.millis()), endDate, rawPeriodEnd));
  var rainfallImage = rainfall.filterDate(periodStart, periodEnd).sum().rename('rainfall_mm');
  var stats = rainfallImage.reduceRegion({
    reducer: ee.Reducer.mean(),
    geometry: region,
    scale: 5566,
    bestEffort: true,
    maxPixels: 1e13
  });

  return ee.Feature(null, {
    period_start_utc: periodStart.format('YYYY-MM-dd'),
    period_end_utc: periodEnd.advance(-1, 'day').format('YYYY-MM-dd'),
    aggregation: 'month_total',
    region_label: regionLabel,
    rainfall_total_mm: stats.get('rainfall_mm'),
    data_source: 'chirps',
    note: 'CHIRPS is quasi-global and its daily precipitation band is already in mm/day.'
  });
});

Export.table.toDrive({
  collection: ee.FeatureCollection(monthlySeries),
  description: 'chirps_monthly_total_csv',
  fileNamePrefix: 'chirps_monthly_total_csv',
  fileFormat: 'CSV'
});

示例 2

GPM IMERG 暴雨过程降雨提取

适用场景

适合分析短历时暴雨过程、台风降雨或事件型水文响应,需要较高时间分辨率的场景。

数据源

GPM IMERG V07

关键参数

  • · 时间范围:2024-06-15 至 2024-06-18
  • · 研究区:bbox 经纬度矩形
  • · 统计方式:区域平均时间序列 CSV

注意事项

  • · GPM IMERG V07 在 GEE 中常以半小时降雨率表示,脚本会乘以 0.5 转为半小时累计。
  • · 暴雨过程分析要明确 UTC 与本地时间换算,避免事件开始和结束时间偏移。

相关工具推荐

GEE JavaScript 示例代码

// Generated by kuaigongju.com for research workflow drafting.
// 数据源名称: GPM IMERG V07
// 单位说明: GPM IMERG V07 precipitation 常表示半小时降雨率 mm/hr;脚本乘以 0.5 小时转为半小时累计 mm。
// 时间范围: 2024-06-15 至 2024-06-18(结束日期按 UTC 包含处理)
// 研究区说明: bbox [104, 20, 112, 27]
// 引用和许可证提醒: 请按 NASA GPM IMERG 官方页面核对产品版本、引用格式和使用条款。 同时核对 Google Earth Engine 平台条款。
// 免责声明: 不建议未经验证直接用于工程或灾害决策。
// 请在正式成果中记录数据版本、访问日期、参数、空间边界和质量控制过程。
var region = ee.Geometry.Rectangle([104, 20, 112, 27], null, false);
var regionLabel = 'bbox_region';

var startDate = ee.Date('2024-06-15');
var endDate = ee.Date('2024-06-18').advance(1, 'day'); // inclusive end date in UTC

var collection = ee.ImageCollection('NASA/GPM_L3/IMERG_V07')
  .filterDate(startDate, endDate)
  .filterBounds(region);

// GPM IMERG V07 precipitation is commonly expressed as a half-hour rainfall rate in mm/hr.
// Convert the half-hour rate to half-hour accumulation by multiplying by 0.5 hour.
var rainfall = collection.select('precipitation').map(function(image) {
  return image.multiply(0.5)
    .rename('rainfall_mm')
    .copyProperties(image, ['system:time_start']);
});

print('GPM IMERG V07', rainfall);


// Region mean: export a CSV time series for the selected region.
Map.centerObject(region, 7);
Map.addLayer(region, {color: 'red'}, 'analysis region');

var regionSeries = rainfall.map(function(image) {
  var stats = image.reduceRegion({
    reducer: ee.Reducer.mean(),
    geometry: region,
    scale: 11132,
    bestEffort: true,
    maxPixels: 1e13
  });

  return ee.Feature(null, {
    date_utc: image.date().format('YYYY-MM-dd HH:mm'),
    region_label: regionLabel,
    rainfall_mm: stats.get(image.bandNames().get(0)),
    data_source: 'gpm_imerg',
    note: 'IMERG script distinguishes mm/hr rainfall rate from half-hour accumulation.'
  });
});

Export.table.toDrive({
  collection: ee.FeatureCollection(regionSeries),
  description: 'gpm_imerg_region_mean_csv',
  fileNamePrefix: 'gpm_imerg_region_mean_csv',
  fileFormat: 'CSV'
});

示例 3

ERA5-Land 年降雨累计

适用场景

适合做区域尺度年降雨对比、气候背景分析,或与温度、蒸散等再分析变量联合使用。

数据源

ERA5-Land Daily

关键参数

  • · 时间范围:2023-01-01 至 2023-12-31
  • · 研究区:珠江流域近似示例 bbox
  • · 统计方式:年降雨累计 CSV

注意事项

  • · ERA5-Land 累计降水变量原始单位为 m,脚本乘以 1000 转为 mm。
  • · 日累计边界按 UTC 处理,中国本地日降雨研究需额外说明时区处理。

相关工具推荐

GEE JavaScript 示例代码

// Generated by kuaigongju.com for research workflow drafting.
// 数据源名称: ERA5-Land Daily
// 单位说明: ERA5-Land total_precipitation_sum 为累计降水,原始单位为 m;脚本乘以 1000 转为 mm,日界线按 UTC 处理。
// 时间范围: 2023-01-01 至 2023-12-31(结束日期按 UTC 包含处理)
// 研究区说明: Pearl River basin approximate bbox;示例区域不是官方边界
// 引用和许可证提醒: 请按 Copernicus/ECMWF 与 GEE 数据目录说明核对 ERA5-Land 引用、许可和再分发限制。 同时核对 Google Earth Engine 平台条款。
// 免责声明: 不建议未经验证直接用于工程或灾害决策。
// 请在正式成果中记录数据版本、访问日期、参数、空间边界和质量控制过程。
// Example region only: Pearl River basin approximate bbox. Replace with an official basin boundary for formal research.
var region = ee.Geometry.Rectangle([97.5, 20, 117.5, 27.5], null, false);
var regionLabel = 'pearl-river';

var startDate = ee.Date('2023-01-01');
var endDate = ee.Date('2023-12-31').advance(1, 'day'); // inclusive end date in UTC

var collection = ee.ImageCollection('ECMWF/ERA5_LAND/DAILY_AGGR')
  .filterDate(startDate, endDate)
  .filterBounds(region);

// ERA5-Land total_precipitation_sum is an accumulated variable in metres.
// Convert metres to millimetres with multiply(1000). Daily aggregates use UTC day boundaries.
var rainfall = collection.select('total_precipitation_sum').map(function(image) {
  return image.multiply(1000)
    .rename('rainfall_mm')
    .copyProperties(image, ['system:time_start']);
});

print('ERA5-Land Daily', rainfall);


// Yearly rainfall total: sum rainfall images in each year, then export regional mean total as CSV.
Map.centerObject(region, 7);
Map.addLayer(region, {color: 'red'}, 'analysis region');

var periodCount = endDate.difference(startDate, 'year').ceil();
var periodOffsets = ee.List.sequence(0, periodCount.subtract(1));

var yearlySeries = periodOffsets.map(function(offset) {
  var periodStart = startDate.advance(offset, 'year');
  var rawPeriodEnd = periodStart.advance(1, 'year');
  var periodEnd = ee.Date(ee.Algorithms.If(rawPeriodEnd.millis().gt(endDate.millis()), endDate, rawPeriodEnd));
  var rainfallImage = rainfall.filterDate(periodStart, periodEnd).sum().rename('rainfall_mm');
  var stats = rainfallImage.reduceRegion({
    reducer: ee.Reducer.mean(),
    geometry: region,
    scale: 11132,
    bestEffort: true,
    maxPixels: 1e13
  });

  return ee.Feature(null, {
    period_start_utc: periodStart.format('YYYY-MM-dd'),
    period_end_utc: periodEnd.advance(-1, 'day').format('YYYY-MM-dd'),
    aggregation: 'year_total',
    region_label: regionLabel,
    rainfall_total_mm: stats.get('rainfall_mm'),
    data_source: 'era5_land',
    note: 'ERA5-Land accumulated precipitation is converted from metres to mm and uses UTC days.'
  });
});

Export.table.toDrive({
  collection: ee.FeatureCollection(yearlySeries),
  description: 'era5_land_yearly_total_csv',
  fileNamePrefix: 'era5_land_yearly_total_csv',
  fileFormat: 'CSV'
});

示例 4

点位降雨时间序列导出

适用场景

适合把格点或卫星降雨提取到雨量站、样地、钻孔或模型控制点位置进行对比。

数据源

CHIRPS Daily

关键参数

  • · 时间范围:2024-01-01 至 2024-03-31
  • · 点位:经度 108.3,纬度 23.8
  • · 统计方式:点位降雨时间序列 CSV

注意事项

  • · 点位提取代表对应数据源格点或像元值,不等同于站点实测值。
  • · 与站点数据比较前,应检查格点分辨率、站点位置精度和缺测情况。

相关工具推荐

GEE JavaScript 示例代码

// Generated by kuaigongju.com for research workflow drafting.
// 数据源名称: CHIRPS Daily
// 单位说明: CHIRPS precipitation 为日降雨量,常用单位 mm/day;按月或年累计时脚本使用 sum 得到 mm。
// 时间范围: 2024-01-01 至 2024-03-31(结束日期按 UTC 包含处理)
// 研究区说明: 点位经纬度 [108.3, 23.8]
// 引用和许可证提醒: 请按 UCSB Climate Hazards Center 与 CHIRPS 官方页面要求引用数据和论文。 同时核对 Google Earth Engine 平台条款。
// 免责声明: 不建议未经验证直接用于工程或灾害决策。
// 请在正式成果中记录数据版本、访问日期、参数、空间边界和质量控制过程。
var samplePoint = ee.Geometry.Point([108.3, 23.8]);
var region = samplePoint;
var regionLabel = 'point_lon_lat';

var startDate = ee.Date('2024-01-01');
var endDate = ee.Date('2024-03-31').advance(1, 'day'); // inclusive end date in UTC

var collection = ee.ImageCollection('UCSB-CHG/CHIRPS/DAILY')
  .filterDate(startDate, endDate)
  .filterBounds(region);

// CHIRPS is quasi-global, not complete global coverage. Common coverage is about 50S-50N.
// The precipitation band is daily rainfall in mm/day.
var rainfall = collection.select('precipitation');

print('CHIRPS Daily', rainfall);


// Point extraction: export a CSV time series at the selected coordinate.
var point = samplePoint;
Map.centerObject(point, 8);
Map.addLayer(point, {color: 'red'}, 'sample point');

var pointSeries = rainfall.map(function(image) {
  var value = image.reduceRegion({
    reducer: ee.Reducer.first(),
    geometry: point,
    scale: 5566,
    bestEffort: true
  });

  return ee.Feature(null, {
    date_utc: image.date().format('YYYY-MM-dd HH:mm'),
    rainfall_mm: value.get(image.bandNames().get(0)),
    longitude: 108.3,
    latitude: 23.8,
    data_source: 'chirps',
    note: 'CHIRPS is quasi-global and its daily precipitation band is already in mm/day.'
  });
});

Export.table.toDrive({
  collection: ee.FeatureCollection(pointSeries),
  description: 'chirps_point_extract_csv',
  fileNamePrefix: 'chirps_point_extract_csv',
  fileFormat: 'CSV'
});

示例 5

研究区降雨 GeoTIFF 导出

适用场景

适合导出某段时间累计降雨空间分布,用于 GIS 制图、栅格叠加或后续空间统计。

数据源

ERA5-Land Daily

关键参数

  • · 时间范围:2024-07-01 至 2024-07-31
  • · 研究区:GeoJSON 面边界示例
  • · 统计方式:栅格 GeoTIFF 导出

注意事项

  • · GeoTIFF 导出会消耗 GEE 任务配额,正式导出前建议先缩小区域或降低时间范围测试。
  • · 导出栅格后仍需在 GIS 中检查投影、像元大小、空值和裁剪边界。

相关工具推荐

GEE JavaScript 示例代码

// Generated by kuaigongju.com for research workflow drafting.
// 数据源名称: ERA5-Land Daily
// 单位说明: ERA5-Land total_precipitation_sum 为累计降水,原始单位为 m;脚本乘以 1000 转为 mm,日界线按 UTC 处理。
// 时间范围: 2024-07-01 至 2024-07-31(结束日期按 UTC 包含处理)
// 研究区说明: 用户粘贴的 GeoJSON;请确认边界来源、坐标系和拓扑质量
// 引用和许可证提醒: 请按 Copernicus/ECMWF 与 GEE 数据目录说明核对 ERA5-Land 引用、许可和再分发限制。 同时核对 Google Earth Engine 平台条款。
// 免责声明: 不建议未经验证直接用于工程或灾害决策。
// 请在正式成果中记录数据版本、访问日期、参数、空间边界和质量控制过程。
var regionGeoJSON = {"type":"Polygon","coordinates":[[[104,20],[112,20],[112,27],[104,27],[104,20]]]};
var region = ee.Geometry(regionGeoJSON);
var regionLabel = 'geojson_geometry';

var startDate = ee.Date('2024-07-01');
var endDate = ee.Date('2024-07-31').advance(1, 'day'); // inclusive end date in UTC

var collection = ee.ImageCollection('ECMWF/ERA5_LAND/DAILY_AGGR')
  .filterDate(startDate, endDate)
  .filterBounds(region);

// ERA5-Land total_precipitation_sum is an accumulated variable in metres.
// Convert metres to millimetres with multiply(1000). Daily aggregates use UTC day boundaries.
var rainfall = collection.select('total_precipitation_sum').map(function(image) {
  return image.multiply(1000)
    .rename('rainfall_mm')
    .copyProperties(image, ['system:time_start']);
});

print('ERA5-Land Daily', rainfall);


// Raster export: sum the selected period and export a GeoTIFF.
var rainfallImage = rainfall.sum().rename('rainfall_mm');
Map.centerObject(region, 7);
Map.addLayer(rainfallImage.clip(region), {min: 0, max: 300, palette: ['white', 'skyblue', 'blue', 'purple']}, 'period rainfall mm');

Export.image.toDrive({
  image: rainfallImage.clip(region),
  description: 'era5_land_raster_export_geotiff',
  fileNamePrefix: 'era5_land_raster_export_geotiff',
  region: region,
  scale: 11132,
  maxPixels: 1e13,
  fileFormat: 'GeoTIFF'
});

研究要点

使用前先确认这些边界

1

覆盖 CHIRPS、GPM IMERG V07 和 ERA5-Land Daily 三类降雨数据源。

2

每个示例都说明适用场景、关键参数、示例代码、注意事项和相关工具推荐。

3

示例区域和时间只是演示参数,正式研究应替换为可信研究区边界与目标时段。

4

代码强调单位转换、时间边界、引用许可和科研免责声明,不建议未经验证直接用于工程或灾害决策。

科研工作流

建议处理步骤

  1. STEP 1

    先根据研究问题选择示例:长期月累计、暴雨过程、年累计、点位序列或栅格导出。

  2. STEP 2

    把示例中的时间范围、bbox、GeoJSON 或点位经纬度替换为自己的研究参数。

  3. STEP 3

    在 GEE Code Editor 中运行前,阅读脚本注释并核对官方数据集页面。

  4. STEP 4

    导出 CSV 或 GeoTIFF 后,保存脚本、参数、数据版本、引用和许可说明。

数据来源

官方入口与元数据

引用建议

示例代码不替代数据引用。请按 CHIRPS、GPM IMERG 或 ERA5-Land 官方推荐格式引用数据,并在方法中说明 GEE 脚本、时间范围、研究区和导出参数。

许可证提醒

所有示例都依赖第三方数据和 Google Earth Engine 平台。发布论文、报告、派生数据或教学材料前,请核对官方许可、署名、再分发和平台使用条款。

免责声明

示例脚本仅作科研工作流说明,不保证适合所有地区、尺度、产品版本或审稿要求;不建议未经验证直接用于工程设计、洪涝预警或灾害决策。

FAQ

常见问题

这些示例代码可以直接复制到 GEE 运行吗?+

可以作为起点复制运行,但建议先替换研究区、时间范围和导出名称,并阅读脚本注释中的单位、时区、引用和许可提醒。

示例页会托管 CHIRPS、IMERG 或 ERA5 数据吗?+

不会。页面只展示脚本示例和官方数据源入口,实际数据访问、计算和导出都发生在 Google Earth Engine 或对应官方平台。

GEE 降雨脚本示例可以直接作为论文结果吗?+

不能直接跳过质量控制。建议先记录数据版本、下载日期、空间范围、时间范围和预处理步骤,并用站点观测、流域水量平衡或已有文献进行合理性检查。

快工具会托管或转存这些数据吗?+

不会。本站只整理官方数据源入口、生成可复制脚本和说明科研流程;实际下载、配额、授权和运行环境均以官方平台为准。

相关工具推荐

继续构建科研数据工作流