|
33 | 33 | _normalize_path,
|
34 | 34 | )
|
35 | 35 | from xarray.backends.locks import _get_scheduler
|
36 |
| -from xarray.coders import CFDatetimeCoder |
| 36 | +from xarray.coders import CFDatetimeCoder, CFTimedeltaCoder |
37 | 37 | from xarray.core import indexing
|
38 | 38 | from xarray.core.combine import (
|
39 | 39 | _infer_concat_order_from_positions,
|
@@ -487,7 +487,10 @@ def open_dataset(
|
487 | 487 | | CFDatetimeCoder
|
488 | 488 | | Mapping[str, bool | CFDatetimeCoder]
|
489 | 489 | | None = None,
|
490 |
| - decode_timedelta: bool | Mapping[str, bool] | None = None, |
| 490 | + decode_timedelta: bool |
| 491 | + | CFTimedeltaCoder |
| 492 | + | Mapping[str, bool | CFTimedeltaCoder] |
| 493 | + | None = None, |
491 | 494 | use_cftime: bool | Mapping[str, bool] | None = None,
|
492 | 495 | concat_characters: bool | Mapping[str, bool] | None = None,
|
493 | 496 | decode_coords: Literal["coordinates", "all"] | bool | None = None,
|
@@ -555,11 +558,14 @@ def open_dataset(
|
555 | 558 | Pass a mapping, e.g. ``{"my_variable": False}``,
|
556 | 559 | to toggle this feature per-variable individually.
|
557 | 560 | This keyword may not be supported by all the backends.
|
558 |
| - decode_timedelta : bool or dict-like, optional |
| 561 | + decode_timedelta : bool, CFTimedeltaCoder, or dict-like, optional |
559 | 562 | If True, decode variables and coordinates with time units in
|
560 | 563 | {"days", "hours", "minutes", "seconds", "milliseconds", "microseconds"}
|
561 | 564 | into timedelta objects. If False, leave them encoded as numbers.
|
562 |
| - If None (default), assume the same value of decode_time. |
| 565 | + If None (default), assume the same value of ``decode_times``; if |
| 566 | + ``decode_times`` is a :py:class:`coders.CFDatetimeCoder` instance, this |
| 567 | + takes the form of a :py:class:`coders.CFTimedeltaCoder` instance with a |
| 568 | + matching ``time_unit``. |
563 | 569 | Pass a mapping, e.g. ``{"my_variable": False}``,
|
564 | 570 | to toggle this feature per-variable individually.
|
565 | 571 | This keyword may not be supported by all the backends.
|
@@ -712,7 +718,7 @@ def open_dataarray(
|
712 | 718 | | CFDatetimeCoder
|
713 | 719 | | Mapping[str, bool | CFDatetimeCoder]
|
714 | 720 | | None = None,
|
715 |
| - decode_timedelta: bool | None = None, |
| 721 | + decode_timedelta: bool | CFTimedeltaCoder | None = None, |
716 | 722 | use_cftime: bool | None = None,
|
717 | 723 | concat_characters: bool | None = None,
|
718 | 724 | decode_coords: Literal["coordinates", "all"] | bool | None = None,
|
@@ -785,7 +791,10 @@ def open_dataarray(
|
785 | 791 | If True, decode variables and coordinates with time units in
|
786 | 792 | {"days", "hours", "minutes", "seconds", "milliseconds", "microseconds"}
|
787 | 793 | into timedelta objects. If False, leave them encoded as numbers.
|
788 |
| - If None (default), assume the same value of decode_time. |
| 794 | + If None (default), assume the same value of ``decode_times``; if |
| 795 | + ``decode_times`` is a :py:class:`coders.CFDatetimeCoder` instance, this |
| 796 | + takes the form of a :py:class:`coders.CFTimedeltaCoder` instance with a |
| 797 | + matching ``time_unit``. |
789 | 798 | This keyword may not be supported by all the backends.
|
790 | 799 | use_cftime: bool, optional
|
791 | 800 | Only relevant if encoded dates come from a standard calendar
|
@@ -927,7 +936,10 @@ def open_datatree(
|
927 | 936 | | CFDatetimeCoder
|
928 | 937 | | Mapping[str, bool | CFDatetimeCoder]
|
929 | 938 | | None = None,
|
930 |
| - decode_timedelta: bool | Mapping[str, bool] | None = None, |
| 939 | + decode_timedelta: bool |
| 940 | + | CFTimedeltaCoder |
| 941 | + | Mapping[str, bool | CFTimedeltaCoder] |
| 942 | + | None = None, |
931 | 943 | use_cftime: bool | Mapping[str, bool] | None = None,
|
932 | 944 | concat_characters: bool | Mapping[str, bool] | None = None,
|
933 | 945 | decode_coords: Literal["coordinates", "all"] | bool | None = None,
|
@@ -995,7 +1007,10 @@ def open_datatree(
|
995 | 1007 | If True, decode variables and coordinates with time units in
|
996 | 1008 | {"days", "hours", "minutes", "seconds", "milliseconds", "microseconds"}
|
997 | 1009 | into timedelta objects. If False, leave them encoded as numbers.
|
998 |
| - If None (default), assume the same value of decode_time. |
| 1010 | + If None (default), assume the same value of ``decode_times``; if |
| 1011 | + ``decode_times`` is a :py:class:`coders.CFDatetimeCoder` instance, this |
| 1012 | + takes the form of a :py:class:`coders.CFTimedeltaCoder` instance with a |
| 1013 | + matching ``time_unit``. |
999 | 1014 | Pass a mapping, e.g. ``{"my_variable": False}``,
|
1000 | 1015 | to toggle this feature per-variable individually.
|
1001 | 1016 | This keyword may not be supported by all the backends.
|
@@ -1150,7 +1165,10 @@ def open_groups(
|
1150 | 1165 | | CFDatetimeCoder
|
1151 | 1166 | | Mapping[str, bool | CFDatetimeCoder]
|
1152 | 1167 | | None = None,
|
1153 |
| - decode_timedelta: bool | Mapping[str, bool] | None = None, |
| 1168 | + decode_timedelta: bool |
| 1169 | + | CFTimedeltaCoder |
| 1170 | + | Mapping[str, bool | CFTimedeltaCoder] |
| 1171 | + | None = None, |
1154 | 1172 | use_cftime: bool | Mapping[str, bool] | None = None,
|
1155 | 1173 | concat_characters: bool | Mapping[str, bool] | None = None,
|
1156 | 1174 | decode_coords: Literal["coordinates", "all"] | bool | None = None,
|
@@ -1222,9 +1240,10 @@ def open_groups(
|
1222 | 1240 | If True, decode variables and coordinates with time units in
|
1223 | 1241 | {"days", "hours", "minutes", "seconds", "milliseconds", "microseconds"}
|
1224 | 1242 | into timedelta objects. If False, leave them encoded as numbers.
|
1225 |
| - If None (default), assume the same value of decode_time. |
1226 |
| - Pass a mapping, e.g. ``{"my_variable": False}``, |
1227 |
| - to toggle this feature per-variable individually. |
| 1243 | + If None (default), assume the same value of ``decode_times``; if |
| 1244 | + ``decode_times`` is a :py:class:`coders.CFDatetimeCoder` instance, this |
| 1245 | + takes the form of a :py:class:`coders.CFTimedeltaCoder` instance with a |
| 1246 | + matching ``time_unit``. |
1228 | 1247 | This keyword may not be supported by all the backends.
|
1229 | 1248 | use_cftime: bool or dict-like, optional
|
1230 | 1249 | Only relevant if encoded dates come from a standard calendar
|
|
0 commit comments