home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

8 rows where author_association = "NONE" and user = 22258697 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

issue 5

  • xarray.DataArray > None kills kernel 3
  • Improving documentation on `apply_ufunc` 2
  • Landsat Surface Reflectance bands have tricky metadata 'band' attribute 1
  • apply_ufunc erroneously operating on an empty array when dask used 1
  • Xarray operations produce read-only array 1

user 1

  • rbavery · 8 ✖

author_association 1

  • NONE · 8 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
521758170 https://github.com/pydata/xarray/issues/2808#issuecomment-521758170 https://api.github.com/repos/pydata/xarray/issues/2808 MDEyOklzc3VlQ29tbWVudDUyMTc1ODE3MA== rbavery 22258697 2019-08-15T19:02:51Z 2021-07-21T16:47:47Z NONE

Ryan Abernathey gave a helpful answer for how to apply a pixel wise function using dask and apply_ufunc: https://stackoverflow.com/questions/57419541/how-to-use-apply-ufunc-with-numpy-digitize-for-each-image-along-time-dimension-o/57513184#57513184

I think the docs could improve on showing how to use apply_ufunc if we have a function that needs to be applied image-wise, like an image filter or segmentation, if we are chunking by time. Or, if the function needs to be applied window-wise, in which case the chunks are spatial (maybe DataArray.rolling and DataArray.reduce solve this case, but DataArray.reduce lacks an example).

Having examples that speak to these 2 specific use cases would, I think, help newcomers (like myself) that are coming from any domain that works with 2D ('x', 'y') or 3D ('x', 'y', 'time') arrays.

Currently the two examples in the docs show how to apply_ufunc with a 1D array http://xarray.pydata.org/en/stable/computation.html#comput-wrapping-custom

And two 2D arrays ('place', 'time') http://xarray.pydata.org/en/stable/dask.html#automatic-parallelization

Some other comments on my, and possibly others', points of confusion.

  1. I'm not sure what a gufunc is, and if this is different than a ufunc (see the spearman_correlation function)
  2. After rereading both pages and numpy docs to understand universal functions, I have some intuition about what input_core_dims does, but I still don't have a great enough understanding to know how to use apply_ufunc to operate across 3D arrays that are chunked by time or space.
  3. The api reference for apply_ufunc renders such that some arg names have no whitespace between the arg type. http://xarray.pydata.org/en/stable/generated/xarray.apply_ufunc.html

  4. apply_ufunc seems to have the flexibility to support operations that output DataArrays of reduced shape, with arguments named like output_core_dims and exclude_dims. However, I tried to use it with a custom function that takes as input a single 3D image ('x', 'y', 'band') in my time series and returns a tuple of an intercept and slope computed from regressing the blue and red bands of that image. I tried various arguments but kept running into errors. I think an example that shows how to use apply_ufunc where the output has a different, reduced shape than any of the inputs would be valuable.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Improving documentation on `apply_ufunc` 420584430
809858535 https://github.com/pydata/xarray/issues/3813#issuecomment-809858535 https://api.github.com/repos/pydata/xarray/issues/3813 MDEyOklzc3VlQ29tbWVudDgwOTg1ODUzNQ== rbavery 22258697 2021-03-30T02:31:54Z 2021-03-30T02:31:54Z NONE

I ran into the same issue as @bradyrx with writable arrays and apply_ufunc. An addition to the docs FAQ or apply_ufunc docs would help clarify that you can't write to the array inputs in the ufunc. I also want to +1 @bradyrx 's idea of making an arg to apply_ufunc that copies the input arrays to handle this common use case.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Xarray operations produce read-only array 573031381
802095333 https://github.com/pydata/xarray/issues/5049#issuecomment-802095333 https://api.github.com/repos/pydata/xarray/issues/5049 MDEyOklzc3VlQ29tbWVudDgwMjA5NTMzMw== rbavery 22258697 2021-03-18T16:38:04Z 2021-03-18T16:38:04Z NONE

Sorry, I thought I attached it to the original issue, here is the test file I'm using: test.zip

