home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 1246192701

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/6975#issuecomment-1246192701 https://api.github.com/repos/pydata/xarray/issues/6975 1246192701 IC_kwDOAMm_X85KR2Q9 35968931 2022-09-14T03:41:06Z 2022-09-14T03:43:31Z MEMBER

pydata/xarray your feedback would be very much appreciated! I've been into this for quite some time, so there may be things that seem obvious to me but that you can still find very confusing or non-intuitive. It would then deserve some extra or better explanation.

I find the way in which the Index objects are involved in a method call (e.g. sel) pretty opaque still. (Bear in mind I don't think I've ever contributed a PR to xarray that touched indexes.py or indexing.py :sweat_smile:)

  • When is my CustomIndex object consulted? Is it potentially for all basic operations (concat, join, align, indexing, etc?) If I passed some kind of NotImplementedIndex which only defined .from_variables, what functionality would be left in xarray?
  • Why does there not need to be an index (in .indexes) if I do indexing with e.g. .isel but have no coordinates?
  • If I index along two dimensions simultaneously (.isel(x=1, y=2)) does that correspond to two separate Index consultations?
  • How is an xarray.PandasIndex different from a pd.Index?
  • When I load the "air" tutorial data and it shows a Float64Index and DateTime64Index, where did they come from?
  • Finally it's not great that to explain Index objects we have to assume the user knows what xarray.Variable is, but Variable is still not really public API, and certainly isn't documented as comprehensively as DataArray and Dataset are.

Perhaps these questions are too specific to xarray's internals but I do think there should be some kind of mental model given as to the role the Index objects play. (This could be a white lie, similar to how our page on data structures says that Dataset objects contain DataArray objects when actually they technically don't.)

I also think we need multiple simple examples. How about - HelloWorldIndex, that just prints "I'm calling HelloWorldIndex.isel !" etc. - PeriodicBoundaryIndex (a partial/simpler implementation of #7031), - A simple functionally-derived index, that consults a dynamically-called exponential function or something. - Some example of a custom multi-index, perhaps some kind of 2D lat-lon thing? Or how about something that represents 2D image distortion, like using it creates a fisheye effect?

I find it helps to think of documentation using this 4-part system. This PR should cover "Explanation" pretty well, but we should still aim for other content to better cover "Tutorial", "How-to Guides", and "Reference". "Tutorial" could be like a notebook walking through creating a simple index (e.g. PeriodicIndex) from scratch, explaining and fixing errors as they arise (like @dcherian did for apply_ufunc). "How-to Guides" might be specific to other more advanced custom index examples. I guess "Reference" here is just having really clear docstrings on the possible methods of Index somewhere (we can't really do that with an ABC though can we?).

That all said, this is already a great start!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1358841264
Powered by Datasette · Queries took 0.717ms · About: xarray-datasette