I have a NetCDF file containing wind conditions (speed, direction, u, v) over time at specified coordinates (irregular grid composed of 110804 nodes). The latitudes and longitudes are stored as variables which makes it very difficult to work with the dataset in space dimension (spatial subsetting, interpolating on a new grid).
Dimensions: (node: 110804, time: 385)
Coordinates:
* time (time) datetime64[ns] 1999-12-15 ... 1999-12-31
Dimensions without coordinates: node
Data variables:
uwnd (time, node) float32 ...
vwnd (time, node) float32 ...
longitude (node) float32 -8.53543 -8.500304 -8.53419 ... -7.5 -7.5 -7.5
latitude (node) float32 51.632282 51.654434 51.65914 ... 50.8125 50.875
wndS (time, node) float32 9.426028 9.41913 ... 4.1617303 4.104875
wndDir (time, node) float32 -175.74115 -176.34778 ... 125.2176 124.07719
After opening the dataset with xarray, how can I convert the variables "latitude" and "longitude" as dimensions/coordinates of the dataset ?