3333 _normalize_path ,
3434)
3535from xarray .backends .locks import _get_scheduler
36+ from xarray .coders import CFDatetimeCoder
3637from xarray .core import indexing
3738from xarray .core .combine import (
3839 _infer_concat_order_from_positions ,
@@ -481,7 +482,10 @@ def open_dataset(
481482 cache : bool | None = None ,
482483 decode_cf : bool | None = None ,
483484 mask_and_scale : bool | Mapping [str , bool ] | None = None ,
484- decode_times : bool | Mapping [str , bool ] | None = None ,
485+ decode_times : bool
486+ | CFDatetimeCoder
487+ | Mapping [str , bool | CFDatetimeCoder ]
488+ | None = None ,
485489 decode_timedelta : bool | Mapping [str , bool ] | None = None ,
486490 use_cftime : bool | Mapping [str , bool ] | None = None ,
487491 concat_characters : bool | Mapping [str , bool ] | None = None ,
@@ -543,9 +547,10 @@ def open_dataset(
543547 be replaced by NA. Pass a mapping, e.g. ``{"my_variable": False}``,
544548 to toggle this feature per-variable individually.
545549 This keyword may not be supported by all the backends.
546- decode_times : bool or dict-like, optional
550+ decode_times : bool, CFDatetimeCoder or dict-like, optional
547551 If True, decode times encoded in the standard NetCDF datetime format
548- into datetime objects. Otherwise, leave them encoded as numbers.
552+ into datetime objects. Otherwise, use :py:class:`coders.CFDatetimeCoder` or leave them
553+ encoded as numbers.
549554 Pass a mapping, e.g. ``{"my_variable": False}``,
550555 to toggle this feature per-variable individually.
551556 This keyword may not be supported by all the backends.
@@ -569,6 +574,10 @@ def open_dataset(
569574 raise an error. Pass a mapping, e.g. ``{"my_variable": False}``,
570575 to toggle this feature per-variable individually.
571576 This keyword may not be supported by all the backends.
577+
578+ .. deprecated:: 2025.01.1
579+ Please pass a :py:class:`coders.CFDatetimeCoder` instance initialized with ``use_cftime`` to the ``decode_times`` kwarg instead.
580+
572581 concat_characters : bool or dict-like, optional
573582 If True, concatenate along the last dimension of character arrays to
574583 form string arrays. Dimensions will only be concatenated over (and
@@ -698,7 +707,10 @@ def open_dataarray(
698707 cache : bool | None = None ,
699708 decode_cf : bool | None = None ,
700709 mask_and_scale : bool | None = None ,
701- decode_times : bool | None = None ,
710+ decode_times : bool
711+ | CFDatetimeCoder
712+ | Mapping [str , bool | CFDatetimeCoder ]
713+ | None = None ,
702714 decode_timedelta : bool | None = None ,
703715 use_cftime : bool | None = None ,
704716 concat_characters : bool | None = None ,
@@ -761,9 +773,11 @@ def open_dataarray(
761773 `missing_value` attribute contains multiple values a warning will be
762774 issued and all array values matching one of the multiple values will
763775 be replaced by NA. This keyword may not be supported by all the backends.
764- decode_times : bool, optional
776+ decode_times : bool, CFDatetimeCoder or dict-like, optional
765777 If True, decode times encoded in the standard NetCDF datetime format
766- into datetime objects. Otherwise, leave them encoded as numbers.
778+ into datetime objects. Otherwise, use :py:class:`coders.CFDatetimeCoder` or leave them encoded as numbers.
779+ Pass a mapping, e.g. ``{"my_variable": False}``,
780+ to toggle this feature per-variable individually.
767781 This keyword may not be supported by all the backends.
768782 decode_timedelta : bool, optional
769783 If True, decode variables and coordinates with time units in
@@ -781,6 +795,10 @@ def open_dataarray(
781795 represented using ``np.datetime64[ns]`` objects. If False, always
782796 decode times to ``np.datetime64[ns]`` objects; if this is not possible
783797 raise an error. This keyword may not be supported by all the backends.
798+
799+ .. deprecated:: 2025.01.1
800+ Please pass a :py:class:`coders.CFDatetimeCoder` instance initialized with ``use_cftime`` to the ``decode_times`` kwarg instead.
801+
784802 concat_characters : bool, optional
785803 If True, concatenate along the last dimension of character arrays to
786804 form string arrays. Dimensions will only be concatenated over (and
@@ -903,7 +921,10 @@ def open_datatree(
903921 cache : bool | None = None ,
904922 decode_cf : bool | None = None ,
905923 mask_and_scale : bool | Mapping [str , bool ] | None = None ,
906- decode_times : bool | Mapping [str , bool ] | None = None ,
924+ decode_times : bool
925+ | CFDatetimeCoder
926+ | Mapping [str , bool | CFDatetimeCoder ]
927+ | None = None ,
907928 decode_timedelta : bool | Mapping [str , bool ] | None = None ,
908929 use_cftime : bool | Mapping [str , bool ] | None = None ,
909930 concat_characters : bool | Mapping [str , bool ] | None = None ,
@@ -961,9 +982,9 @@ def open_datatree(
961982 be replaced by NA. Pass a mapping, e.g. ``{"my_variable": False}``,
962983 to toggle this feature per-variable individually.
963984 This keyword may not be supported by all the backends.
964- decode_times : bool or dict-like, optional
985+ decode_times : bool, CFDatetimeCoder or dict-like, optional
965986 If True, decode times encoded in the standard NetCDF datetime format
966- into datetime objects. Otherwise, leave them encoded as numbers.
987+ into datetime objects. Otherwise, use :py:class:`coders.CFDatetimeCoder` or leave them encoded as numbers.
967988 Pass a mapping, e.g. ``{"my_variable": False}``,
968989 to toggle this feature per-variable individually.
969990 This keyword may not be supported by all the backends.
@@ -987,6 +1008,10 @@ def open_datatree(
9871008 raise an error. Pass a mapping, e.g. ``{"my_variable": False}``,
9881009 to toggle this feature per-variable individually.
9891010 This keyword may not be supported by all the backends.
1011+
1012+ .. deprecated:: 2025.01.1
1013+ Please pass a :py:class:`coders.CFDatetimeCoder` instance initialized with ``use_cftime`` to the ``decode_times`` kwarg instead.
1014+
9901015 concat_characters : bool or dict-like, optional
9911016 If True, concatenate along the last dimension of character arrays to
9921017 form string arrays. Dimensions will only be concatenated over (and
@@ -1118,7 +1143,10 @@ def open_groups(
11181143 cache : bool | None = None ,
11191144 decode_cf : bool | None = None ,
11201145 mask_and_scale : bool | Mapping [str , bool ] | None = None ,
1121- decode_times : bool | Mapping [str , bool ] | None = None ,
1146+ decode_times : bool
1147+ | CFDatetimeCoder
1148+ | Mapping [str , bool | CFDatetimeCoder ]
1149+ | None = None ,
11221150 decode_timedelta : bool | Mapping [str , bool ] | None = None ,
11231151 use_cftime : bool | Mapping [str , bool ] | None = None ,
11241152 concat_characters : bool | Mapping [str , bool ] | None = None ,
@@ -1180,9 +1208,9 @@ def open_groups(
11801208 be replaced by NA. Pass a mapping, e.g. ``{"my_variable": False}``,
11811209 to toggle this feature per-variable individually.
11821210 This keyword may not be supported by all the backends.
1183- decode_times : bool or dict-like, optional
1211+ decode_times : bool, CFDatetimeCoder or dict-like, optional
11841212 If True, decode times encoded in the standard NetCDF datetime format
1185- into datetime objects. Otherwise, leave them encoded as numbers.
1213+ into datetime objects. Otherwise, use :py:class:`coders.CFDatetimeCoder` or leave them encoded as numbers.
11861214 Pass a mapping, e.g. ``{"my_variable": False}``,
11871215 to toggle this feature per-variable individually.
11881216 This keyword may not be supported by all the backends.
@@ -1206,6 +1234,10 @@ def open_groups(
12061234 raise an error. Pass a mapping, e.g. ``{"my_variable": False}``,
12071235 to toggle this feature per-variable individually.
12081236 This keyword may not be supported by all the backends.
1237+
1238+ .. deprecated:: 2025.01.1
1239+ Please pass a :py:class:`coders.CFDatetimeCoder` instance initialized with ``use_cftime`` to the ``decode_times`` kwarg instead.
1240+
12091241 concat_characters : bool or dict-like, optional
12101242 If True, concatenate along the last dimension of character arrays to
12111243 form string arrays. Dimensions will only be concatenated over (and
0 commit comments