I have a multidimensional dataarray with values at various lat, lon points. I would like to pull out these values and put them in a dataframe. I have tried using DataArray.to_dataframe() but I cannot get the dataframe to display exactly how I want it. Here is what the dataarray looks like.
<xarray.DataArray (lat: 109, lon: 327)>
array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]])
Coordinates:
* lat (lat) float64 -52.0 -51.0 -50.0 -49.0 -48.0 ... 53.0 54.0 55.0 56.0
* lon (lon) float64 28.0 29.0 30.0 31.0 32.0 ... 351.0 352.0 353.0 354.0
Ideal output would look like this:
Latitude Longitude Value
x y 1
z a 2
... ... ...
Is there a better way of doing this besides a dataframe?