So I have an Xarray dataset, ds, with 3 variables in it: (example data)
Data variables:
CO2 (time, data) float32 400.0 400.0 ... 400.0
...
Where the data dimension is a 1D array, for which I have 1D arrays of matching length containing latitude and longitude for each entry in data. The latitudes and longitudes are not sampled regularly. Ideally I would add the lat and lon so it showed up like this:
Data variables:
CO2 (time, data, lat, lon) float32 400.0 400.0 ... 400.0
...
How can I add the lat/lon as a dimension so that I can interpolate along it using the Xarray interp function? (or is there some other, better way to interpolate this data?)
Eg: ds_interp = ds.interp(time=dt, lat=dlat, lon=dlon, assume_sorted=False)