home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 56917795

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/175#issuecomment-56917795 https://api.github.com/repos/pydata/xarray/issues/175 56917795 MDEyOklzc3VlQ29tbWVudDU2OTE3Nzk1 1217238 2014-09-26T04:20:07Z 2014-09-26T04:20:07Z MEMBER

Here are some use case for encoding: 1. save or load a dataset to a file using conventions 2. encode or decode a dataset to facilitate loading to or from another library (e.g., Iris or CDAT) 3. load a dataset that doesn't quite satisfy conventions from disk, fix it up, and then decode it. 4. directly use the dataset constructor to input encoded data, and then decode it

This patch does 1 pretty well, but not the others. I think the cleanest way to handle everything would be to separate Conventions from DataStores. That way we could also let you write something like ds.decode(conventions=CFConventions) (or even just ds.decode('CF') or ds.decode() for short) to decode a dataset into another dataset.

So the user would only need to write something like that looks like this, instead of a subclass of AbstractEncodedDataStore:

class Conventions(object): def encode(self, arrays, attrs): return array, attrs def decode(self, arrays, attrs): return array, attrs

The bonus here is that Conventions doesn't need to relate to data stores at all, and there's no danger of undesireable coupling. We could even have xray.create_conventions(encoder, decoder) as a shortcut to writing the class.

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