home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 737899772

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/issues/4644#issuecomment-737899772 https://api.github.com/repos/pydata/xarray/issues/4644 737899772 MDEyOklzc3VlQ29tbWVudDczNzg5OTc3Mg== 32801740 2020-12-03T12:03:42Z 2020-12-03T12:03:42Z CONTRIBUTOR

IIUC before PR #4314 numpy.ndarray.astype was used and the order parameter was just part of that. Looking through PR #4314 it seems that the 'casting' parameter required some special casing in duck_array_ops.py since not all duck arrays did support it (in particular sparse arrays only gained it very recently). In the current case the order parameter is not supported at all for sparse arrays.

I am thinking it might not even be worthwhile to add support for an order parameter similar to the numpy.ndarray.astype method:

  • It would add more special casing logic to xarray.
  • To the user it would result in either noisy warnings or silently dropping parameters.
  • To me, the kind of contiguousness seems more like an implementation detail of the array type of the underlying data than as a property of the encapsulating xarray object.
  • For my use case (with numpy arrays as the underlying data) I can quite easily work around this issue by using something like da.copy(data=np.asfortranarray(da.data)) for the example above (or np.ascontiguousarray for C contiguousness).

Another option might be to allow arbitrary **kwargs which will be passed through as-is to the astype method of the underlying array and making it the responsibility of the user to only supply parameters which make sense for that particular array type.

What are your thoughts? Does xarray have some kind of policy for supporting parameters which might not make sense for all types of duck arrays?

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