Concerning “Landsat 5’s cloud mask and pixel quality assessment” in Google Earth Engine

I need assistance for solving a problem with Landsat 5 surface reflectance image’s cloud mask.

I am new to this tool/programming and want to try this tool to process cloud mask. Through the provided open source code in the web page of Goole Earth Engine, the processing code is composed as below.

However, I would like to request help to debug this error message “Error: Invalid argument: ‘image’ must be of type Image.”


var cloudy_scene = ee.Image('LANDSAT/LT5_SR/LT5*************');

Map.centerObject(cloudy_scene);

Map.addLayer(cloudy_scene,{},'all_bands_cloud');

// Load a Landsat 5 image collection.
var collection = ee.ImageCollection("LANDSAT/LT5_SR")

// Filter to get a geometry representing an export region.
.filterBounds(ee.Geometry.Rectangle([***.***,**.***,***.***,**.***]))

// Filter to get the years/months/days of data.
.filterDate('1993-01-01', '1993-03-01')  // filter to your favorite period

// Sort the collection in chronological order.
.sort('system:time_start', true);

//Details for cfmask
//0=clear
//1=water
//2=shadow
//3=snow
//4=cloud

var masked = collection.map(function(image){  
    return image.updateMask(cloudy_scene.select(['cfmask']).neq(4))
});

// Apply the mask to the image and display the result.
Map.addLayer(masked, {}, 'masked');

var geometry = ee.Geometry.Rectangle([***.***,**.***,***.***,**.***]);

//export the image, specifying scale and region.
Export.image.toDrive({
    image: masked,
    description: 'ImageToDrive',
    scale: 30,
    region: geometry
});

Leave a Reply

Your email address will not be published. Required fields are marked *