act.utils.add_in_nan

act.utils.add_in_nan(time, data)[source]

This procedure adds in NaNs when there is a larger than expected time step. This is useful for timeseries where there is a gap in data and need a NaN value to stop plotting from connecting data over the large data gap.

Parameters:
  • time (1D array of numpy datetime64 or Xarray DataArray of datetime64) – Times in the timeseries.

  • data (1D or 2D numpy array or Xarray DataArray) – Array containing the data. The 0 axis corresponds to time.

Returns:

  • time (numpy array or Xarray DataArray) – The array containing the new times including a NaN filled sampe or slice if multi-dimensional. The intervals are determined by the mode of the timestep in time.

  • data (numpy array or Xarray DataArray) – The array containing the NaN-indserted data.