xMIP icon indicating copy to clipboard operation
xMIP copied to clipboard

Try to use cf-xarray for some things?

Open rabernat opened this issue 4 years ago • 6 comments

Right now cmip6 preprocessing works by directly renaming variables / dimensions to homogenize across models.

Another model would be to try to fill in cf-compliant metadata for all the datasets, and then use cf-xarray: https://cf-xarray.readthedocs.io/en/latest/examples/introduction.html

I think that has some architectural advantages over the current model.

cc @dcherian

rabernat avatar Oct 30 '20 15:10 rabernat

A possible roadmap:

  1. would be to add nice attributes after renaming variables (e.g. axis: X, standard_name: longitude etc.)
  2. using cf-xarray to generate a renaming dict when possible. Fix #52. We can make Dataset.cf.rename work so that this will be easy.
  3. use cfxr.bounds_to_vertex and cfxr.vertex_to_bounds (https://cf-xarray.readthedocs.io/en/latest/api.html#top-level-api) instead of reimplementing them.

dcherian avatar Jan 26 '21 18:01 dcherian

Yes to all of those. I have been using cf-xarray in my prototype code for 3. already, so that just needs to be ported.

I have recently encountered a real need for 1., so I think that would be a great point to start. Do you think you have capacity to work on this @dcherian? I will get to it, but probably not before next week.

Thanks for the patience.

jbusecke avatar Jan 26 '21 18:01 jbusecke

Do you think you have capacity to work on this @dcherian?

Nope :) but happy to help debug / implement / review / merge things on the cf-xarray side

dcherian avatar Jan 26 '21 18:01 dcherian

Hehe, that is amazing, many thanks. Thanks. Ill ping you as soon as I can put some cycles in!

jbusecke avatar Jan 26 '21 19:01 jbusecke

Just curious: would cf-xarray help with the xfails in #89 ?

dcherian avatar Feb 01 '21 18:02 dcherian

Not entirely sure about that. My approach for this was to get this running with 'blindly' failing some datasets. After that works, I wanted to dig into details about why each one of these fails and how to solve them, one by one. I think that refactoring the internals with cf-xarray will help for sure, but I doubt it will be a super easy 'plug and play solution'. Thats why I wanted to have a broad baseline of tests (even if they fail) before diving in.

jbusecke avatar Feb 01 '21 19:02 jbusecke