European Commission logo
MenuTropical Forest Monitoring

Tropical Moist Forests product - Resources

Introduction

Welcome to the tutorial for working with the Tropical Moist Forest (TMF) dataset. This dataset is described in the Science advances paper Long-term (1990-2019) monitoring of forest cover changes in the humid tropics. This tutorial provides examples of how to use Earth Engine to visualize data layers available in the TMF dataset and presents some typical visualizations and analyses.
The scripts with the entire code are available at the end of the tutorial.

Audience

This tutorial assumes you are familiar with concepts presented in the Earth Engine Code Editor documentation pages and have worked through the Earth Engine API tutorial.

License and Attribution

The TMF data are provided free of charge and, without restriction of use.

They were produced under the Roadless-For pilot project (Making efficient use of EU climate finance: Using roads as an early performance indicator for REDD+ projects) and the Lot 2 (‘TroFoMo’ - Tropical moist Forest Monitoring) of the ForMonPol Administrative Arrangement (Forest Monitoring for Policies) funded by the Directorate-General for Climate Action of the European Commission (DG-CLIMA).

If you are using the data as a layer in a published map, please include the following attribution text: "Source: EC JRC"

Citations

C. Vancutsem, F. Achard, J.-F. Pekel, G. Vieilledent, S. Carboni, D. Simonetti, J. Gallego, L.E.O.C. Aragão, R. Nasi. Long-term (1990-2019) monitoring of forest cover changes in the humid tropics. Science Advances

Get access to Earth Engine

Access to Earth Engine is free but requires signup. To get access, please fill out our Earth Engine signup form to apply for an Evaluator account. Those granted access will receive an email within a few business days with further instructions.

Once you are familiar with the Code Editor, get started on the tutorial!

Tutorial (based on TMF 2021)

The TMF dataset contains 7 data layers that present the tropical moist forest cover and changes in different ways (see further information in the data users guide):

  1. The Transition map that captures transition stages from the initial observation period to the end of 2021 and the status of forest/changes at the end of the observation period by depicting five main land cover types with a few sub types.
  2. The Annual change collection that depicts the TMF extent and the related disturbances (deforestation and degradation), and forest regrowth (post-deforestation) for each year between 1990 and 2021. The timeline allows seeing how the TMF is changing over the past three decades.
  3. The year of deforestation corresponds to the year when the TMF has been deforested for the first time (followed or not by a regrowth).
  4. The year of degradation that corresponds to the year when the TMF has been degraded for the first time.
  5. The duration that corresponds to the number of days between the first and last disruptions detected for all the areas classified as TMF change in the transition map.
  6. The annual number of disruption observations that depicts the total number of disruption observations for each year between 1982 and 2021.
  7. The intensity that documents the total number of disruption observations detected over the disturbed period for all the areas classified as TMF change in the transition map.

And two metadata layers:

  1. The annual number of valid observations that depicts to total number of valid Landsat observations for each year between 1982 and 2021.
  2. The first year of the monitoring period that corresponds to the first year after the initial period (that starts at least four year after the first valid observation).

Four tutorials are presented in the next sections with the following objectives:

In the GEE scripts Section, we provide one script with the entire code for each tutorial, as well as the full code for visualizing and inspecting all the TMF layers (maps, metrics and metadata).

Tutorial 1 - Visualizing and inspecting the Transition map

The following steps show how to display the transition map with the color codes and label for each class (see the full code in the GEE scripts Section). This version of the Transition map corresponds to the one labeled ‘Transition Map – Sub types’ (see data users guide).

Creating a Basic Visualization

The transition map is an ImageCollection (collection of images) that we can load by copying the following statements into the Code Editor:

var TransitionMap = ee.ImageCollection('projects/JRC/TMF/v1_2021/TransitionMap_Subtypes').mosaic();  
Map.addLayer(TransitionMap);

The first statement references the Transition Map Collection that we store in a variable. As we have several images in the collection (one for each continent), we mosaic them to display a unique image.

The second statement adds the TMF Transition Map to the Code Editor's interactive map.

Click on the Code Editor's "Run" button, and after a few seconds you should see a map with grey coloring.

Inspecting Values

To explore values of the Transition Map, we will use the Code Editor's inspector tab. First click on the inspector tab, then click on the map to select a location. The inspector tab will display information on each of the layers that are present where you clicked.

