I have ~30,000 daily temperature rasters (.asc) from 1971-2070 which need to be renamed. They are currently named as follows: tasmax_0.asc, tasmax_1.asc,....,tasmax_32767.asc.
I need to rename them with the julian date and year (i.e., tasmax_1_1971.asc, tasmax_2_1971.asc,....,tasmax_365_2070.asc).
I know I need to use a nested loop with different counters: a julian day counter (which needs to be reset at the start of each year), and a year counter. I get easily confused with nested loops, especially where leap years would have 366 days instead of 365 and I have to reset the julian day counter every year.
I am using python 2.7
Any help with wrapping my head around writing this script would be greatly appreciated!
Thanks in advance!