Return custom name for DataArray
Opened this issue · 2 comments
kthyng commented
This came up in #234 and I want to capture the idea here:
I'd like to be able to not just ask for the "ssh" variable for example, but ask which type of variable I have. So in addition to:
ds.cf["ssh"]
returning the "ssh"-matching variable, I would like to be able to, for a DataArray da:
da.cf._get_custom_type()
to return "ssh", or somehow do the inverse search, returning the custom names that match the DataArray.
kthyng commented
@dcherian is there an analogous function in the accessor code that would make sense to copy for this?
dcherian commented
This may be useful:
cf-xarray/cf_xarray/accessor.py
Lines 547 to 569 in 770f40c
It rewrites things like .chunks
and .sizes
when a one-to-one mapping is possible