I am stuck at somewhat simple looking calculation. I have daily temperature rasters from 2001 to 2014 with following name format:
`2001001``2001002` | | `2014365`I want to compute annual mean rasters using overlapping cells of same years. How do I insert all rasters from same year as a list of rasters into the numpy.mean at the end of following? Any suggestions to get annual mean rasters would be appreciative.
import arcpyfrom numpy impot *# Define time duration to handle leap years#**************************************************time = []start_date = datetime.datetime(2001,1,1)end_date = datetime.datetime(2012,12,31)step = datetime.timedelta(days = 1)while start_date < end_date: time.append(start_date.strftime('%Y%j')) start_date += steptime = [int(i) for i in time]# Convert rasters to numpy array and compute mean#**************************************************for ii in time: ras = arcpy.RasterToNumPyArray(file_path + str(ii)) tt = time[ii] if ii == 0: year_old = tt[0:4] index_start = ii else: year = tt[0:4] if year != year_old: year_mean = numpy.mean([index_start:ii],axis=0)
أكثر...
`2001001``2001002` | | `2014365`I want to compute annual mean rasters using overlapping cells of same years. How do I insert all rasters from same year as a list of rasters into the numpy.mean at the end of following? Any suggestions to get annual mean rasters would be appreciative.
import arcpyfrom numpy impot *# Define time duration to handle leap years#**************************************************time = []start_date = datetime.datetime(2001,1,1)end_date = datetime.datetime(2012,12,31)step = datetime.timedelta(days = 1)while start_date < end_date: time.append(start_date.strftime('%Y%j')) start_date += steptime = [int(i) for i in time]# Convert rasters to numpy array and compute mean#**************************************************for ii in time: ras = arcpy.RasterToNumPyArray(file_path + str(ii)) tt = time[ii] if ii == 0: year_old = tt[0:4] index_start = ii else: year = tt[0:4] if year != year_old: year_mean = numpy.mean([index_start:ii],axis=0)
أكثر...