When dealing with gridding data, you often don't have the data exactly where you need it, and so you have to interpolate it to your desired point or points, or regrid it onto an entirely new gridded domain. Luckily xarray, along with the companion package xesmf, makes this straightforward by leveraging coordinate metadata.
For a full description of interpolation in xarray, see the relevant section of xarray's documentation, and for full information on xesmf, see its documentation site.
import numpy as np
import xarray as xr
...
...
...
...
...
...
There's a lot more to xarray than just ...! Be sure to take a look at the other xarray training notebooks linked below: