rigoudyg / climaf

CliMAF - a Climate Model Analysis Framework - doc at : http://climaf.readthedocs.org/
Other
16 stars 7 forks source link

Exporting a ds to xarray #227

Open oliviermarti opened 2 years ago

oliviermarti commented 2 years ago

The method cMA allows to get a numpy array from a ds. I would really appreciate to have a cXR function, which would produced an xarray object.

Thanks

Olivier

senesis commented 2 years ago

Hi Olivier

Could you give a try to :

def cXR(obj) :
    ds = xarray.open_dataset(cfile(obj))
    return ds[obj.variable]

which could be added in a later release ?

And, actually, atop of working with a ds, it should work for more elaborated CliMAF objects

oliviermarti commented 2 years ago

Works fine with a simple object. Thanks !