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/3538#issuecomment-612165732,https://api.github.com/repos/pydata/xarray/issues/3538,612165732,MDEyOklzc3VlQ29tbWVudDYxMjE2NTczMg==,23484003,2020-04-10T18:47:02Z,2020-04-10T18:47:02Z,NONE,"I hacked a quick solution for exploring HDF5 files that might be of interest.
```
import h5py
def explore_file(filepath,show=""arrays""):
""""""
View the internal structure of an HDF5 file
Returns a dictionary of the entity names & representations of their values
Arguments:
filepath: string
show: one of ('groups','arrays','all')
groups: display the number of direct array-type members of each group/subgroup
arrays: display the shape & dtype of each array (if not a scalar)
all: display the shape & dtype of every array
""""""
with h5py.File(filepath,mode='r') as f:
descriptions = {}
if show==""groups"":
def visitor(k,v):
if isinstance(v, h5py.Group):
arrays = [k for k in v.keys() if isinstance(v[k],h5py.Dataset)]
if len(arrays) >0:
descriptions[k] = len(arrays)
elif show == ""arrays"":
def visitor(k,v):
if isinstance(v,h5py.Dataset) and len(v.shape)>0:
descriptions[k] = ""{},{}"".format(v.shape,v.dtype)
elif show ==""all"":
def visitor(k,v):
if isinstance(v,h5py.Dataset):
descriptions[k] = ""{},{}"".format(v.shape,v.dtype)
f.visititems(visitor)#Apply names.append to each name in the file
return descriptions
```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,523572262