Ships are almost always the better idea; the limiting factor will usually be starcharts once you start building them a ton. Their effect doesn't diminish, and their cost never goes up. In fact, as you build workshops/factories, the cost per ship goes down, effectively, because you get more per craft.
At very low numbers of harbours, and very large numbers of ships, the numbers almost certainly do tip the other way. In practice, that's unlikely to happen, as starcharts don't become truly plentiful prior to SETI, by which point you'll have a bunch of harbours.
All the above being said, though, if you need storage, and you've run out of starcharts, then harbours certainly aren't a bad idea.
So, I've gotten home, looked at the code, and... the above wasn't entirely right.
Firstly, Cargo Ships (as of this writing) is only worth +1% to harbor capacity per ship. I've reported the bug, time will tell whether the upgrade description is wrong, or the code.
Secondly, the Cargo Ship boost is subject to diminishing returns; the cap is 225%, with the Reactor Vessel upgrade increasing it by 5% per reactor. This means that your first 168 ships are working at full power, and past that, the function described here applies.
Still, 168 is a decent number of ships, so I still sat down and did some math for their costs in plates and scaffolds, since those are the two resources they both cost.
If you have no ships yet:
- For Scaffolds, you need 30 harbours before buying ships is cheaper.
- For Plates, you need only about 18.
If you already have twenty ships:
- For Scaffolds, you need 32 harbours before buying ships is cheaper.
- For Plates, you need only about 19.
At a hundred ships:
- For Scaffolds, you need 35 harbours before buying ships is cheaper.
- For Plates, you need only about 21.
Thus, around 20-30 harbours, it suddenly becomes profitable to start buying ships en masse, at least until you hit the diminishing returns a fair bit.
Overall, though, I think my original answer's advice still stands; buy both. Star Charts will usually be the limit to your ship-buying anyway, and they do have other uses:
- Each ship increases the chance of titanium when trading with zebras. Chance is (15 + (0.35 * ships))% No diminishing returns here (I checked), though it stops being a benefit once you hit 100%, which is at 243 ships
- A ship is needed to unlock Zebras for trading in the first place. Unlocking zebras also unlocks the Caravanserai upgrade (though, the Navigation tech will generally unlock Caravanserai first).
- A hundred ships are needed to unlock trade with Spiders