home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 275979038

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/277#issuecomment-275979038 https://api.github.com/repos/pydata/xarray/issues/277 275979038 MDEyOklzc3VlQ29tbWVudDI3NTk3OTAzOA== 1562854 2017-01-30T04:42:12Z 2017-01-30T04:42:12Z CONTRIBUTOR

OK, great! I figured it out. Something like the below works; @rabernat had pointed to a similar solution, but I didn't quite understand what dask.array.map_blocks was doing.

``` import xmitgcm import xarray as xr data = xmitgcm.open_mdsdataset(dirname='./',prefix={'T'},iters=12600,read_grid=True,geometry='cartesian',endian='<', chunks={'Z':1,'time':1})

def interpolateAtDepth(T,x0,y0,x,y): import scipy.interpolate if np.shape(T)[-1]>1: xout=np.zeros((1,1,ny,nx))
fit=scipy.interpolate.RectBivariateSpline(x0,y0,T[0,0,:,:].T) xout = fit(x,y).T else: xout=np.ones((1,1,1,1)) return xout

x, y, nx, ny are determined elsewhere, but set the new grid...

tm = data['T'].data.map_blocks(interpolateAtDepth,data['XC'].values,data['YC'].values,x,y,chunks=(1,1,ny,nx)) ```

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