The railway line between Aberdeen and Dundee is due to reopen next week after a fatal crash near Stonehaven.
It has been shut since August 12, when a ScotRail service struck a landslip, causing the train to derail.
Driver Brett McCullough, conductor Donald Dinnie and passenger Christopher Stuchbury died in the crash.
- Stonehaven report: Climate change impact on railways ‘accelerating’
- Railways fall silent to remember those lost in Stonehaven derailment
The incident caused extensive damage to the track, a bridge, embankments and drainage systems.
Network Rail engineers have been working round the clock since the crash, initially supporting accident investigators before beginning work in September to recover the derailed train carriages and repair and reopen the railway.
Work included building a new 900-metre road and temporary bridges over the surrounding farmland, replacing more than 500 metres of damaged track and 70 metres of bridge parapets, and relaying 400 metres of telecoms cables.
Drainage systems and flood defences have been repaired and enhanced, while the railway embankment beneath the crash site has been rebuilt.
Driver Brett McCullough, 45, conductor Donald Dinnie, 58, and passenger Christopher Stuchbury, 62, died when the 6.38am ScotRail service from Aberdeen to Glasgow Queen Street train crashed into a landslide across the tracks near Stonehaven on August 12 following heavy rain. The line is now expected to reopen on Tuesday.
Thoughts continue to be with victims
Alex Hynes, managing director of Scotland’s Railway, said: “We continue to work closely with accident investigators as we seek to learn the lessons of this tragedy and make our railway as safe as possible for our people and our passengers.
“Our thoughts continue to be with the families and friends of Brett, Donald and Christopher, and with the other passengers and colleagues who were affected by the accident.
“Our engineers have been working round the clock to repair and reopen the railway, and we thank all our customers and lineside neighbours for the understanding they have shown during this difficult and distressing event.”
ScotRail has been operating shuttle bus services between Aberdeen and Stonehaven and Montrose and Edinburgh since the crash.
Replacement bus services have also been in place between Aberdeen and Edinburgh, linking into cross-border trains.
After the incident on August 12, Network Rail introduced a range of additional safety measures, including inspections of high risk sites, and launched two taskforces.