home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 297560256

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
297560256 MDU6SXNzdWUyOTc1NjAyNTY= 1914 cartesian product of coordinates and using it to index / fill empty dataset 10928117 open 0     17 2018-02-15T19:03:23Z 2024-01-05T17:09:55Z   NONE      

For a given empty dataset with only coordinates

python import xarray as xr import numpy as np data = xr.Dataset(coords={'x': np.linspace(-1, 1), 'y': np.linspace(0, 10), 'a': 1, 'b': 5})

I'd like to iterate over the product of coordinates, in a similar way as it can be done for numpy.arrays

python data = np.zeros((10, 5, 10)) for (i, j, k), _ in np.ndenumerate(data): data[i, j, k] = some_function(i, j, k)

to fill the data with values of some function.

Also I'd like to extend this to the cases of functions that are multi-valued, i.e. they return a numpy.array.

Is there an easy way to do so? I was unable to find anything similar in the docs.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1914/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  reopened 13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 12 rows from issue in issue_comments
Powered by Datasette · Queries took 0.794ms · About: xarray-datasette