I have a multidimensional coordinate dataset where lon and lat are dependent on (x,y) dimensions:
<xarray.Dataset>
Dimensions: (y: 310, x: 225, time: 52560, level: 10)
Coordinates:
lat (y, x) float32 ...
lon (y, x) float32 ...
* time (time) datetime64[ns] 2017-01-01 ... 2017-12-31T23:50:00
* x (x) int16 0 1 2 3 4 5 6 7 8 ... 216 217 218 219 220 221 222 223 224
* y (y) int16 0 1 2 3 4 5 6 7 8 ... 301 302 303 304 305 306 307 308 309
* level (level) float32 40.0 60.0 80.0 100.0 ... 170.0 200.0 250.0 300.0
Data variables:
wspd (time, level, y, x) float32 dask.array<chunksize=(100, 10, 310, 225), meta=np.ndarray>
Attributes: (12/130)
TITLE: D3E5
START_DATE: 2011-07-01_00:00:00
SIMULATION_START_DATE: 2010-01-01_00:00:00
WEST-EAST_GRID_DIMENSION: [256]
SOUTH-NORTH_GRID_DIMENSION: [352]
BOTTOM-TOP_GRID_DIMENSION: [50]
... ...
ISOILWATER: [14]
history: Thu Aug 8 14:07:48 2019: ncrcat -7 -L 3...
NCO: 4.4.2
title: D3E5
nco_openmp_thread_number: [1]
actual_range: [100. 100.]
Values of x range from 0-309 and y from 0-224 in a local coordinate system.
In order to filter my data for a time series of my wspd variable to a given lon, lat coordinate, I have followed this post to find the nearest point. This works great for me.
Now the question of interest:
Nearest neighbor is not sufficient for me and I want to interpolate as you can do in xarray under Advanced Interpolation by using xr.DataArray.interp(x, y, method="cubic") to get a more representative time series for my point of interest. Only that I can not do that, since .interp() dose not work with multidimensional coordinates such as lon(x,y) and lat(x,y).
One Idea was to find the exact equivalent (x_actual,y_actual)-coordinate, not just the nearest, to my given (lon,lat)-coordinate and with that use .interp(x_actual,y_actual, method="cudic"). But I do not know if that would work and how to do it.
Dose anyone know how to get an interpolated data variable for a point given in multidimensional coordinates?
Thank you for your help and please tell me if I can supply any more information.