home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

6 rows where issue = 105688738 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 3

  • ocefpaf 2
  • shoyer 2
  • rsignell-usgs 2

author_association 3

  • CONTRIBUTOR 2
  • MEMBER 2
  • NONE 2

issue 1

  • Best way to find data variables by standard_name · 6 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
216947679 https://github.com/pydata/xarray/issues/567#issuecomment-216947679 https://api.github.com/repos/pydata/xarray/issues/567 MDEyOklzc3VlQ29tbWVudDIxNjk0NzY3OQ== shoyer 1217238 2016-05-04T17:54:58Z 2016-05-04T17:54:58Z MEMBER

get_variables_by_attributes does seem generic enough that we can safely add it to xarray. For our version, I would make this a Dataset method and always return another Dataset (no strict flag). Pulling out the single variable of a Dataset as a DataArray should be a separate method, e.g., .item() like the NumPy method.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Best way to find data variables by standard_name 105688738
216944939 https://github.com/pydata/xarray/issues/567#issuecomment-216944939 https://api.github.com/repos/pydata/xarray/issues/567 MDEyOklzc3VlQ29tbWVudDIxNjk0NDkzOQ== rsignell-usgs 1872600 2016-05-04T17:45:06Z 2016-05-04T17:45:06Z NONE

:+1: -- I think this would be super-useful general functionality for the xarray community that doesn't come with any downside.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Best way to find data variables by standard_name 105688738
216932304 https://github.com/pydata/xarray/issues/567#issuecomment-216932304 https://api.github.com/repos/pydata/xarray/issues/567 MDEyOklzc3VlQ29tbWVudDIxNjkzMjMwNA== ocefpaf 950575 2016-05-04T17:01:19Z 2016-05-04T17:01:19Z CONTRIBUTOR

@shoyer this made into netcdf4 and some people in my group would like to have this in xarray too. If you think it is worth it I can put a PR together for this.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Best way to find data variables by standard_name 105688738
139239983 https://github.com/pydata/xarray/issues/567#issuecomment-139239983 https://api.github.com/repos/pydata/xarray/issues/567 MDEyOklzc3VlQ29tbWVudDEzOTIzOTk4Mw== ocefpaf 950575 2015-09-10T13:50:12Z 2015-09-10T13:50:12Z CONTRIBUTOR

How about the function below? (Stolen from pyaxiom.)

``` python def get_variables_by_attributes(ds, strict=False, **kwargs): """ Returns variables that match specific conditions. * Can pass in key=value parameters and variables are returned that contain all of the matches. ex.: vs = nc.get_variables_by_attributes(axis='X') * Can pass in key=callable parameter and if the callable returns True. The callable should accept a single parameter, the attribute value. None is returned as the attribute valuewhen the attribute does not exist on the variable. ex.: # Get Axis variables vs = nc.get_variables_by_attributes(axis=lambda v: v in ['X', 'Y', 'Z', 'T']) # Get variable that don't have a "axis" attribute vs = nc.get_variables_by_attributes(axis=lambda v: v is None) # Get variable that have a "grid_mapping" attribute vs = nc.get_variables_by_attributes(axis=lambda v: v is not None)

* strict : True/False
    If True will return only 1 variable if only one is found. Default is False.
"""
vs = []

has_value_flag  = False
for vname, var in ds.iteritems():
    for k, v in kwargs.items():
        if callable(v):
            has_value_flag = v(getattr(var, k, None))
            if has_value_flag is False:
                break
        elif hasattr(var, k) and getattr(var, k) == v:
            has_value_flag = True
        else:
            has_value_flag = False
            break

    if has_value_flag is True:
        vs.append(ds[vname])

if strict:
    if len(vs) == 1:
        vs = vs[0]
    else:
        msg = "Expected only one variable.  Got {!r}".format
        raise ValueError(msg(vs))
return vs

```

See it in action here.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Best way to find data variables by standard_name 105688738
139055592 https://github.com/pydata/xarray/issues/567#issuecomment-139055592 https://api.github.com/repos/pydata/xarray/issues/567 MDEyOklzc3VlQ29tbWVudDEzOTA1NTU5Mg== rsignell-usgs 1872600 2015-09-09T21:48:02Z 2015-09-09T21:48:02Z NONE

I was thinking that the data variables that matched a specified standard_name would be a subset of the variables in the data_vars object.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Best way to find data variables by standard_name 105688738
139053466 https://github.com/pydata/xarray/issues/567#issuecomment-139053466 https://api.github.com/repos/pydata/xarray/issues/567 MDEyOklzc3VlQ29tbWVudDEzOTA1MzQ2Ng== shoyer 1217238 2015-09-09T21:38:54Z 2015-09-09T21:38:54Z MEMBER

I would probably make this return an xray.Dataset object instead of a plain dict, but otherwise this looks about right:

python def get_std_name_vars(ds,std_name): return ds[[k for k, v in ds.data_vars.iteritems() if 'standard_name' in v.attrs and std_name in v.standard_name]]

I don't think there's a better way to do this currently. Hypothetically, we could add this to a CF-specific API for xray, e.g., as discussed in #461.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Best way to find data variables by standard_name 105688738

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 15.209ms · About: xarray-datasette