I have outputs from several CMIP6 models for the piControl experiment, but I noticed that the time coordinates vary between models. For example, one model starts in 1850, another in 0950, and others start in 0001 (I have attached a screenshot below showing the different time coordinates). How should I interpret these varying time coordinates? Also, how can I concatenate the time axis for the piControl, historical, and SSP experiments for further analysis?
Could someone help me with this?
Thanks in advance!
piControl years should be arbitrary - they represent some ‘pre-industrial’ steady state.
The historical runs are initiated from piControl - each run will come from a different starting point in the piControl data, e.g. ACCESS-ESM r1i1p1 has
Yes, the piControl times are arbitrary (spanning 500 years).
Since the piControl time coords differ across the cmip6 models, i am unable to concatenate them with historical (1850-2014) and SSP(2015-2100) experiments.
Try something like this - meaningfullness of the time axis - if leap years etc line up properly is left as an exercise
import xarray
import cftime
pic = xarray.open_mfdataset("/g/data/fs38/publications/CMIP6/CMIP/CSIRO/ACCESS-ESM1-5/piControl/r1i1p1f1/Amon/tas/gn/latest/tas_Amon_ACCESS-ESM1-5_piControl_r1i1p1f1_gn_*", use_cftime=True)
his = xarray.open_mfdataset("/g/data/fs38/publications/CMIP6/CMIP/CSIRO/ACCESS-ESM1-5/historical/r1i1p1f1/Amon/tas/gn/latest/tas_Amon_ACCESS-ESM1-5_historical_r1i1p1f1_gn_185001-201412.nc", use_cftime=True)
# Date in 'pic' that 'his' branched from
branch_date = cftime.num2date(his.branch_time_in_parent, his.parent_time_units)
# Correction for 'pic' years to match up with 'his'
year_offset = his.time.dt.year.data[0] - branch_date.year
# Slice out 'pic' before the branch point and override its time axis
pic_before_branch = pic.sel(time=slice(None, branch_date))
pic_before_branch['time'] = pic_before_branch.indexes['time'].map(lambda x: x.replace(year=x.year + year_offset))
# Concatenate the datasets together
extended = xarray.concat([pic_before_branch, his], dim="time")