Aggregate Rasters with Python?

804
1
09-14-2016 09:52 AM
NMWater
New Contributor III

Hi! 

I'm trying to aggregate daily rasters into monthly rasters. I wanted to use a wildcard, however, the date values of these rasters are in Day of Julian Calendar Year. 

Usually, I do two for loops: 

for year in range(2000, 2016):  #years of models 2000-2015

   for month in range(1,13): #calendar months 1-12

Ex: ModelV3_2014001, ModelV3_2014002

However, since the file names have the DOY instead of the month, how would I address this issue?

Any suggestions or help would be greatly appreciated! 

Many thanks! 

0 Kudos
1 Reply
XanderBakker
Esri Esteemed Contributor

You can use timedelta to calculate the date based on the daynumber in a year as explained here:

python - Convert julian day into date - Stack Overflow