Proposals to create new student flats on a scrapyard in Leith featured in Trainspotting 2 have been refused over concerns over flooding.