xarray.Dataset.traj.gridtime#

abstract Dataset.traj.gridtime(times, time_varname=None)#

Interpolate dataset to a regular time interval or a different grid.

Parameters:
  • times (array or str) –

    Target time interval, can be either:
    • an array of times, or

    • a string specifying a Pandas daterange (e.g. ‘h’, ‘6h, ‘D’…) suitable for pd.date_range.

  • time_varname (str) – Name of new time dimension. The default is to use the same name as previously.

Returns:

Dataset – A new dataset interpolated to the target times. The dataset will be 1D (i.e. gridded) and the time dimension will be named time.