The primary forest can be mapped in a number of ways. One of them is described here, where the base year 2000 map for the primary forest is used in relation with the forest definitions on tree canopy cover (tcc) and tree canopy height (tch) to calculate the primary forest in each year. Turns out, we can also use the tcc datasets only to get the final primary forest.

The source code looks like and is available here.

var tcc = ee.ImageCollection("projects/servir-mekong/yearly_primitives_smoothed/tree_canopy");

var tccThreshold = 25;

var primaryForest = tcc.map(function (image) {
    return image.gt(tccThreshold);
});

var primaryForest = primaryForest.sum().eq(ee.Number(tcc.size().getInfo()));
primaryForest = primaryForest.updateMask(primaryForest);

Map.addLayer(primaryForest, {min:0, max:1, palette: 'green'}, 'primary forest');

Happy Earth Science 🙂