xarray-contrib/cf-xarray

time being recognized by not T?

Closed this issue · 6 comments

kthyng commented

Is there a way that "time" can be recognized by cf-xarray but not "T"? The following works:

ds.cf["time"]

but not

ds.cf["T"]

FWIW the time variable looks like this:
image

The answer for my questions is always related to ds.encoding but I am not sure how to address that here when it looks to me like the results for "time" and "T" should match.
Thanks for any help! cc @dcherian

Yes that should work, this looks like a bug. Can you dig in to it?

kthyng commented

Yes but do you have any ideas to start with?

kthyng commented

Ok I found the place that causes an error (not sure why this doesn't print out to screen when it happens?):

https://github.com/xarray-contrib/cf-xarray/blob/main/cf_xarray/accessor.py#L324-L326

This line:

results.update((search_in | set(obj.dims)) & sgrid_axes[key])

has:

sgrid_axes[key]
*** KeyError: 'T'

I can dig in more but do you know off the top of your head what is happening in this part?

kthyng commented

Ok should I make a new release?

Ok should I make a new release?

Sure release 0.9.0 after #436 goes in

kthyng commented

Looks like it was included in the v.0.8.1 release so I will just use that. Thanks!