You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently Dataset.set_xindex(coord_names, index_cls=None, **options) allows passing index build options (if any) via the **options arguments. Those options are not easily discoverable, though (no auto-completion, etc.).
So if I understand this correctly the advantage of with_options is that is would allow the author of the custom index to define the signature of additional arguments it expects? I think that's useful.
I also think it's generally a bit confusing that in all these index examples __init__ is defined but not actually how the index is first created. I understand why, but the intended patterns could be more clearly documented.
So if I understand this correctly the advantage of with_options is that is would allow the author of the custom index to define the signature of additional arguments it expects?
Yes and it would expose the signature directly to the users of the index (type checking, auto-completion, etc.).
I also think it's generally a bit confusing that in all these index examples init is defined but not actually how the index is first created. I understand why, but the intended patterns could be more clearly documented.
Yeah this may be confusing I agree. And I also agree about clarifying it in the documentation.
Is your feature request related to a problem?
Currently
Dataset.set_xindex(coord_names, index_cls=None, **options)
allows passing index build options (if any) via the**options
arguments. Those options are not easily discoverable, though (no auto-completion, etc.).Describe the solution you'd like
What about something like this?
This would require adding a
.with_options()
class method that can be overridden in Index subclasses (optional):Thoughts?
Describe alternatives you've considered
Build options are also likely defined in the Index constructor, e.g.,
However, the Index constructor is not public API (only used internally and indirectly in Xarray when setting a new index from existing coordinates).
Any other idea?
Additional context
No response
The text was updated successfully, but these errors were encountered: