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?

enter image description here

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)

Map.centerObject(pt, 16);



var myB8 = l8.select("B8"); 

var getB8 = function(image) {

  // Reducing region and getting value
  var value_B8 = ee.Image(image)
    .reduceRegion(ee.Reducer.first(), pt)

  return value_B8;

var count = myB8.size();

var B8_list = l8.toList(count).map(getB8);

print("B8 list", B8_list);

var img = l8.first();


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);

1 Answer 1


There is a night-time image in the collection on that date. You can easily see this if you display the footprints:

enter image description here

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)
  .filter("WRS_ROW <= 122")
  • Can I use this method for different locations within Greenland to avoid night images or does it only work for this specific example?
    – xdsccc
    Apr 27, 2021 at 11:25
  • Depends on what you consider a night image. This will eliminate any ascending orbit images, which in most parts of the world, during most of the year, occur at night. But during the summer at high latitudes, it could also eliminate some images that are illuminated by the sun being above the horizon at night, and during winter, it won't eliminate images that are in darkness because the sun is below the horizon. You can always filter on SUN_ELEVATION as well, to ensure that the sun is above the horizon. Apr 28, 2021 at 12:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.