In the example above, the value of the layer named TransitionMap is 42. The value corresponds to the transition class 42 with the label “Deforestation started in 2011-2018“. (see the data users guide)

Adding Visualization Parameters

To display a specific color for each transition class in GEE we add a palette with color codes for each discrete value:

var PALETTETransitionSubtypes = [rgb(0,80,0), rgb(10,100,10), rgb(10,90,60), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(30,120,0), rgb(80,150,0), rgb(100,160,40), rgb(120,170,40), rgb(100,160,40), rgb(120,170,40), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(185,200,60), rgb(200,230,60), rgb(210,250,60), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(255,240,160), rgb(255,150,8), rgb(255,90,10), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(250,60,10), rgb(170,80,10), rgb(140,100,30), rgb(140,120,60), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(40,100,50), rgb(80,150,0), rgb(200,230,60), rgb(210,250,60), rgb(255,230,110), rgb(255,60,10), rgb(155,105,70), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,50,150), rgb(0,150,200), rgb(0,160,150), rgb(0,210,210), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(51,99,51), rgb(98,161,80), rgb(188,209,105), rgb(255,228,148), rgb(250,180,150), rgb(204,163,163), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(255,255,255), rgb(237,255,215), rgb(224,250,157), rgb(214,250,188)];

And a function for converting rgb values into HEX code required for the palette:

function rgb(r,g,b){  
    var bin = r << 16 | g << 8 | b;  
    return (function(h){  
        return new Array(7-h.length).join("0")+h;  
    })(bin.toString(16).toUpperCase());  
}

To add the color and description of the class, we add the following visualization parameters: the min and max values and a palette with the colors for each class.

Map.addLayer(TransitionMap.updateMask(TransitionMap),{  
'min':10,  
'max': 94,  
'palette': PALETTETransitionSubtypes  
}, "JRC - Transition Map – Sub types - v1 2021", true);

The full code contains the label of each class.

In the next section, you explore how to recode the transition map for producing a simplified version.

Tutorial 2 - Recoding the Transition map

The following steps show how to recode the transition map for producing a simplified version of the transition classes (see the full code in the GEE scripts Section).

First, we store the Transition Map Collection in a variable named TransitionMap:

var TransitionMap = ee.ImageCollection('projects/JRC/TMF/v1_2021/TransitionMap_Subtypes').mosaic();

The second step consists of recoding the Transition Map to have the same classes as the simplified version of the transition map labeled ‘Transition Map – Main Classes’ (see the data users guide) as follows:

value 10. Undisturbed Tropical Moist Forest (TMF)
value 20. Degraded TMF
value 30. TMF regrowth
value 41. Deforested land - Forest converted to tree plantations
value 42. Deforested Land - Forest converted to water
value 43. Deforested Land - Forest converted to other land cover
value 50. Recent deforestation or degradation (2019-2021)
value 60. Permanent or Seasonal Water
value 70. Other land cover (including afforestation)

For recoding we use the image.where() operator as follows:

var TransitionMap_Main = TransitionMap.where((TransitionMap.gte(10)).and(TransitionMap.lte(12)), 10);  
TransitionMap_Main = TransitionMap_Main.where((TransitionMap.gte(21)).and(TransitionMap.lte(26)), 20);  
TransitionMap_Main = TransitionMap_Main.where((TransitionMap.gte(61)).and(TransitionMap.lte(62)), 20);  
TransitionMap_Main = TransitionMap_Main.where((TransitionMap.gte(31)).and(TransitionMap.lte(33)), 30);  
TransitionMap_Main = TransitionMap_Main.where((TransitionMap.gte(63)).and(TransitionMap.lte(64)), 30);  
TransitionMap_Main = TransitionMap_Main.where((TransitionMap.gte(81)).and(TransitionMap.lte(86)), 41);  
TransitionMap_Main = TransitionMap_Main.where((TransitionMap.gte(73)).and(TransitionMap.lte(74)), 42);  
TransitionMap_Main = TransitionMap_Main.where((TransitionMap.gte(41)).and(TransitionMap.lte(42)), 43);  
TransitionMap_Main = TransitionMap_Main.where((TransitionMap.gte(65)).and(TransitionMap.lte(66)), 43);  
TransitionMap_Main = TransitionMap_Main.where((TransitionMap.gte(51)).and(TransitionMap.lte(54)), 50);  
TransitionMap_Main = TransitionMap_Main.where((TransitionMap.eq(67)), 50);  
TransitionMap_Main = TransitionMap_Main.where((TransitionMap.gte(71)).and(TransitionMap.lte(72)), 60);  
TransitionMap_Main = TransitionMap_Main.where((TransitionMap.gte(91)), 70);

