0

I'm attempting to view the FORMA Raw Output FIRMS dataset in Google Earth Engine. The thumbnail for the dataset shows it looking mostly transparent with green areas where the deforestation has occured - this is the image I would like to view and export.

Desired Image

However, when I run the code from the Earth Engine Snippet, it results in mostly black with the areas that were green in white instead.

Actual Image

What would I need to change about the code to result in the first image, and then export it into a file that I could view in Google Earth Pro?

1 Answer 1

0

I recommend the following script for exploring in the Code Editor. It creates two layers: one layer that shows tropical forested area and a second that shows only pixels that have experienced clearing. By separating the layers you can style them individually to achieve better aesthetic control. In this case, the color ramp representing percent forest cleared is stretched between 10 and 50 percent with pixels having 0 percent clearing masked out. Note that I used a different palette to indicate clearing, as green is generally associated with growth, modify as you wish.

The reason the example script looks off is that the min and max values that dictate color palette stretch in the vis params are not set very well. The range is very small and seems to be targeting units of fraction instead of percent. It is also not using a palette argument to set color, so defaults to grayscale.

// Import the collection.
var dataset = ee.ImageCollection('WRI/GFW/FORMA/raw_output_firms');

// Get the most recent image.
var image = dataset.sort('system:time_start', false).first();

// Select band representing forest change over approximately 1 month.
var nearTermDelta = image.select('near_term_delta_nday');

// Define a tropical forest pixels layer and display it to the map.
var forested = nearTermDelta.gte(0);
var forestedVis = {
  opacity: 0.3,
  palette: ['000000']
};
Map.setCenter(-60.61, 1.47, 9);
Map.setOptions('TERRAIN');
Map.addLayer(forested, forestedVis, 'Tropical forest');

// Define a tropical forest pixels cleared layer and display it to the map.
var forestCleared = nearTermDelta.selfMask();
var forestClearedVis = {
  min: 10,
  max: 50,
  palette: ['f1eef6', 'd4b9da', 'c994c7', 'df65b0', 'e7298a', 'ce1256', '91003f']
};
Map.addLayer(forestCleared, forestClearedVis, 'Percent forest cleared');

If you are interested in exporting an RGB image for display, you can use the visualize() function to create RGB images and overlay them using blend():

// Make an RGB land/water layer.
var landWaterRgb = ee.Image('MODIS/MOD44W/MOD44W_005_2000_02_24')
  .select('water_mask').unmask(1).not()
  .visualize({palette: ['black', 'gray']});

// Convert forested pixels layer to RGB.
var forestedRgb = forested.visualize(forestedVis);

// Convert cleared forest pixels layer to RGB.
var forestClearedRgb = forestCleared.visualize(forestClearedVis);

// Combine all three RGB images into a single image for export.
var rgbImg = landWaterRgb.blend(forestedRgb).blend(forestClearedRgb);

// Preview the RGB display image.
Map.addLayer(rgbImg, null, 'RGB display image');

Complete Code Editor script

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.