I have twenty .tif files which contain data from a globally mapped model. I am importing the files to python so I can rotate them, and make the .tif files Atlantic centered rather than Pacific centered. I can rotate individual files using the code below, however, I want to import all 20 files, rotate them all, and save them all in a new location using a loop rather than repeating the below lines of code for every single file.
TLDR: I need advice on how to loop the code below so can rotate 20 .tif files which are all in the same folder.
import rioxarray
rds_2000 = rioxarray.open_rasterio("path_to_tif")
rds_2000 = rds_2000.assign_coords(x=(((rds_2000.x + 180) % 360) - 180)).sortby('x')
rds_2000.rio.to_raster("path_to_newly_saved_tif)
