Nowhere in the text of the spell does it say that it can't be, or that it has to be cast or water or ground. I cast it for the first time recently and the DM and another player both expressed concern that it was in mid-air. In particular, if it knocks a flying, non-hovering creature prone it can cause a lot of fall damage and they felt this wasn't the intention of the spell. The spell does say, "the water then spreads out across the ground in all directions" but it's not clear if that implies it started on the ground or if it would fall to the ground from a height and then spread out.
The spell tidal wave says:
You conjure up a wave of water that crashes down on an area within range. The area can be up to 30 feet long, up to 10 feet wide, and up to 10 feet tall.
The spell makes no assumptions about being cast in the air, on the ground or even in the sea itself. The section of the rules on targets makes clear that targeted areas are 3d in nature and can be in the air.
The concern about fall damage is not the fault of the spell, it was the choice of the DM to use flying monsters. If you cast any other spell that knocks targets prone, it wouldn't be question, right?
As for the line:
The water then spreads out across the ground in all directions, extinguishing unprotected flames in its area and within 30 feet of it, and then it vanishes.
The water will eventually reach the ground, and when it does it will vanish. Creatures under the targeted area will get rained on, but not suffer the effects the spell. I see this is just a mechanic to get rid of all the newly created water so that it doesn't turn all the combat into aquatic combat after the spell.