home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 525154116

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/3262#issuecomment-525154116 https://api.github.com/repos/pydata/xarray/issues/3262 525154116 MDEyOklzc3VlQ29tbWVudDUyNTE1NDExNg== 1217238 2019-08-27T06:12:14Z 2019-08-27T06:12:14Z MEMBER

Feel free to refactor as you see fit, but it may still make sense to do indexing at the Variable rather than Dataset level. That potentially would let you avoid redundant operations on the entire Dataset object.

Take a look at the _localize() helper function in missing.py for an example of how to do stuff with in the underlying index. I think something like the following helper function could do the trick: python def linear_interp(var, indexes_coords): lower_indices = {} upper_indices = {} for dim, [x, new_x] in indexes_coords.items(): index = x.to_index() # ideally should precompute these, rather than calling get_indexer_nd for each # variable separately lower_indices[dim] = get_indexer_nd(index, new_x.values, method="ffill") upper_indices[dim] = get_indexer_nd(index, new_x.values, method="bfill") result = 0 for weight, indexes in ... # need to compute weights and all lower/upper combinations result += weight * var.isel(**indexes) return result

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