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

Method _factorize_given_labels

xarray/groupers.py:263–280  ·  view source on GitHub ↗
(self, group: T_Group)

Source from the content-addressed store, hash-verified

261 return self._factorize_unique()
262
263 def _factorize_given_labels(self, group: T_Group) -> EncodedGroups:
264 codes = apply_ufunc(
265 _factorize_given_labels,
266 group,
267 kwargs={"labels": self.labels},
268 dask="parallelized",
269 output_dtypes=[np.int64],
270 keep_attrs=True,
271 )
272 return EncodedGroups(
273 codes=codes,
274 full_index=pd.Index(self.labels), # type: ignore[arg-type]
275 unique_coord=Variable(
276 dims=codes.name,
277 data=self.labels,
278 attrs=self.group.attrs,
279 ),
280 )
281
282 def _factorize_unique(self) -> EncodedGroups:
283 # look through group to find the unique values

Callers 1

factorizeMethod · 0.95

Calls 3

apply_ufuncFunction · 0.90
VariableClass · 0.90
EncodedGroupsClass · 0.85

Tested by

no test coverage detected