The test file @keewis mentioned does not produce the error.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray.DataArray > None kills kernel 834368403
801680295 https://github.com/pydata/xarray/issues/5049#issuecomment-801680295 https://api.github.com/repos/pydata/xarray/issues/5049 MDEyOklzc3VlQ29tbWVudDgwMTY4MDI5NQ== rbavery 22258697 2021-03-18T06:56:35Z 2021-03-18T06:56:35Z NONE

I attached the test.tif as a zip file, is that reproducible enough? I don't know what about the file is causing the issue.

On Wed, Mar 17, 2021, 10:02 PM Maximilian Roos @.***> wrote:

Please can you make a reproducible example?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pydata/xarray/issues/5049#issuecomment-801627451, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFJ2ICP7HBFRZYRS3O5EH6TTEGCP5ANCNFSM4ZL2TZQA .

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray.DataArray > None kills kernel 834368403
801617689 https://github.com/pydata/xarray/issues/5049#issuecomment-801617689 https://api.github.com/repos/pydata/xarray/issues/5049 MDEyOklzc3VlQ29tbWVudDgwMTYxNzY4OQ== rbavery 22258697 2021-03-18T04:38:06Z 2021-03-18T04:38:06Z NONE

When it is opened it's a DataArray. I saved it out to a .tiff with rioxarray so it has some extra attributes but I'm not sure if those are causing this issue.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray.DataArray > None kills kernel 834368403
521017662 https://github.com/pydata/xarray/issues/3168#issuecomment-521017662 https://api.github.com/repos/pydata/xarray/issues/3168 MDEyOklzc3VlQ29tbWVudDUyMTAxNzY2Mg== rbavery 22258697 2019-08-13T21:33:04Z 2019-08-13T21:34:33Z NONE

I am not sure if this is related or not, but my dask array has a different shape before and after computing. After computing by converting to a numpy array, it looks like the time dimension (44) is still there, which is expected but I would also expect this to show in the xarray metadata.

``` result <xarray.DataArray 'reflectance' (y: 1082, x: 1084)> dask.array<shape=(1082, 1084), dtype=uint16, chunksize=(1082, 1084)> Coordinates: band int64 1 * y (y) float64 9.705e+05 9.705e+05 9.705e+05 ... 9.673e+05 9.672e+05 * x (x) float64 4.889e+05 4.889e+05 4.889e+05 ... 4.922e+05 4.922e+05

[87]

the shape of the xarray and numpy array do not match after conversion to numpy array, the time dimension reappears

np.array(result).shape (1082, 1084, 44) ```

See: https://stackoverflow.com/questions/57419541/how-to-use-apply-ufunc-with-numpy-digitize-for-each-image-along-time-dimension-o

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  apply_ufunc erroneously operating on an empty array when dask used 474247717
520511588 https://github.com/pydata/xarray/issues/2808#issuecomment-520511588 https://api.github.com/repos/pydata/xarray/issues/2808 MDEyOklzc3VlQ29tbWVudDUyMDUxMTU4OA== rbavery 22258697 2019-08-12T17:09:26Z 2019-08-12T17:09:26Z NONE

I'd be interested in contributing an example on how to apply a function to each image in a time series within a DataArray, but I can't get my function to be applied. Details are in https://stackoverflow.com/questions/57419541/how-to-calculate-histogram-bins-for-each-image-in-an-xarray-dataarray-time-serie

Maybe we could include apply_ufunc examples on this issue or another github issue?

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Improving documentation on `apply_ufunc` 420584430
511135221 https://github.com/pydata/xarray/issues/3108#issuecomment-511135221 https://api.github.com/repos/pydata/xarray/issues/3108 MDEyOklzc3VlQ29tbWVudDUxMTEzNTIyMQ== rbavery 22258697 2019-07-13T16:27:06Z 2019-07-13T16:27:06Z NONE

Sounds good, I'll look into contributing a Landsat reader to Satpy, that's a better home for it.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Landsat Surface Reflectance bands have tricky metadata 'band' attribute 467735754

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 13.451ms · About: xarray-datasette