All surface tiles with a corner underwater (i.e. below the water table height) are marked as water. There is then a fill process, starting at the map borders, marking any connected water tiles as sea; shallow connected tiles (i.e. less than 25 deep) are considered sea shallows.
Once all tiles connected to the borders have been handled, any bodies of water that contiguously cover at least 7 tiles in a row (N-S and E-W) are considered like lake tiles. Additional water tiles next to lake tiles (i.e. the lake fills its connected tiles) are also considered lake tiles. Any lake tiles that are less than 25 dirts deep are marked as lake shallows, and any sea shallows tiles that are closer to a lake tile than a sea tile are converted to lake shallows.
For any remaining bodies of water tiles, if the body is a contiguous body of 2 in a row (N-S and E-W), the tiles are converted to pond tiles, along with any adjacent water tiles (i.e. the pond fills its connected tiles). Note that pond radius is intended to be smaller than lake radius, so a pond is a body of water that’s too small to be a lake (but still large enough to be a pond: 2-6 tiles in radius).