home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 518966560

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
518966560 MDU6SXNzdWU1MTg5NjY1NjA= 3490 Dataset global attributes dropped when performing operations against numpy data type 7799184 closed 0     2 2019-11-07T00:22:04Z 2020-10-14T16:29:51Z 2020-10-14T16:29:51Z CONTRIBUTOR      

Operations against numpy data types seem cause global attributes in dataset to be dropped, example below. I also noticed in a real dataset with multiple dimensions that the order of dset.coords was swapped.

``` In [1]: import numpy as np

In [2]: import pandas as pd

In [3]: import xarray as xr

In [4]: dset = xr.DataArray( ...: np.random.rand(4, 3), ...: [("time", pd.date_range("2000-01-01", periods=4)), ("space", ["IA", "IL", "IN"])], ...: name="test", ...: ).to_dataset() ...: dset.attrs = {"attr1": "val1", "attr2": "val2"}

In [5]: 1.0 * dset
Out[5]: <xarray.Dataset> Dimensions: (space: 3, time: 4) Coordinates: * time (time) datetime64[ns] 2000-01-01 2000-01-02 2000-01-03 2000-01-04 * space (space) <U2 'IA' 'IL' 'IN' Data variables: test (time, space) float64 0.3114 0.8757 0.4467 ... 0.2784 0.8502 0.581 Attributes: attr1: val1 attr2: val2

In [6]: np.float64(1.0) * dset
Out[6]: <xarray.Dataset> Dimensions: (space: 3, time: 4) Coordinates: * time (time) datetime64[ns] 2000-01-01 2000-01-02 2000-01-03 2000-01-04 * space (space) <U2 'IA' 'IL' 'IN' Data variables: test (time, space) float64 0.3114 0.8757 0.4467 ... 0.2784 0.8502 0.581

In [7]: xr.version
Out[7]: '0.14.0' ```

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

Links from other tables

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