How does terrain mask work and what does it actually do?

I’ve been experimenting with the various masks on sentinel 2 products. I’d like some clarification on what the terrain mask tool actually does and how it works. I’ve checked the docs but there is no in depth explanation of the various masks that I can find. Any help appreciated.

It’s true the help page is pretty sparse. I guess it tries to derive a binary land-water mask.
@cwong maybe you or @timmoorhouse can update it and explain the processor here too.

In addition. I’ve tried to process a MERIS scene (MER_RR__1PNMAP20070729_022228_000002062060_00175_28285_0001) and got the following error (all parameters set to default values):

org.esa.snap.core.gpf.OperatorException: Index: 12, Size: 12
	at org.esa.snap.engine_utilities.gpf.OperatorUtils.catchOperatorException(OperatorUtils.java:432)
	at org.esa.snap.raster.gpf.masks.TerrainMaskOp.computeTile(TerrainMaskOp.java:281)
	at org.esa.snap.core.gpf.internal.OperatorImage.computeRect(OperatorImage.java:80)
	at javax.media.jai.SourcelessOpImage.computeTile(SourcelessOpImage.java:137)
	at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
Caused: org.esa.snap.core.gpf.OperatorException: Index: 12, Size: 12
	at org.esa.snap.core.gpf.internal.OperatorExecutor$GPFImagingListener.errorOccurred(OperatorExecutor.java:376)
	at com.sun.media.jai.util.SunTileScheduler.sendExceptionToListener(SunTileScheduler.java:1646)
	at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:921)
	at javax.media.jai.OpImage.getTile(OpImage.java:1129)
	at javax.media.jai.PlanarImage.getData(PlanarImage.java:2085)
	at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64)
	at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:407)
	at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:393)
	at org.esa.snap.core.gpf.internal.OperatorImage.computeRect(OperatorImage.java:73)
	at javax.media.jai.SourcelessOpImage.computeTile(SourcelessOpImage.java:137)
	at com.sun.media.jai.util.SunTileScheduler.scheduleTile(SunTileScheduler.java:904)
	at javax.media.jai.OpImage.getTile(OpImage.java:1129)
	at com.sun.media.jai.util.RequestJob.compute(SunTileScheduler.java:247)
[catch] at com.sun.media.jai.util.WorkerThread.run(SunTileScheduler.java:468)

This exception only happened on the first run. After I started the processor again it finished successfully. But the data doesn’t look good. It seems the resolution is different within the scenes.

Thanks Marpet. The help page is quite sparse. I’ve experienced this resolution difference within scenes before but usually it boils down to a rendering issue. I’m finding SNAP is hanging quite often too.

Hello everyone,
Following up the question, I would like to know whether the Terrain mask operator takes slopes, aspects into consideration or it is just based on the DEM values. While doing terrain mask, it asks for threshold DEM value (in m), if this is true, any value greater than the given threshold value is masked??
Thank you

The operator simply creates a binary mask with pixels above and below a given surface height. No DEM derivatives are involved, but you could easily create your own mask based on multiple criteria after calculating aspect and slope in SNAP.

Thank you @ABraun