home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 418476055

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/2159#issuecomment-418476055 https://api.github.com/repos/pydata/xarray/issues/2159 418476055 MDEyOklzc3VlQ29tbWVudDQxODQ3NjA1NQ== 1217238 2018-09-04T18:44:35Z 2018-09-04T22:16:34Z MEMBER

NumPy's handling of object arrays is unfortunately inconsistent. So maybe it isn't the best idea to use NumPy arrays for this.

Python's built-in list/dict might be better choices here. Something like: python def concat_nd(datasets): # find the set of dimensions across which to possibly merge # could possibly use OrderedSet here: # https://github.com/pydata/xarray/blob/v0.10.8/xarray/core/utils.py#L401 all_dims = set(ds.dims for ds in datasets) # Create a map from each dimension to a tuple giving the size of each # dimension on an input dataset. Not all collections of datasets have consistent # sizes along each dimension, but the ones we can automatically concatenate do. # I recommend researching how "chunks" work in dask.array: # http://dask.pydata.org/en/latest/array-design.html # http://dask.pydata.org/en/latest/array-chunks.html chunks = {dim: ... for dim in all_dims} # find the sorted, de-duplicated union of all indexes along those dimensions # np.unique followed by wrapping with pd.Index() # might work OK for the "union" function here combined_indexes = {dim: union([ds.indexes[dim] for ds in datasets]) for dim in all_dims} # create a map mapping from "tile id" to dataset # get_indexes() should use pandas.Index.get_indexer to lookup ds.indexes[dim] # in the combined index, e.g., of type Dict[Tuple[int, ...], xarray.Dataset] indexes_to_dataset = {get_indexes(ds, chunks, combined_coords): ds for ds in datasets} # call concat() in a loop to construct the combined dataset

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