Google Earth Engine——ndwi水体面积计算(landsat4/5/8)出现的无法加载影像的问题

简介: Google Earth Engine——ndwi水体面积计算(landsat4/5/8)出现的无法加载影像的问题

我正在使用 Landsat 图像估算水库的存储容量。我有可用的代码…但问题是当我尝试为我的研究区域运行该代码时,它不显示任何图像。这里的问题:

函数:

intersection(other)

Returns a DateRange that contains all points in the intersection of this DateRange and another.

Arguments:

this:dateRange (DateRange)

other (DateRange)

Returns: DateRange

ee.Image.pixelArea()

Generate an image in which the value of each pixel is the area of that pixel in square meters. The returned image has a single band called “area.”

No arguments.

Returns: Image

reduceRegion(reducer, geometry, scale, crs, crsTransform, bestEffort, maxPixels, tileScale)

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

ui.Chart.image.series(imageCollection, region, reducer, scale, xProperty)

Generates a Chart from an ImageCollection. Plots derived values of each band in a region across images. Usually a time series.

X-axis: Image, labeled by xProperty value.

Y-axis: Band value.

Series: Band names.

Returns a chart.

Arguments:

imageCollection (ImageCollection):

An ImageCollection with data to be included in the chart.

region (Feature|FeatureCollection|Geometry):

The region to reduce.

reducer (Reducer, optional):

Reducer that generates the values for the y-axis. Must return a single value. Defaults to ee.Reducer.mean().

scale (Number, optional):

Scale to use with the reducer in meters.

xProperty (String, optional):

Property to be used as the label for each image on the x-axis. Defaults to ‘system:time_start’.

Returns: ui.Chart

var albufeira = ee.FeatureCollection("users/bqt2000204051/huodong");
/// JAVASCRIPT CODE DEVELOPED 
// Monitoring the storage volume of water reservoirs using Google Earth Engine /
// Joaquim Condeça, João Nascimento and Nuno Barreiras /
///WATER AREA(m2) FOR ALVITO, CAIA, MARANHÃO AND ROXO RESERVOIRES - LANDSAT 4,5 e 8/
///EXEMPLE FOR MNDWI, XU,2006///
// NDWI = (green - mir) / (green + mir)/
// green: Banda B2   //
// mir:   Banda B5  //
/ THE var albufeira must be include as Assets (shapefile geometry of the reservoirs)
/// BEGIN Functions cloudMaskL457 and maskL8sr ///
/// Functions to mask clouds based on the pixel_qa band of Landsat SR data
/// SOURCE: https://developers.google.com/earth-engine/datasets/catalog/LANDSAT_LT05_C01_T1_SR#bands
/// The recommendation is the use of two functions (cloudMaskL457, for Landsat 4 and 5 images, and maskL8sr, for Landsat 8 images), 
/// which use the “pixel_qa” band of Landsat SR images to mask the clouds (GEE, 2020).
/// pixel_qa -> Pixel quality attributes generated from the CFMASK algorithm.
var cloudMaskL457 = function(image) {
   
  var qa = image.select('pixel_qa');
  // If the cloud bit (5) is set and the cloud confidence (7) is high
  // or the cloud shadow bit is set (3), then it's a bad pixel.
  var cloud = qa.bitwiseAnd(1 << 5)
                  .and(qa.bitwiseAnd(1 << 7))
                  .or(qa.bitwiseAnd(1 << 3));
  // Remove edge pixels that don't occur in all bands
  var mask2 = image.mask().reduce(ee.Reducer.min());
  return image.updateMask(cloud.not()).updateMask(mask2);
};
/**
 * Function to mask clouds based on the pixel_qa band of Landsat 8 SR data.
 * @param {ee.Image} image input Landsat 8 SR image
 * @return {ee.Image} cloudmasked Landsat 8 image
 */
function maskL8sr(image) {
   
  // Bits 3 and 5 are cloud shadow and cloud, respectively.
  var cloudShadowBitMask = (1 << 3);
  var cloudsBitMask = (1 << 5);
  // Get the pixel QA band.
  var qa = image.select('pixel_qa');
  // Both flags should be set to zero, indicating clear conditions.
  var mask = qa.bitwiseAnd(cloudShadowBitMask).eq(0)
                 .and(qa.bitwiseAnd(cloudsBitMask).eq(0));
  return image.updateMask(mask);
}
/// END
相关文章
|
6月前
|
数据可视化 定位技术 Sentinel
如何用Google Earth Engine快速、大量下载遥感影像数据?
【2月更文挑战第9天】本文介绍在谷歌地球引擎(Google Earth Engine,GEE)中,批量下载指定时间范围、空间范围的遥感影像数据(包括Landsat、Sentinel等)的方法~
2341 1
如何用Google Earth Engine快速、大量下载遥感影像数据?
|
6月前
|
机器学习/深度学习 算法 数据可视化
基于Google Earth Engine云平台构建的多源遥感数据森林地上生物量AGB估算模型含生物量模型应用APP
基于Google Earth Engine云平台构建的多源遥感数据森林地上生物量AGB估算模型含生物量模型应用APP
217 0
|
6月前
|
存储 编解码 数据可视化
Google Earth Engine获取随机抽样点并均匀分布在栅格的不同数值区中
【2月更文挑战第14天】本文介绍在谷歌地球引擎(Google Earth Engine,GEE)中,按照给定的地表分类数据,对每一种不同的地物类型,分别加以全球范围内随机抽样点自动批量选取的方法~
524 1
Google Earth Engine获取随机抽样点并均匀分布在栅格的不同数值区中
|
6月前
|
编解码 人工智能 算法
Google Earth Engine——促进森林温室气体报告的全球时间序列数据集
Google Earth Engine——促进森林温室气体报告的全球时间序列数据集
84 0
|
6月前
|
编解码 人工智能 数据库
Google Earth Engine(GEE)——全球道路盘查项目全球道路数据库
Google Earth Engine(GEE)——全球道路盘查项目全球道路数据库
126 0
|
6月前
|
编解码
Open Google Earth Engine(OEEL)——matrixUnit(...)中产生常量影像
Open Google Earth Engine(OEEL)——matrixUnit(...)中产生常量影像
74 0
|
6月前
Google Earth Engine(GEE)——导出指定区域的河流和流域范围
Google Earth Engine(GEE)——导出指定区域的河流和流域范围
252 0
|
6月前
|
传感器 编解码 数据处理
Open Google Earth Engine(OEEL)——哨兵1号数据的黑边去除功能附链接和代码
Open Google Earth Engine(OEEL)——哨兵1号数据的黑边去除功能附链接和代码
116 0
|
6月前
Google Earth Engine(GEE)——当加载图表的时候出现错误No features contain non-null values of “system:time_start“.
Google Earth Engine(GEE)——当加载图表的时候出现错误No features contain non-null values of “system:time_start“.
120 0
|
6月前
|
编解码 定位技术
Google Earth Engine(GEE)——导出后的影像像素不同于原始Landsat影像的分辨率(投影差异)
Google Earth Engine(GEE)——导出后的影像像素不同于原始Landsat影像的分辨率(投影差异)
148 0