MCPcopy
hub / github.com/pydata/xarray / cftime_range

Function cftime_range

xarray/coding/cftime_offsets.py:943–1142  ·  view source on GitHub ↗

Return a fixed frequency CFTimeIndex. .. deprecated:: 2025.02.0 Use :py:func:`~xarray.date_range` with ``use_cftime=True`` instead. Parameters ---------- start : str or cftime.datetime, optional Left bound for generating dates. end : str or cftime.datetime, opti

(
    start=None,
    end=None,
    periods=None,
    freq=None,
    normalize=False,
    name=None,
    inclusive: InclusiveOptions = "both",
    calendar="standard",
)

Source from the content-addressed store, hash-verified

941
942
943def cftime_range(
944 start=None,
945 end=None,
946 periods=None,
947 freq=None,
948 normalize=False,
949 name=None,
950 inclusive: InclusiveOptions = "both",
951 calendar="standard",
952) -> CFTimeIndex:
953 """Return a fixed frequency CFTimeIndex.
954
955 .. deprecated:: 2025.02.0
956 Use :py:func:`~xarray.date_range` with ``use_cftime=True`` instead.
957
958 Parameters
959 ----------
960 start : str or cftime.datetime, optional
961 Left bound for generating dates.
962 end : str or cftime.datetime, optional
963 Right bound for generating dates.
964 periods : int, optional
965 Number of periods to generate.
966 freq : str or None, default: "D"
967 Frequency strings can have multiples, e.g. "5h" and negative values, e.g. "-1D".
968 normalize : bool, default: False
969 Normalize start/end dates to midnight before generating date range.
970 name : str, default: None
971 Name of the resulting index
972 inclusive : {"both", "neither", "left", "right"}, default "both"
973 Include boundaries; whether to set each bound as closed or open.
974
975 .. versionadded:: 2023.02.0
976 calendar : str, default: "standard"
977 Calendar type for the datetimes.
978
979 Returns
980 -------
981 CFTimeIndex
982
983 Notes
984 -----
985 This function is an analog of ``pandas.date_range`` for use in generating
986 sequences of ``cftime.datetime`` objects. It supports most of the
987 features of ``pandas.date_range`` (e.g. specifying how the index is
988 ``closed`` on either side, or whether or not to ``normalize`` the start and
989 end bounds); however, there are some notable exceptions:
990
991 - You cannot specify a ``tz`` (time zone) argument.
992 - Start or end dates specified as partial-datetime strings must use the
993 `ISO-8601 format <https://en.wikipedia.org/wiki/ISO_8601>`_.
994 - It supports many, but not all, frequencies supported by
995 ``pandas.date_range``. For example it does not currently support any of
996 the business-related or semi-monthly frequencies.
997 - Compound sub-monthly frequencies are not supported, e.g. '1H1min', as
998 these can easily be written in terms of the finest common resolution,
999 e.g. '61min'.
1000

Callers 1

test_cftime_rangeFunction · 0.90

Calls 2

emit_user_level_warningFunction · 0.90
date_rangeFunction · 0.85

Tested by 1

test_cftime_rangeFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…