polaris.ocean.model.get_simulation_years

polaris.ocean.model.get_simulation_years(ds, time_var='Time')[source]

Get the time axis of a dataset in decimal simulation years

The year comes from the calendar date itself rather than from an elapsed time, so that a series covering years 21 through 40 is plotted at 21 through 41 – the years the user asked for – whatever reference date the model happened to write its time coordinate against. It also depends on no attribute of the time variable beyond its calendar, so a file that has been read and written again is handled the same as one straight from the model.

Parameters:
  • ds (xarray.Dataset) – A dataset with a decoded time coordinate

  • time_var (str, optional) – The name of the time coordinate

Returns:

years (numpy.ndarray) – The decimal simulation year of each time in the dataset