home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 1397104515

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
1397104515 I_kwDOAMm_X85TRh-D 7130 Passing keyword arguments to external functions 39069044 open 0     3 2022-10-05T02:51:35Z 2023-03-26T19:15:00Z   CONTRIBUTOR      

What is your issue?

Follow on from #6891 and #6978 to discuss how we could homogenize the passing of keyword arguments to wrapped external functions across xarray methods.

There are quite a few methods like this where we are ultimately passing data to numpy, scipy, or some other library and want the option to send variable length kwargs to that underlying function. There are two different ways of doing this today:

  1. xarray method accepts flexible **kwargs so these can be written directly in the xarray call
  2. xarray method accepts a single dict kwargs (sometimes named differently) and passes these along in expanded form via **kwargs

I could only find a few examples of the latter:

  • Dataset.interp, which takes kwargs
  • Dataset.curvefit, which takes kwargs (although the docstring is wrong here)
  • xr.apply_ufunc, which takes kwargs passed to func and dask_gufunc_kwargs passed to dask.array.apply_gufunc
  • xr.open_dataset, which takes either **kwargs or backend_kwargs and merges the two

Allowing direct passage with **kwargs seems nice from a user perspective. But, this could occasionally be problematic, for example in the Dataset.interp case where this method also accepts the kwarg form of coords with **coords_kwargs. There are many methods like this that use **indexers_kwargs or **chunks_kwargs with either_dict_or_kwargs but don't happen to wrap external functions.

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

Links from other tables

  • 2 rows from issues_id in issues_labels
  • 3 rows from issue in issue_comments
Powered by Datasette · Queries took 0.607ms · About: xarray-datasette