Waverley is the main train station in Edinburgh. It is in the valley between Princes Street and Royal Mile. Trains were arriving and departing quite often and you could look down on them from the side of the castle. If you crossed the tracks from the castle you would end up in Princes Street Gardens.
https://en.wikipedia.org/wiki/Edinburgh_Waverley_railway_station
https://en.wikipedia.org/wiki/Princes_Street
https://en.wikipedia.org/wiki/Edinburgh_Castle
https://en.wikipedia.org/wiki/Princes_Street_Gardens