This seems like a very basic operation, but I can't figure out how to do it using the xarray documentation.
I have an xarray DataSet:
dss
<xarray.DataArray (y: 1000, x: 1334)>
dask.array<shape=(1000, 1334), dtype=uint8, chunksize=(222, 58)>
Coordinates:
band int32 1
* y (y) float64 2.218e+06 2.218e+06 2.218e+06 2.218e+06 2.218e+06 ...
* x (x) float64 1.891e+06 1.891e+06 1.891e+06 1.891e+06 1.891e+06 ...
Attributes:
transform: (30.0, 0.0, -2493045.0, 0.0, -30.0, 3310005.0, 0.0, 0.0, 1.0)
crs: +ellps=GRS80 +lat_0=23 +lat_1=29.5 +lat_2=45.5 +lon_0=-96 +n...
res: (30.0, 30.0)
is_tiled: 1
nodatavals: (nan,)
and a numpy array with the correct dimensions:
print(np.shape(nmap))
(1000, 1334)
nmap
array([[ 0.15, 0.1 , 0.15, ..., 0.05, 0.05, 0.02],
[ 0.15, 0.1 , 0.05, ..., 0.05, 0.05, 0.05],
[ 0.1 , 0.15, 0.15, ..., 0.05, 0.05, 0.02],
...,
[ 0.02, 0.02, 0.02, ..., 0.02, 0.02, 0.02],
[ 0.02, 0.09, 0.09, ..., 0.02, 0.02, 0.02],
[ 0.02, 0.09, 0.09, ..., 0.02, 0.02, 0.02]])
I would like to add the array to the DataSet. My ultimate goal is to do spatial interpolation using x and y to extract interpolated values of nmap on a new grid.