JuliaDataCubes / YAXArrays.jl

Yet Another XArray-like Julia package
https://juliadatacubes.github.io/YAXArrays.jl/
Other
101 stars 17 forks source link

open_mfdataset function not exported? #247

Closed Balinus closed 1 year ago

Balinus commented 1 year ago

Hello!

I have a collection of yearly files from 1981 top 2020 for a single variable. Is there a way to open those files and build a Cube from it? I saw a function called open_mfdataset in the source code, but it does now seem to be exported. By copy-pasting the code found in https://github.com/JuliaDataCubes/YAXArrays.jl/blob/43640165301bdcf49fa3cc763414715174585fbb/src/DatasetAPI/Datasets.jl I was able to load a multifile dataset correctly.

Is it still experimental?

Thanks!

lazarusA commented 1 year ago

you should be able to do

t2m = YAXArrays.Datasets.open_mfdataset(inpath * "t2m/*.nc").t2m[time=2001:2021]

or the full time period

t2m = YAXArrays.Datasets.open_mfdataset(inpath * "t2m/*.nc")

but be careful, is never a good idea to use *.nc to read all files unless you are sure about them.

Balinus commented 1 year ago

Ah, thanks! I was trying to use YAXArrays.open_mfdataset 😄

It does work!