# Assume we have a data array that has a time dimension, e.g. forecast_initial_time, and
# we want to compute a new time via timedelta:
# in this case, timeRange is an array of initial forecast times
for x in np.arange(0,len(timeRange),1):
for y in range(1,13):
# Add the forecast_hour to the forecast_initial_time to determine the valid time
valTime = fh.forecast_initial_time[x] + pd.Timedelta(hours=y)
print(pd.to_datetime(valTime.values,format="%Y%m%d/%H%M UTC"))
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter