The Land/Water Mask Processor provides an API as well as an operator for creating an accurate, shapefile-based land-water mask.
Land/Water Mask Algorithm Specification
Land/Water Mask Processor Documentation