To display a specific color for each transition class in GEE we add a palette with color codes for each discrete value:

var PALETTEMainTransition = [rgb(0,80,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(100,135,35), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(210,250,60), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(255,200,148), rgb(0,200,150), rgb(255,230,100), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(250,140,10), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,70,160), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(0,0,0), rgb(255,255,255)];

And a function for converting rgb values into HEX code required for the palette:

function rgb(r,g,b){  
    var bin = r << 16 | g << 8 | b;  
    return (function(h){  
        return new Array(7-h.length).join("0")+h;  
    })(bin.toString(16).toUpperCase());  
}

To add the color and description of the class, we add the following visualization parameters: the min and max values and the palette.

Map.addLayer(TransitionMap_Main.updateMask(TransitionMap_Main),{  
'min':10,  
'max': 70,  
'palette': PALETTEMainTransition  
}, "JRC - Transition Map – Main Classes - v1 2021", true);

In the next section, you explore how to visualize and inspect the Annual Change collection.

Tutorial 3 - Visualizing and inspecting the Annual Change collection

The following steps show how to display the Annual Change collection with the color codes and label for each class (see the full code in the GEE scripts Section).

Inspecting the Annual Change collection

The Annual Change dataset is an ImageCollection (collection of images) that we can load by copying the following statements into the Code Editor:

var AnnualChanges = ee.ImageCollection('projects/JRC/TMF/v1_2021/AnnualChanges').mosaic();

To explore values of the Annual Change collection for the 32 years (1990-2021), we use the Code Editor's inspector tab. First click on the inspector tab, then click on the map to select a location. The inspector tab will display information on each of the year where you clicked.

In the example above, the values are 1 for the period 1990-2009, 2 for the period 2010-2012, and 3 for the period 2013-2021, respectively. The value corresponds to the annual change classes with the label “Undisturbed TMF”, “Degraded forest”, and “Deforested land”. Consequently, this pixel corresponds to a tropical moist forest that has been degraded for the first time in 2010 and remained degraded until 2012. In 2013 the degraded forest has been deforested for the first time and remained deforested until December 2021.

Visualizing one specific year within the Annual Change collection

First, it is necessary to select the year of interest with the following code:

var AnnualChangesYear = AnnualChanges.select('Dec2010');

To display a specific color for each class of the annual change dataset we add a palette with color codes and label for each discrete value:

var PALETTEAnnualChanges = [
    rgb(0,90,0), // val 1. Undisturbed Tropical moist forest (TMF)  
    rgb(100,155,35), // val 2. Degraded TMF  
    rgb(255,135,15), // val 3. Deforested land  
    rgb(210,250,60), // val 4. Forest regrowth  
    rgb(0,140,190), // val 5. Permanent or seasonal Water  
    rgb(255,255,255), // val 6. Other land cover  
];

And we display the year selected with the palette:

Map.addLayer(AnnualChangesYear.updateMask(AnnualChangesYear),{  
    'min': 1,  
    'max': 6,  
    'palette': PALETTEAnnualChanges  
}, "JRC - Annual Changes - one year – v1 2021", false);

In the next section, you explore how to analyze the changes between two periods from the Annual Change collection.

Tutorial 4 - Analyzing the changes between two periods

The following steps show how to compute the changes between two periods from the Annual Change collection (see the full code in the GEE scripts Section).

Tutorial 3 shows the steps for selecting a specific year within the Annual Change collection.

Here we select two specific years as follows:

var AnnualChangesYear1=AnnualChanges.select('Dec2005');  
var AnnualChangesYear2=AnnualChanges.select('Dec2015');

From these two layers we map four classes of changes:

From Undisturbed TMF to Degraded forest
From TMF to Deforested land
From TMF to Deforested to Forest regrowth
From deforested land to Forest regrowth

We use the image.where() operator for recoding as follows:

From Undisturbed TMF to degraded TMF:

