home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 280574680

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/1271#issuecomment-280574680 https://api.github.com/repos/pydata/xarray/issues/1271 280574680 MDEyOklzc3VlQ29tbWVudDI4MDU3NDY4MA== 1217238 2017-02-17T07:25:20Z 2017-02-17T07:28:29Z MEMBER

Coordinate reference systems (crs) are an example of attribute which is always valid after selection, arithmetic, or even reduction since they apply to the coordinates of the DataArray.

I wonder if it might make sense to represent crs as a (scalar) coordinate, which would already be propagated in all unambiguous cases by xarray ops.

The main reason why this is annoying is that ds.crs would return a 0-dimensional DataArray, so you would need to write ds.crs.item() to access it directly (e.g., if you want to call a method on it). Though you could actually already use the accessor interface to fix this (see this gist for details).

Could the setting not be module-wide, but be set on DataArray instances themselves? That setting could then be inherited when new ones are created from arithmetic operations.

I would strong prefer to avoid making the xarray data model more complex by adding another type of metadata (e.g., in addition to dims, coords, attrs and name on DataArray). Whitelisting specific attrs as ones that should be preserved in application code via set_options (or encouraging users to subclass DataArray in a "safe" way) is preferable in that regard.

Either way, this issue is related to the fuller "hook" system for customized attribute handling that I imagined over in #988.

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