我正在使用 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