var ChangesBetweenTwoPeriods = ((AnnualChangesYear1.eq(1)).and(AnnualChangesYear2.eq(2)));

From Undisturbed/Degraded TMF to deforested land (including water):

ChangesBetweenTwoPeriods = ChangesBetweenTwoPeriods.where((AnnualChangesYear1.eq(1)).and(AnnualChangesYear2.eq(3)), 2);  
ChangesBetweenTwoPeriods = ChangesBetweenTwoPeriods.where((AnnualChangesYear1.eq(2)).and(AnnualChangesYear2.eq(3)), 2);  
ChangesBetweenTwoPeriods = ChangesBetweenTwoPeriods.where((AnnualChangesYear1.eq(1)).and(AnnualChangesYear2.eq(5)), 2);  
ChangesBetweenTwoPeriods = ChangesBetweenTwoPeriods.where((AnnualChangesYear1.eq(2)).and(AnnualChangesYear2.eq(5)), 2);

From Forest (Undisturbed/Degraded TMF) to deforested land to Forest Regrowth:

ChangesBetweenTwoPeriods = ChangesBetweenTwoPeriods.where((AnnualChangesYear1.eq(1)).and(AnnualChangesYear2.eq(4)), 3);  
ChangesBetweenTwoPeriods = ChangesBetweenTwoPeriods.where((AnnualChangesYear1.eq(2)).and(AnnualChangesYear2.eq(4)), 3);

From Deforested land to Forest Regrowth:

ChangesBetweenTwoPeriods = ChangesBetweenTwoPeriods.where((AnnualChangesYear1.eq(3)).and(AnnualChangesYear2.eq(4)), 4);

To display a specific color for each class of the changes we add a palette with color codes and label for each discrete value:

var PALETTECHANGES = [
    rgb(100,135,35), // val 1. From Undisturbed TMF to Degraded forest  
    rgb(255,170,35), // val 2. From TMF to Deforested land  
    rgb(190,210,60), // val 3. From TMF to Deforested to Forest regrowth  
    rgb(210,250,60), // val 4. From deforested land to Forest regrowth  
];

And we display the year selected with the palette:

Map.addLayer(ChangesBetweenTwoPeriods.updateMask(ChangesBetweenTwoPeriods),{  
    'min': 1,  
    'max': 4,  
    'palette': PALETTECHANGES  
}, "JRC - Changes Between Two Periods – v1 2021", true);

Tutorial 5 – Download TMF data layers over your region of interest

The following steps show how to download any TMF layer over your region of interest ‘ROI’, which can be a shapefile of your study area (imported as a feature.Collection in your Google Earth Engine asset) or in this case the extent of Ivory Coast taken from the USDOS database.

var worldcountries = ee.FeatureCollection('USDOS/LSIB_SIMPLE/2017');
//https://en.wikipedia.org/wiki/List_of_FIPS_country_codes#C
var list = ee.List(['IV']); //Ivory Coast
var ROI = worldcountries.filter(ee.Filter.inList('country_co',list));

//TMF layer of interest, for instance the "DegradationYear"
var DegradationYear = ee.ImageCollection('projects/JRC/TMF/v1_2020/DegradationYear').mosaic().clip(ROI);

// Export to google drive as GeoTIFF raster
Export.image.toDrive({
  image: DegradationYear,
  description: 'JRC_TMF_DegradationYear_ROI',
  scale: 30,
  region: ROI.geometry(), 
  crs: 'EPSG:4326',
  maxPixels:1e13,
  fileFormat: 'GeoTIFF',
  formatOptions: {
    cloudOptimized: true
  }
});

Tutorial 6 – Compute and extract the statistics of forest cover change over your region of interest

The following steps show how to compute and extract the different statistics of forest cover change over your region of interest for a given period as CSV files (see the full code in the GEE scripts Section).

The script requires you to define i. the feature collection (either imported shapefile into GEE or manually drawn polygons) representing your region of interest; ii. The period defined by the start year and end year variables; iii. The name of your google drive folder where the results will be exported. Note that we have included a function to run if the study area is very large in order to speed up the statistics extraction

//*** 1) Load your study area as a feature collection. For example: var //StudyArea=ee.FeatureCollection('users/...')
var StudyArea=Sumatra;
var AOIname = 'StudyArea'; //to be replaced by the explicit name of the study area
Map.addLayer(StudyArea);
Map.centerObject(StudyArea, 8);

