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

Class Aligner

xarray/structure/alignment.py:143–667  ·  view source on GitHub ↗

Implements all the complex logic for the re-indexing and alignment of Xarray objects. For internal use only, not public API. Usage: aligner = Aligner(*objects, **kwargs) aligner.align() aligned_objects = aligner.results

Source from the content-addressed store, hash-verified

141
142
143class Aligner(Generic[T_Alignable]):
144 """Implements all the complex logic for the re-indexing and alignment of Xarray
145 objects.
146
147 For internal use only, not public API.
148 Usage:
149
150 aligner = Aligner(*objects, **kwargs)
151 aligner.align()
152 aligned_objects = aligner.results
153
154 """
155
156 objects: tuple[T_Alignable, ...]
157 results: tuple[T_Alignable, ...]
158 objects_matching_index_vars: tuple[
159 dict[MatchingIndexKey, dict[Hashable, Variable]], ...
160 ]
161 join: JoinOptions | CombineKwargDefault
162 exclude_dims: frozenset[Hashable]
163 exclude_vars: frozenset[Hashable]
164 copy: bool
165 fill_value: Any
166 sparse: bool
167 indexes: dict[MatchingIndexKey, Index]
168 index_vars: dict[MatchingIndexKey, dict[Hashable, Variable]]
169 all_indexes: dict[MatchingIndexKey, list[Index]]
170 all_index_vars: dict[MatchingIndexKey, list[dict[Hashable, Variable]]]
171 aligned_indexes: dict[MatchingIndexKey, Index]
172 aligned_index_vars: dict[MatchingIndexKey, dict[Hashable, Variable]]
173 reindex: dict[MatchingIndexKey, bool]
174 keep_original_indexes: set[MatchingIndexKey]
175 reindex_kwargs: dict[str, Any]
176 unindexed_dim_sizes: dict[Hashable, set]
177 new_indexes: Indexes[Index]
178
179 def __init__(
180 self,
181 objects: Iterable[T_Alignable],
182 join: JoinOptions | CombineKwargDefault = "inner",
183 indexes: Mapping[Any, Any] | None = None,
184 exclude_dims: str | Iterable[Hashable] = frozenset(),
185 exclude_vars: Iterable[Hashable] = frozenset(),
186 method: str | None = None,
187 tolerance: float | Iterable[float] | str | None = None,
188 copy: bool = True,
189 fill_value: Any = dtypes.NA,
190 sparse: bool = False,
191 ):
192 self.objects = tuple(objects)
193 self.objects_matching_indexes: tuple[Any, ...] = ()
194 self.objects_matching_index_vars = ()
195
196 if not isinstance(join, CombineKwargDefault) and join not in get_args(
197 JoinOptions
198 ):
199 raise ValueError(f"invalid value for join: {join}")
200 self.join = join

Callers 2

alignFunction · 0.85
reindexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…