Mask coastal area in MPIOM
This NCL script creates a NetCDF file with a coast-following mask for the ocean. The user can choose a distance. Every ocean grid cell that is within this distance from the coast will get the value 1, everything else will be missing values.
This script is using a number of nested loops and is therefore not very efficient. Because the script will most likely only run once to create a mask file, efficiency is not of major importance in this case.
If you are only interested in a small area, use only this area as an input for the script to reduce computational cost and thus runtime.