Good afternoon!
I am kindly requesting insight into the "time" variable in CESM2 historical output data. While the filename ('psl_Amon_CESM2_historical_r4i1p1f1_gn_185001-201412.nc') indicates that the historical run extends from January 1850 to December 2014, my time conversion using Python's datetime module yields a start date of October 24, 1848. Has anyone else run into a similar issue? The historical file's metadata states that the "time" variable is days since 0001-01-01, which is what I use to calculate the date at each timestep. Any and all help is greatly appreciated. Thanks in advance!
Here's my code:
hist_file = nc.Dataset('psl_Amon_CESM2_historical_r4i1p1f1_gn_185001-201412.nc')
time = hist_file.variables['time'][:]
from datetime import date, timedelta
monthly_dates = []
start = date(1,1,1)
for i in time:
days = i
delta = timedelta(days)
offset = start + delta
monthly_dates.append(offset)
monthly_dates[0]
Output is: datetime.date(1848, 10, 24)
I am kindly requesting insight into the "time" variable in CESM2 historical output data. While the filename ('psl_Amon_CESM2_historical_r4i1p1f1_gn_185001-201412.nc') indicates that the historical run extends from January 1850 to December 2014, my time conversion using Python's datetime module yields a start date of October 24, 1848. Has anyone else run into a similar issue? The historical file's metadata states that the "time" variable is days since 0001-01-01, which is what I use to calculate the date at each timestep. Any and all help is greatly appreciated. Thanks in advance!
Here's my code:
hist_file = nc.Dataset('psl_Amon_CESM2_historical_r4i1p1f1_gn_185001-201412.nc')
time = hist_file.variables['time'][:]
from datetime import date, timedelta
monthly_dates = []
start = date(1,1,1)
for i in time:
days = i
delta = timedelta(days)
offset = start + delta
monthly_dates.append(offset)
monthly_dates[0]
Output is: datetime.date(1848, 10, 24)