home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 410575268

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/pull/2344#issuecomment-410575268 https://api.github.com/repos/pydata/xarray/issues/2344 410575268 MDEyOklzc3VlQ29tbWVudDQxMDU3NTI2OA== 90008 2018-08-06T02:55:12Z 2018-08-06T02:55:12Z CONTRIBUTOR

Maybe the issue that I am facing is that I want to deal with the storage of my metadata and data seperately.

I used to have my own library that was replicating much of xarray's functionality, but your code is much nicer than anything I would be able to write in a finite time. :smile:

Following the information here: http://xarray.pydata.org/en/stable/data-structures.html#coordinates-methods

Currently, my serialization pipeline is: ```python import xarray as xr import numpy as np

Setup an array with coordinates

n = np.zeros(3) coords={'x': np.arange(3)} m = xr.DataArray(n, dims=['x'], coords=coords)

coords_dataset_dict = m.coords.to_dataset().to_dict() coords_dict = coords_dataset_dict['coords']

Read/Write dictionary to JSON file

This works, but I'm essentially creating an emtpy dataset for it

coords_set = xr.Dataset.from_dict(coords_dataset_dict) coords2 = coords_set.coords # so many coords :D m2 = xr.DataArray(np.zeros(shape=m.shape), dims=m.dims, coords=coords2)

I used to just pass the dataset to "coords"

m3 = xr.DataArray(np.zeros(shape=m.shape), dims=m.dims, coords=coords_set) ```

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