A flood warning system for railways