issues
1 row where "created_at" is on date 2022-07-07 and user = 2448579 sorted by updated_at descending
This data as json, CSV (advanced)
Suggested facets: created_at (date), updated_at (date), closed_at (date)
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1298145215 | I_kwDOAMm_X85NYB-_ | 6763 | Map_blocks should raise nice error if provided template has no dask arrays | dcherian 2448579 | closed | 0 | 3 | 2022-07-07T21:58:06Z | 2022-07-14T17:42:26Z | 2022-07-14T17:42:26Z | MEMBER | Discussed in https://github.com/pydata/xarray/discussions/6762
<sup>Originally posted by **tlsw231** July 7, 2022</sup>
I am trying to use `map_blocks` to: ingest a multi-dimensional array as input, reduce along one dimension and add extra dimensions to the output. Is this possible? I am attaching a simple MRE below that gives me an `zip argument #2 must support iteration` error. Any pointers on what I might be doing wrong?
[My real example is a 3d-dataset with `(time,lat,lon)` dimensions and I am trying to reduce along `time` while adding two new dimensions to the output. I tried so many things and got so many errors, including the one in the title, that I thought it is better to first understand how `map_blocks` works!]
```
# The goal is to feed in a 2d array, reduce along one dimension and add two new dimensions to the output.
chunks={}
dummy = xr.DataArray(data=np.random.random([8,100]),dims=['dim1','dim2']).chunk(chunks)
def some_func(func):
dims=func.dims
n1 = len(func[func.dims[1]]) # This is 'dim2', we will average along 'dim1' below in the for loop
newdim1 = 2; newdim2 = 5;
output = xr.DataArray(np.nan*np.ones([n1,newdim1,newdim2]),dims=[dims[1],'new1','new2'])
for n in range(n1):
fmean = func.isel(dim2=n).mean(dims[0]).compute()
for i in range(newdim1):
for j in range(newdim2):
output[n,i,j] = fmean
return output
#out = some_func(dummy) # This works
template=xr.DataArray(np.nan*np.ones([len(dummy.dim2),2,5]),
dims=['dim2','new1','new2'])
out = xr.map_blocks(some_func,dummy,template=template).compute() # gives me the error message in the title
```
[Edit: Fixed a typo in the `n1 = len(func[func.dims[1]])` line, of course getting the same error.] |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/6763/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | xarray 13221727 | issue |
Advanced export
JSON shape: default, array, newline-delimited, object
CREATE TABLE [issues] ( [id] INTEGER PRIMARY KEY, [node_id] TEXT, [number] INTEGER, [title] TEXT, [user] INTEGER REFERENCES [users]([id]), [state] TEXT, [locked] INTEGER, [assignee] INTEGER REFERENCES [users]([id]), [milestone] INTEGER REFERENCES [milestones]([id]), [comments] INTEGER, [created_at] TEXT, [updated_at] TEXT, [closed_at] TEXT, [author_association] TEXT, [active_lock_reason] TEXT, [draft] INTEGER, [pull_request] TEXT, [body] TEXT, [reactions] TEXT, [performed_via_github_app] TEXT, [state_reason] TEXT, [repo] INTEGER REFERENCES [repos]([id]), [type] TEXT ); CREATE INDEX [idx_issues_repo] ON [issues] ([repo]); CREATE INDEX [idx_issues_milestone] ON [issues] ([milestone]); CREATE INDEX [idx_issues_assignee] ON [issues] ([assignee]); CREATE INDEX [idx_issues_user] ON [issues] ([user]);