polaris.ocean.model.get_time_since_start

polaris.ocean.model.get_time_since_start(ds, units)[source]

Ocean model output may or may not include ‘daysSinceStartOfSim’. This routine uses ‘daysSinceStartOfSim’ if available, otherwise it uses a numeric ‘time’ variable (Omega’s elapsed seconds), ‘xtime’ or ‘Time’ to compute the time elapsed since the start of the simulation.

Parameters:
  • ds (xarray.Dataset) – The output dataset

  • units ({'seconds', 'minutes', 'hours', 'days'}) – The units of time elapsed since the start of the simulation to return

Returns:

t_arr (numpy.ndarray) – The time elapsed since the start of the simulation in the requested units

Raises:

ValueError – If units is not one of the supported units