home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 50425930

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/191#issuecomment-50425930 https://api.github.com/repos/pydata/xarray/issues/191 50425930 MDEyOklzc3VlQ29tbWVudDUwNDI1OTMw 1217238 2014-07-29T01:56:53Z 2014-07-29T05:48:55Z MEMBER

So I would definitely still wrap the scipy functions for any interpolation routines for xray. It's not worth rewriting any of them twice! Scipy is an optional dependency for xray, but it would be fine to require it for the interpolation routines.

Yes, there do seems to be a few different interpolation routines in scipy. Naming the function you're thinking of something like xray.interpolation.map_coordinates would leave plenty of room for alternative interpolation methods.

In xray, we have DataArray objects (corresponding to a particular variable in a netCDF file along with its coordinates) as well as Datasets (corresponding to entire netCDFs). I think it makes a bit more sense to interpolate individual variables, so I guess you would want this function to have a signature something like the following:

``` Parameters


source : DataArray Gridded source data. destination : ndarray or dict-like (e.g., xray.Dataset or pandas.DataFrame) Array of points of points to sample at (n_obs * n_dim) or mapping from dimension names to coordinate values. order : int, optional mode : {'constant', 'nearest'}, optional cval : scalar, optional Maybe defaulting to NaN instead of 0?

Returns

interpolated : DataArray Data array with interpolated values. Coordinates and dimensions are copied from points. ```

You don't need to necessarily handle all the edge cases of possible input to destination, but it would be nice to handle destinations with labeled dimensions (e.g., in the form of a dictionary or xray.Dataset), and return labeled data in the form of an xray DataArray, with the same coordinate values (if they were supplied).

The DataArray constructor isn't in the currently released version of xray but it will be a major feature of the next release (hopefully to be released in a week or two) and it might be worth using here. It should be clearly documented in the docstring of DataArray.__init__ but let me know if you have any questions.

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