home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 611950517

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/issues/3959#issuecomment-611950517 https://api.github.com/repos/pydata/xarray/issues/3959 611950517 MDEyOklzc3VlQ29tbWVudDYxMTk1MDUxNw== 6130352 2020-04-10T09:08:06Z 2020-04-10T09:08:06Z NONE

Thanks @TomNicholas, some thoughts on your points:

xarray internally uses methods like self._construct_dataarray(dims, values, coords, attrs) to construct return values

I'm ok with the subtype being lost after running some methods. I saw that so I'm assuming all functions that do anything with the data structures take and return Xarray objects alone.

You could make custom accessors which perform checks on the input arrays when they get used?

Accessors could work but the issues I see with them are:

  1. What's a natural way for a user to access documentation on how to build a compliant dataset? A docstring on a constructor is great -- is there a way to do something like that with accessors? The docs could hang off of the check_* type methods, but that seems very awkward.
  2. Is there a way to avoid running check_* methods multiple times? I think those checks could be expensive and If Xarray often builds new instances as return values, this will be an issue:

```python ds.haplo.do_custom_analysis_1()

Do something with coords/indexes that causes a new Dataset to be created

e.g. ds.reset_index ultimately hits https://github.com/pydata/xarray/blob/1eedc5c146d9e6ebd46ab2cc8b271e51b3a25959/xarray/core/dataset.py#L882

which creates a new Dataset

ds = ds.reset_index()

The check_conforms_to_haplo_requirements function will run again even though

I would know it's not necessary at this point:

ds.haplo.do_custom_analysis_2() ```

would something akin to pandas' ExtensionDtype solve your problem?

Ah I can see how the title on the issue is misleading, but I don't actually have a need for dtypes beyond what's already available. Well, we do actually have that problem in trying to find some way to represent 2-bit integers with sub-byte data types but I wasn't trying to get into that on this thread. I'll make the title better.

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