Skip to content

Commit f7396cf

Browse files
committed
Add section for default units, fix options
1 parent 7b40ab2 commit f7396cf

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

doc/internals/time-coding.rst

+8
Original file line numberDiff line numberDiff line change
@@ -432,3 +432,11 @@ For encoding the process is more or less a reversal of the above, but we have to
432432
dates, units, calendar, dtype=np.dtype("int64")
433433
)
434434
print(values, units)
435+
436+
437+
Default Time Unit
438+
~~~~~~~~~~~~~~~~~
439+
440+
The default time unit of xarray is ``'s'``. It aligns well with the lower resolution of pandas. For normal operation that has no consequences on the output as all decoded datetimes are already at least in second resolution. Setting the default time unit to ``'ns'`` (the former default) the datetimes will be converted to ``'ns'``-resolution, if possible. Same holds true for ``'us'`` and ``'ms'``.
441+
442+
If the datetimes are decoded to ``'us'`` resolution, this resolution will be kept, even if the default resolution is set to ``'s'`` or ``'ms'``.

xarray/core/options.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class T_Options(TypedDict):
8888
"use_flox": True,
8989
"use_numbagg": True,
9090
"use_opt_einsum": True,
91-
"time_resolution": "ns",
91+
"time_resolution": "s",
9292
}
9393

9494
_JOIN_OPTIONS = frozenset(["inner", "outer", "left", "right", "exact"])

0 commit comments

Comments
 (0)