If we get a larger than memory output we currently get the following error, when we don't load Zarr.
We should be either falling back to other backends that might be available or give a better error message.
# Dataset "lst"
lst = ds[Variable="t2m"]
YAXArray with the following dimensions
longitude Axis with 101 Elements from -80.0 to -55.0
latitude Axis with 101 Elements from 65.0 to 40.0
number Axis with 50 Elements from 1 to 50
time Axis with 721 Elements from 2019-05-01T00:00:00 to 2019-10-28T00:00:00
units: K
Total size: 2.74 GB
# Time handling
time_to_index = getAxis("time", lst)
time_index = yearmonthday.(time_to_index)
new_dates = unique(time_index)
index_in_cube = [findall(==(i), time_index) for i in unique(time_index)]
# Functions
function maximum_by_index(xout, xin; index_list = time_to_index)
#@show size(xin)
#@show typeof(xin)
xout .= NaN
if !all(isnan, xin)
for i in eachindex(index_list)
if !all(isnan, xin[index_list[i]])
xout[i] = maximum(filter(!isnan, xin[index_list[i]]))
end
end
end
end
function dates_builder(x)
out = Date[]
for i in eachindex(x)
push!(out, Date(x[i][1], x[i][2]))
end
return out
end
Indims = InDims("time")
outdims = OutDims(RangeAxis("time", dates_builder(new_dates)))
t2m_daily_high = mapCube(maximum_by_index, lst, indims = Indims, outdims = outdims; index_list = index_in_cube, showprog = true)
Error message about a key with Zarr (the file is a netCDF).
Edit - The code work if I extract a single member of the ensemble (e.g. number=21):
t2m_daily_high = mapCube(maximum_by_index, ds[Variable="t2m", number=21], indims = Indims, outdims = outdims; index_list = index_in_cube, showprog = true)
YAXArray with the following dimensions
time Axis with 181 Elements from 2019-05-01 to 2019-10-01
longitude Axis with 101 Elements from -80.0 to -55.0
latitude Axis with 101 Elements from 65.0 to 40.0
Total size: 42.26 MB
If we get a larger than memory output we currently get the following error, when we don't load Zarr. We should be either falling back to other backends that might be available or give a better error message.
Error message about a key with Zarr (the file is a netCDF).
Edit - The code work if I extract a single member of the ensemble (e.g. number=21):
Originally posted by @Balinus in https://github.com/JuliaDataCubes/YAXArrays.jl/issues/217#issuecomment-1471778989