MCPcopy Index your code
hub / github.com/pydata/xarray / __post_init__

Method __post_init__

xarray/groupers.py:901–914  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

899 season_tuples: Mapping[str, Sequence[int]] = field(init=False, repr=False)
900
901 def __post_init__(self):
902 self.season_inds = season_to_month_tuple(self.seasons)
903 all_inds = functools.reduce(operator.add, self.season_inds)
904 if len(all_inds) > len(set(all_inds)):
905 raise ValueError(
906 f"Overlapping seasons are not allowed. Received {self.seasons!r}"
907 )
908 self.season_tuples = dict(zip(self.seasons, self.season_inds, strict=True))
909
910 if not is_sorted_periodic(list(itertools.chain(*self.season_inds))):
911 raise ValueError(
912 "Resampling is only supported with sorted seasons. "
913 f"Provided seasons {self.seasons!r} are not sorted."
914 )
915
916 def factorize(self, group: T_Group) -> EncodedGroups:
917 if group.ndim != 1:

Callers

nothing calls this directly

Calls 3

season_to_month_tupleFunction · 0.85
is_sorted_periodicFunction · 0.85
reduceMethod · 0.45

Tested by

no test coverage detected