num2date

typhon.utils.num2date(times, units, calendar=None)[source]

Convert an array of integers into datetime objects.

This function optimizes the num2date function of python-netCDF4 if the standard calendar is used.

Parameters:
  • times – An array of integers representing timestamps.

  • units – A string with the format “{unit} since {epoch}”, e.g. “seconds since 1970-01-01T00:00:00”.

  • calendar – (optional) Standard is gregorian. If others are used, netCDF4.num2date will be called.

Returns:

Either an array of numpy.datetime64 objects (if standard gregorian calendar is used), otherwise an array of python datetime objects.