home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 433493555

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/2518#issuecomment-433493555 https://api.github.com/repos/pydata/xarray/issues/2518 433493555 MDEyOklzc3VlQ29tbWVudDQzMzQ5MzU1NQ== 1217238 2018-10-26T18:00:18Z 2018-10-26T18:00:18Z MEMBER

The general pattern of functions used with reduce() is that they remove a dimension.

But you could do this with apply_ufunc instead, e.g., something like: ```python def interptotarget(y, x, target): return interp1d(x, y)(target)

target = xr.DataArray([213.5, 213.6], dims='target_lon') xr.apply_ufunc(interptotarget, airtemps, airtemps.lon, target, input_core_dims=[['lon'], ['lon'], ['target_lon']], output_core_dims=[['target_lon']] ).assign_coords(target_lon=target) results in <xarray.Dataset> Dimensions: (lat: 25, target_lon: 2, time: 2920) Coordinates: * lat (lat) float32 75.0 72.5 70.0 67.5 65.0 ... 22.5 20.0 17.5 15.0 * time (time) datetime64[ns] 2013-01-01 ... 2014-12-31T18:00:00 * target_lon (target_lon) float64 213.5 213.6 Data variables: air (time, lat, target_lon) float64 243.8 243.8 ... 298.6 298.6 ```

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