They are sometimes fitted to storm drain inflows and outflows to prevent debris from entering a natural watercourse.
[1] Trash racks composed of vertical wooden strakes separated by narrow gaps are very common and perform extremely poorly.
Metal gratings are sturdier and can have narrower strakes, and angling the trash rack properly can allow some self-cleaning from the action of the water.
Modern trash racks as used by hydroelectric plants can incorporate such advanced features as wedge-wire screens, the Coanda effect, and cleaning robots.
[2] Close spacing keeps out more small floating debris or fish, but may plug up easily with frazil ice in cold climates.