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

Function _apply_str_ufunc

xarray/core/accessor_str.py:111–141  ·  view source on GitHub ↗
(
    *,
    func: Callable,
    obj: Any,
    dtype: DTypeLike | None = None,
    output_core_dims: list | tuple = ((),),
    output_sizes: Mapping[Any, int] | None = None,
    func_args: tuple = (),
    func_kwargs: Mapping = {},
)

Source from the content-addressed store, hash-verified

109
110
111def _apply_str_ufunc(
112 *,
113 func: Callable,
114 obj: Any,
115 dtype: DTypeLike | None = None,
116 output_core_dims: list | tuple = ((),),
117 output_sizes: Mapping[Any, int] | None = None,
118 func_args: tuple = (),
119 func_kwargs: Mapping = {},
120) -> Any:
121 # TODO handling of na values ?
122 if dtype is None:
123 dtype = obj.dtype
124
125 dask_gufunc_kwargs = dict()
126 if output_sizes is not None:
127 dask_gufunc_kwargs["output_sizes"] = output_sizes
128
129 from xarray.computation.apply_ufunc import apply_ufunc
130
131 return apply_ufunc(
132 func,
133 obj,
134 *func_args,
135 vectorize=True,
136 dask="parallelized",
137 output_dtypes=[dtype],
138 output_core_dims=output_core_dims,
139 dask_gufunc_kwargs=dask_gufunc_kwargs,
140 **func_kwargs,
141 )
142
143
144class StringAccessor(Generic[T_DataArray]):

Callers 6

_contains_obj_typeFunction · 0.85
_applyMethod · 0.85
_re_compileMethod · 0.85
extractMethod · 0.85
extractallMethod · 0.85
get_dummiesMethod · 0.85

Calls 1

apply_ufuncFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…