home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 369673042

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
369673042 MDExOlB1bGxSZXF1ZXN0MjIyNTU3NzU5 2482 Global option to always keep/discard attrs on operations 35968931 closed 0     8 2018-10-12T19:01:12Z 2020-04-05T03:53:53Z 2018-10-30T01:01:08Z MEMBER   0 pydata/xarray/pulls/2482
  • [x] Resolves wishes of some users and relevant for discussion in #138, #442, #688, #828, #988, #1009, #1271, #2288, #2473
  • [x] Tests added, both of setting the option and of attributes propagating in the expected way
  • [x] Tests passed
  • [x] Documented

Adds a global option to either always keep or always discard attrs in method and function calls.

The behaviour is backwards-compatible, as the logic is: - if keep_attrs supplied as keyword argument then use that - else if global option (xarray.set_options(keep_attrs=True)) is set then use that - else use default value of keep_attrs argument for that particular function/method (kept the same as they were for backwards-compatibility).

Main use cases include users who want to store the units of their data in the attrs, users who want to always keep information about the source or history of their data, and users who want to store objects in their attributes which are needed to supplement the xarray objects (e.g. an xgcm.grid). It should eventually be superceded by hooks for custom attribute handling (#988), but will be useful until then.

I have left the top-level functions like concat and merge alone. Currently concat keeps the attributes of the first object passed to it, and merge returns a dataset with no attributes. It's not clear how this should be treated though, so I left it to users to extend those functions if they need to.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2482/reactions",
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 1,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 pull

Links from other tables

  • 1 row from issues_id in issues_labels
  • 8 rows from issue in issue_comments
Powered by Datasette · Queries took 6.985ms · About: xarray-datasette