I am looking for a way of extracting a list of the data variable names (strings) from a xarray.DataSet object.
I have used xr_object.data_vars
and xr_object.data_vars.keys()
but they don't seem to give anything usefull.
Also, the docs of xarray don't seem show that xarray has a built in method or attribute for getting something similar.
Anybody knows how to do so?
Your question is a little ambigous. I guess you know that
xr_object.keys()
would give you a view of the dataset keys.
if you just need to put it to a list, then a list() function would do it ( at least after V0.11 ): (ds is the xr_object)
list(ds.keys())
and if you need dimensions too:
list(ds.coords)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With