//*** 1bis) If your study area is large (entire regions/state), uncomment the following two lines
//*** in order to speed up the statistics extraction and to avoid error messages from GEE

// var Grid=ee.FeatureCollection('projects/JRC/TMF/ctry_grid_ecozone');
// var StudyArea = Grid.map(function(f) {return f.intersection(StudyArea.geometry(), 1)});

//*** 2) Indicate the timeframe you are interested in for extracting statistics
var StartYear = 1991; 
var Endyear = 2020; 

//*** 3) Indicate the name of the Google drive folder where the results will be exported
var GoogleDrivefolder = 'DownloadFromGEE'; //to be changed

After loading the TMF layers on degradation year, deforestation year, duration, intensity, transition and annual change, it is then time to define some specific transition classes:

//* Deforestation
var OldDeforestation=( (Transition.gte(41)).and(Transition.lte(42)) ).or( (Transition.gte(65)).and(Transition.lte(66)) );
var RecentDeforestation= ( (Transition.gte(51)).and(Transition.lte(53))).or(  (Transition.eq(67)).and(DeforestationYear.lt(2021)) ).or(  (Transition.eq(67)).and(DeforestationYear.gte(2021)).and(Intensity.gte(10)) );
var DeforestationToWater=(Transition.gte(73)).and(Transition.lte(74));
var DeforestationToPlantations=(Transition.gte(82)).and(Transition.lte(86));//

//* Forest degradation
var ShortDurationDegradation= ( (Transition.gte(21)).and(Transition.lte(22)) ).or( (Transition.gte(61)).and(Transition.lte(62)).and(Duration.lte(365)) ).or((Transition.eq(54)).or( (Transition.eq(67)).and(DegradationYear.gte(2021)).and(Intensity.lt(10)) ));
var LongDurationDegradation= ( (Transition.gte(23)).and(Transition.lte(26)) ).or( (Transition.gte(61)).and(Transition.lte(62)).and(Duration.gt(365)) );

//* Vegetation regrowth
var Regrowth=( (Transition.gte(31)).and(Transition.lte(33)) ).or( (Transition.gte(63)).and(Transition.lte(64)) );

Finally, the last part of the script consists in looping through the different years of the period of interest and computing simplified or detailed statistics of forest cover change (to be defined regarding your application).

