0

I would like to extract the Albedo values at a certain point. I found an answer in a Stackoverflow post to help my problem and adjusted it. However, I cannot manage to get the cloud-masking to work because I cannot find the correct band to choose for the mask. It keeps showing an error.

And I was wondering if there might be a possibility to include the shape coordinates of the MODIS pixel that is used at the location?

// A function to mask out cloudy pixels.
var maskClouds = function(image) {
  // Select the QA band.
  var QA = image.select('BRDF_Albedo_Band_Mandatory_Quality_shortwave Bitmask')
  // Make a mask to get bit 10, the internal_cloud_algorithm_flag bit.
  var bitMask = 1 << 10;
  // Return an image masking out cloudy areas.
  return image.updateMask(QA.bitwiseAnd(bitMask).eq(0))
}

var POI = ee.Geometry.Point([-49.31582,69.56833]);
var modis = ee.ImageCollection('MODIS/006/MCD43A3');
var modisAlbedo = modis.filterBounds(POI)
                    .filterDate('2019-01-01', '2019-12-31')
                    .map(maskClouds)
                    .select('Albedo_WSA_shortwave');

// Scaling
modisAlbedo = modisAlbedo.map(function(img){
  var date = img.get('system:time_start');
  return img.multiply(0.001).set('system_time_start', date);
});

// Create a function that takes an image, calculates the mean over a
// geometry and returns the value and the corresponding date as a 
// feature.
var createAlbedo = function(img){
var date = img.get('system_time_start');
var value = img.reduceRegion(ee.Reducer.first(), POI).get('Albedo_WSA_shortwave');
  var ft = ee.Feature(null, {'system:time_start': date, 
                             'date': ee.Date(date).format('Y/M/d'), 
                             'value': value});
  return ft;
};

// Apply the function to each image 
var Albedo = modisAlbedo.map(createAlbedo);

// Export the time-series as a csv.
Export.table.toDrive({collection: Albedo,
  description: 'MODIStest', 
  folder: 'MODIS_Albedo_006_MCD43A3',
  selectors: 'date, value'});
  
print (Albedo);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.