Skip to content

Commit

Permalink
CommonDatamodel.parentdataset for root group for a multi-file should …
Browse files Browse the repository at this point in the history
…be nothing
  • Loading branch information
Alexander-Barth committed Feb 16, 2024
1 parent 16d30cc commit e95dc06
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/dataset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ only a single group, this will be always the root group `"/"`.
"""
name(ds::AbstractDataset) = "/"

"""
pds = CommonDatamodel.parentdataset(ds::AbstractDataset)
The data set `pds` containing `ds` as a sub-group.
`pds` is nothing for the root group.
"""
parentdataset(ds::AbstractDataset) = nothing

sync(ds::AbstractDataset) = nothing

"""
Expand Down
7 changes: 6 additions & 1 deletion src/multifile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ end

function parentdataset(mfds::MFDataset)
ds = parentdataset.(mfds.ds)
return MFDataset(ds,mfds.aggdim,mfds.isnewdim,mfds.constvars)

if isnothing(ds[1])
return nothing
else
return MFDataset(ds,mfds.aggdim,mfds.isnewdim,mfds.constvars)
end
end

Base.Array(v::MFVariable) = Array(v.var)
Expand Down

0 comments on commit e95dc06

Please sign in to comment.