Google Earth Engine(GEE)—— 超限超时提取的问题(besteffort的适用)

举报
此星光明 发表于 2022/07/16 22:55:39 2022/07/16
【摘要】 当您有超过 10000000 个像素时,bestEffort 参数将仅使用像素子集来计算统计信息。如果您想要实际的最小值/最大值,请将 maxPixels 设置为更高的数字使用图层管理器​​计算的参数是使用您所在缩放级别的地图中可见像素的子集完成的。 ( 参考)。可以得到近似的最小值/最大值如果您想要实际的最小/最大值,则需要...
  • 当您有超过 10000000 个像素时,bestEffort 参数将仅使用像素子集来计算统计信息。如果您想要实际的最小值/最大值,请将 maxPixels 设置为更高的数字
  • 使用图层管理器​​计算的参数是使用您所在缩放级别的地图中可见像素的子集完成的。 ( 参考)。可以得到近似的最小值/最大值
  • 如果您想要实际的最小/最大值,则需要以原始比例(30m)为整个几何图形运行计算

推荐的方法是使用 evaluate() 异步计算统计数据并在完成后添加图层。请记住,evaluate() 返回一个客户端对象,您必须使用 javascript 方法从对象中提取值。 

函数:

reduceRegion(reducer, geometryscalecrscrsTransformbestEffortmaxPixelstileScale)

Apply a reducer to all the pixels in a specific region.

Either the reducer must have the same number of inputs as the input image has bands, or it must have a single input and will be repeated for each band.

Returns a dictionary of the reducer's outputs.

Arguments:

this:image (Image):

The image to reduce.

reducer (Reducer):

The reducer to apply.

geometry (Geometry, default: null):

The region over which to reduce data. Defaults to the footprint of the image's first band.

scale (Float, default: null):

A nominal scale in meters of the projection to work in.

crs (Projection, default: null):

The projection to work in. If unspecified, the projection of the image's first band is used. If specified in addition to scale, rescaled to the specified scale.

crsTransform (List, default: null):

The list of CRS transform values. This is a row-major ordering of the 3x2 transform matrix. This option is mutually exclusive with 'scale', and replaces any transform already set on the projection.

bestEffort (Boolean, default: false):

If the polygon would contain too many pixels at the given scale, compute and use a larger scale which would allow the operation to succeed.如果多边形在给定的比例下包含太多的像素,则计算并使用一个更大的比例,这样可以使操作成功。

maxPixels (Long, default: 10000000):

The maximum number of pixels to reduce.要统计的最大像素数。

tileScale (Float, default: 1):

A scaling factor between 0.1 and 16 used to adjust aggregation tile size; setting a larger tileScale (e.g. 2 or 4) uses smaller tiles and may enable computations that run out of memory with the default.

Returns: Dictionary

代码:


  
  1. var ss = ee.FeatureCollection("users/bqt2000204051/Qinghai");
  2. var NDVIImgColl = ee.ImageCollection('LANDSAT/LC08/C01/T1_8DAY_NDVI')
  3. .filterDate('2018-11-01', '2019-04-30').select('NDVI').mean();
  4. Map.addLayer(NDVIImgColl.clip(ss), {}, "NDVI")
  5. var NDVIavg = NDVIImgColl.clip(ss)
  6. var stats = NDVIavg.reduceRegion({
  7. reducer: ee.Reducer.minMax(),
  8. geometry : ss,
  9. scale : 30,
  10. maxPixels: 1e10
  11. });
  12. var varmax1 = ee.Number(stats.get("NDVI_max"));
  13. print("Max NDVI in AOI", varmax1)
  14. // evaluate() 将在后台运行,而 最小/最大值的计算
  15. stats.evaluate(function(result) {
  16. var min = result['NDVI_min']
  17. var max = result['NDVI_max']
  18. print('Computed min/max', min, max)
  19. var visParams = {min: min, max:max}
  20. Map.addLayer(NDVIImgColl.clip(ss), visParams, 'Min/Max Stretch');
  21. })

这里没有best effort的运行状态,一致再加载:


  
  1. var stats = NDVIavg.reduceRegion({
  2. reducer: ee.Reducer.minMax(),
  3. geometry : ss,
  4. scale : 30,
  5. maxPixels: 1e10,
  6. bestEffort:true
  7. });

使用后的bestEffort参数结果:

NDVI均值:

 最大最小值:

文章来源: blog.csdn.net,作者:此星光明,版权归原作者所有,如需转载,请联系作者。

原文链接:blog.csdn.net/qq_31988139/article/details/123819108

【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。