for (var i=StartYear; i<(Endyear+1); i++) {

var j=i-1;
var year='Dec' +i;
var yearminus1= 'Dec' +j;

var AnnualChangesYear=AnnualChanges.select(year.toString());
var AnnualChangesYearMinus1=AnnualChanges.select(yearminus1.toString());

//******************************************

//*** REMAINING UNDISTURBED FOREST
var Class10=(AnnualChangesYear.eq(1)); 

//******************************************

//*** NEW DEGRADATION
var newdegradation=(AnnualChangesYearMinus1.eq(1)).and(AnnualChangesYear.eq(2));

var Class21=newdegradation.and(ShortDurationDegradation); // Short-duration degradation
var Class22= newdegradation.and(LongDurationDegradation); // Long-duration degradation    
var Class23=(newdegradation).and(OldDeforestation.or(RecentDeforestation).or(Regrowth));  // Degradation before deforestation

var totalDegradation= Class21.or(Class22).or(Class23); // Total Forest Degradation

//******************************************

//*** NEW DEFORESTATION
//Direct
var newdefordirect=(AnnualChangesYearMinus1.eq(1)).and(AnnualChangesYear.eq(3));//

var Class31=(newdefordirect).and(RecentDeforestation.or(OldDeforestation)); // Direct deforestation not followed by regrowth
var Class32=(newdefordirect).and(Regrowth); // Direct deforestation followed by regrowth
var Class33= newdefordirect.and(DeforestationToPlantations); // Deforestation to plantations

var newdeforwater=(AnnualChangesYearMinus1.eq(1)).and(AnnualChangesYear.eq(5));
var Class34= (DeforestationToWater).and(newdefordirect.or(newdeforwater)); // Deforestation to water

//After degradation
var newdeforafterdegrad=(AnnualChangesYearMinus1.eq(2)).and(AnnualChangesYear.eq(3));//

var Class35=(newdeforafterdegrad).and(RecentDeforestation.or(OldDeforestation)); // Deforestation after degradation not followed by regrowth 
var Class36=(newdeforafterdegrad).and(Regrowth); // Deforestation after degradation followed by regrowth 

var totalDeforestation= Class31.or(Class32).or(Class33).or(Class34).or(Class35).or(Class36); // Total Deforestation
var totalDirectDeforestation = Class31.or(Class32).or(Class33).or(Class34); // Total Direct Deforestation

//******************************************

//*** NEW DISTURBANCE (Degradation or deforestation)
var Disturbance = newdegradation.or(newdefordirect);

//******************************************

//*** NEW REGROWTH
var newregrowth=(AnnualChangesYearMinus1.eq(3)).and(AnnualChangesYear.eq(4));
var Class41=(newregrowth).and(Regrowth);

//******************************************
//*** Choose to extract main or detailed classes of TMF change:

// Main classes
var AllClasses = ee.Image.cat(
      Class10.rename('UndisturbedForest'), 
      totalDegradation.rename('ForestDegradation'), 
      totalDirectDeforestation.rename('DirectDeforestation'),
      newdeforafterdegrad.rename('DeforAfterDegrad'),
      Class41.rename('Regrowth')
);

// // Detailed classes
// var AllClasses = ee.Image.cat(
//       Class10.rename('UndisturbedForest'), 

//       Disturbance.rename('ForestDisturbance'),

//       totalDegradation.rename('ForestDegradation'), 
//       Class21.rename('ShortDurationDegradation'), 
//       Class22.rename('LongDurationDegradation'),  
//       Class23.rename('DegradBeforeDefor'),

//       totalDeforestation.rename('Deforestation'),
//       totalDirectDeforestation.rename('DirectDeforestation'),
//       Class31.rename('DirectDeforNotFollowedByRegrowth'), 
//       Class32.rename('DirectDeforFollowedByRegrowth'),  
//       Class33.rename('DirectDeforToPlantations'),
//       Class34.rename('DirectDeforToWater'),
//       Class35.rename('DeforAfterDegradNotFollowedByRegrowth'),
//       Class36.rename('DeforAfterDegradFollowedByRegrowth'),

//       Class41.rename('Regrowth')
// );

//******************************************

var LOOPsamples= function(feature) {
  var vals = AllClasses.multiply(ee.Image.pixelArea()).reduceRegion({
    reducer: ee.Reducer.sum(), 
    geometry: feature.geometry(),
    scale: 30,
    maxPixels: 5e9,
  });
  return ee.Feature(null, vals).copyProperties(feature, feature.propertyNames());
};

var LOOPresult2=StudyArea.map(LOOPsamples); // results in square meters, should be divided by 10000 to get hectares

Export.table.toDrive({
    collection: LOOPresult2,
    description: 'AnnualChange_'+AOIname+ '_' + year,
    folder: GoogleDrivefolder, // CSV file containing the statistics for each year
    fileNamePrefix: 'AnnualChange_'+AOIname+ '_' + year,
});

}  

GEE scripts for starting exploring the TMF dataset (based on TMF 2021)

The following script displays the transition map (with subtypes) with the color codes and label for each class: https://code.earthengine.google.com/c45451d79ff38e2c4973d79a8a2851a6

The following script allows recoding the transition map in a simplified version with the main transition classes (without subtypes): https://code.earthengine.google.com/56458c83bd7ff002873a0bf6ee25697d

The following script displays the annual change collection with the color codes and label for each class: https://code.earthengine.google.com/843ef338d7cd60b19f380c9205d1003b

The following script maps the changes between two periods: https://code.earthengine.google.com/b11eaf7cf6d2c6f6382ca65b8c0575be

The following script shows an example to download one TMF layer over a region of interest (in this case a given country) https://code.earthengine.google.com/7f1c85e59c0cb13a4cc5b7d32a927450

The following script allows the extraction of statistics of forest cover change for a given region of interest (in this case it is a feature collection of two polygons over Sumatra) and for a given period. https://code.earthengine.google.com/b01edb7dd04a8e2b37dfa29ed826ef78

The following script allows visualizing and inspecting all the TMF layers (maps, metrics and metadata): https://code.earthengine.google.com/62e68a3412eaaac04663a7242937e88b