Geographic Information Systems Asked by xdsccc on March 26, 2021
I am extracting values of the B8 of Landsat8 in Google Earth Engine and for several month I receive two very different values for the same date and cannot find the issue.
How can I handle this?
My code:
var maskL8 = function(image) {
var qa = image.select('BQA');
/// Check that the cloud bit is off.
// See https://www.usgs.gov/land-resources/nli/landsat/landsat-collection-1-level-1-quality-assessment-band
var mask = qa.bitwiseAnd(1 << 4).eq(0);
return image.updateMask(mask);
}
var start = '2020-07-01';
var finish = '2020-07-30';
var pt = ee.Geometry.Point([-49.31582, 69.56833]);
// Map the function over one year of Landsat 8 TOA data and take the median.
var l8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
.filterDate (start,finish)
.filterBounds(pt)
.map(maskL8);
//Map.addLayer(B8);
//Map.addLayer(pt);
Map.centerObject(pt, 16);
print(l8);
// B8 VALUE OF PT
var myB8 = l8.select("B8");
print("myB8",myB8);
var getB8 = function(image) {
// Reducing region and getting value
var value_B8 = ee.Image(image)
.reduceRegion(ee.Reducer.first(), pt)
.get('B8');
return value_B8;
};
var count = myB8.size();
var B8_list = l8.toList(count).map(getB8);
print("B8 list", B8_list);
var img = l8.first();
Map.addLayer(img);
Map.addLayer(pt);
var allDates = l8.aggregate_array('system:time_start');
var allDatesSimple = allDates.map(function procDates (ele) {
return ee.Date(ele).format().slice(0,10);
});
var paired = allDatesSimple.zip(B8_list);
print (paired);
There is a night-time image in the collection on that date. You can easily see this if you display the footprints:
You can skip those by limiting the WRS_ROW property to be <= 122.
var l8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
.filterDate (start,finish)
.filterBounds(pt)
.filter("WRS_ROW <= 122")
.map(maskL8);
Answered by Noel Gorelick on March 26, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP