You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Google Earth Engine中输出指定像元的聚合值?

Calculate Total Precipitation for a Specific Point in Google Earth Engine

Got it, here's a straightforward solution to compute the total precipitation sum for a given geographic point using Google Earth Engine, leveraging NASA's IMERG monthly precipitation dataset. Let's break it down step by step:

Step-by-Step Implementation

1. Define Your Target Point

First, specify the geographic coordinates of the point you're interested in. Remember, GEE uses the WGS84 (EPSG:4326) coordinate system, where you need to input longitude first, latitude second.

2. Fetch and Filter Precipitation Data

We'll use the NASA/GPM_L3/IMERG_MONTHLY_V06 collection, which provides reliable monthly precipitation estimates. We filter it by your desired time range and the bounds of your target point to narrow down the data we need (and optimize computation speed).

3. Compute Total Precipitation Sum

Use a sum reducer to accumulate precipitation values across all images in the filtered collection, giving us a single total value for the period.

4. Extract and Output the Result

Pull the computed sum from GEE's server to your local environment and print it out for review.


Full Working Code

// Define the target point (longitude, latitude)
var loc_point = ee.Geometry.Point([-0.627983, 52.074361]);

// Fetch and filter the IMERG monthly precipitation dataset
var precip = ee.ImageCollection('NASA/GPM_L3/IMERG_MONTHLY_V06')
  .filterDate('2019-06-01', '2020-06-30') // Time range: June 2019 to June 2020
  .filterBounds(loc_point) // Keep only images that cover the target point
  .select('precipitation'); // Select the precipitation band

// Calculate the total precipitation sum across the collection
var precip_sum = precip.reduce(ee.Reducer.sum());

// Extract the sum value and print it to the GEE console
var totalPrecipitation = precip_sum.get('precipitation_sum').getInfo();
print('Total Precipitation (mm):', totalPrecipitation);

Key Details to Note

  • Coordinate Order: Always stick to [longitude, latitude] when defining points in GEE—this is a super common mistake that breaks location targeting!
  • Filtering: filterBounds() ensures we only process images that include your point, which cuts down on unnecessary computation.
  • Reducer: ee.Reducer.sum() aggregates precipitation values over all images in the filtered collection, storing the total in a new band named precipitation_sum.
  • getInfo(): This method pulls the server-side computation result to your local machine. For large datasets, this might take a moment, so avoid overusing it for massive computations.

内容的提问来源于stack exchange,提问作者Juba

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.08 14:27:53