These instructions outline how to change the model date in an ACCESS-ESM1.6 restart. The restart for each component needs to be updated seprately.
Atmosphere:
Navigate to the restart/atmosphere directory
module use /g/data/xp65/public/modules
module load conda/analysis3
# Update the date in the UM dump file
python ~access/apps/pythonlib/umfile_utils/access_cm2/change_dump_date.py restart_dump.astart <<< "YYYY MM DD"
# Update the date in the calendar file
sed -i "s/end_date:.*/end_date: YYYY-MM-DD 00:00:00/" <new-restart-path>/atmosphere/um.res.yaml
Ocean:
In the restart/ocean directory, edit ocean_solo.res:
3 (Calendar: no_calendar=0, thirty_day_months=1, julian=2, gregorian=3, noleap=4)
1 1 1 0 0 0 Model start time: year, month, day, hour, minute, second
2145 1 1 0 0 0 Current model time: year, month, day, hour, minute, second
Replace the date in the 3rd line, taking care to preserve the column alignment. The entries should not be zero-padded.
Ice:
In the restart/ice directory:
Rename the iced.YYYY-MM-DD-00000.nc to use the new date. The year, month, and day should be zero padded. Edit the ice.restart pointer file to use the new file name:
echo ./RESTART/iced.YYYY-MM-DD-00000.nc > ice.restart_file
Replace the year, nyr, month, and mday global attributes using nco (in most cases, only the year will need to be changed):
module load nco
ncatted -O -a year,global,o,l,<YYYY> iced.YYYY-MM-DD-00000.nc
ncatted -O -a nyr,global,o,l,<YYYY> iced.YYYY-MM-DD-00000.nc
ncatted -O -a month,global,o,l,<MM> iced.YYYY-MM-DD-00000.nc
ncatted -O -a mday,global,o,l,<DD> iced.YYYY-MM-DD-00000.nc
Replace the time global attribute to equal the total number of seconds between 1/1/1 and the new date using the proleptic Gregorian calendar. This can be calculated using the cftime python library. E.g. using 2105-03-01 as the new date:
python
>>> import cftime
>>> start = cftime.datetime(1,1,1, calendar="proleptic_gregorian")
>>> end = cftime.datetime(2105,3,1, calendar="proleptic_gregorian")
>>> (end-start).total_seconds()
66400905600.0
Then use nco to add this to the restart file:
ncatted -O -a time,global,o,d,66400905600 iced.YYYY-MM-DD-00000.nc