home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 539240950

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/3268#issuecomment-539240950 https://api.github.com/repos/pydata/xarray/issues/3268 539240950 MDEyOklzc3VlQ29tbWVudDUzOTI0MDk1MA== 6213168 2019-10-07T23:03:28Z 2019-10-07T23:04:25Z MEMBER

Would that make any sense that the xr.DataSet.copy() method also return a copy of the accessors ?

It's been discussed above in this same thread. It's impossible without breaking the accessor API, as it would require you (the accessor developer) to define a copy method. The more high level discussion is that the statefulness of the accessor is something that is OK to use for caching and performance improvements, and not OK for storing functional information like yours.

Have you considered storing a flag in Variable.attrs instead?

```python

def add(self, da):
    da.attrs["cleanable"] = True
    self.obj[da.name] = da
    return self.obj

def clean(self):
    return self.obj.drop([
        k for k, v in self.obj.variables.items()
        if v.attrs.get("cleanable")
    ])

```

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