At least in the US it is (mostly) easy, as
at major airports, ICAO and IATA codes are
combinded, eg,
San Francisco Intl = SFO, KSFO
LAX = LAX, KLAX (what else!)
New York JFK = JFK, KJFK
San Jose = SJC, KSJC etc etc
One I have always wondered about - Malaga, Spain = AGP - why?