Passengers face travel disruption as work begins on upgrading tracks for the South Wales Metro.
From 3 August until December, trains to Merthyr Tydfil, Aberdare and Treherbert will be replaced by buses from 20:00 to 05:00, except on Fridays and Saturdays.
Transport for Wales (TfW) said social-distancing measures would be in place due to coronavirus.
Economy Minister Ken Skates said upgrading the network would help with the economic recovery from Covid-19.
In 2018, £119m of funding was announced for the upgrading of lines and stations for the South Wales Metro - which forms links between Cardiff and the south Wales Valleys.
Phase two work, upgrading lines on the Merthyr, Treherbert, Aberdare and Rhymney lines, is scheduled to be completed by 2023.
TfW said work to upgrade the network, mainly built in the Victorian era, would begin on August 3 and take about three years.
At the start of 2020, a new Metro Infrastructure Hub was opened at Treforest, while work is ongoing at the Metro Control Centre at Taff's Well.
CEO of TfW James Price said upgrading the lines would help the work would create a "faster, greener and more frequent" rail service.
"Transport for Wales is absolutely committed to delivering the South Wales Metro and we've now moved forward with further transformational works," he said.
"We understand the impact of Covid-19 but will be following all relevant safety advice from the Welsh Government as we push forward with our investment programme."
"This is a once-in-a-generation project and through building the South Wales Metro we hope to help regenerate the economy in Wales especially as we enter the Covid-19 recovery phase."
Economy and Transport Minister Ken Skates said the South Wales Metro provided a "real opportunity to assist in the economic recovery from Covid-19" by connecting local businesses and supply chains.
"Our investment in Metro systems in the north and the south of Wales is evidence of our commitment to creating a modern transport network that will meet Wales' future needs," he said.