I was wondering if there exists the possibility of re-shuffling variables in an xarray.dataset...
I have a dataset where I've been appending variables following a certain order given by a certain process... Then, when I print the dataset in a Python console (or when executing ncdump -h output.nc I get that same order, but I wish to get variables in another order.
What I get:
<xarray.Dataset>
Dimensions: (stations: 6,
Rrs_bands: 110,
Rrs_S3A_OLCI_bands: 21)
Coordinates:
* stations (stations) <U16 ...
* Rrs_bands (Rrs_bands) float64 ...
* Rrs_S3A_OLCI_bands (Rrs_S3A_OLCI_bands) float64 ...
Data variables: (12/69)
Rrs (stations, Rrs_bands) float64 ...
acquisition_time (stations) object ...
lon (stations) float64 ...
lat (stations) float64 ...
depth (stations) float64 ...
Rrs_qa (stations) float64 ...
... ...
total_column_formaldehyde (stations) float64 ...
total_column_hydrogen_peroxide (stations) float64 ...
total_column_hydroxyl_radical (stations) float64 ...
total_column_nitric_acid (stations) float64 ...
total_column_peroxyacetyl_nitrate (stations) float64 ...
Rrs_S3A_OLCI (stations, Rrs_S3A_OLCI_bands) float64 ...
Attributes:
description: In situ database file (IDB) for insitu set Geneva (in sit...
What I want:
<xarray.Dataset>
Dimensions: (stations: 6,
Rrs_bands: 110,
Rrs_S3A_OLCI_bands: 21)
Coordinates:
* stations (stations) <U16 ...
* Rrs_bands (Rrs_bands) float64 ...
* Rrs_S3A_OLCI_bands (Rrs_S3A_OLCI_bands) float64 ...
Data variables: (12/69)
acquisition_time (stations) object ...
lon (stations) float64 ...
lat (stations) float64 ...
depth (stations) float64 ...
... ...
total_column_formaldehyde (stations) float64 ...
total_column_hydrogen_peroxide (stations) float64 ...
total_column_hydroxyl_radical (stations) float64 ...
total_column_nitric_acid (stations) float64 ...
total_column_peroxyacetyl_nitrate (stations) float64 ...
Rrs (stations, Rrs_bands) float64 ...
Rrs_qa (stations) float64 ...
Rrs_S3A_OLCI (stations, Rrs_S3A_OLCI_bands) float64 ...
Attributes:
description: In situ database file (IDB) for insitu set Geneva (in sit...
Is there an easy way of re-organizing this listing when printing or doing ncdump?
Thanks :)