Skip to content

Commit e95dc06

Browse files
CommonDatamodel.parentdataset for root group for a multi-file should be nothing
1 parent 16d30cc commit e95dc06

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/dataset.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ only a single group, this will be always the root group `"/"`.
1717
"""
1818
name(ds::AbstractDataset) = "/"
1919

20+
"""
21+
pds = CommonDatamodel.parentdataset(ds::AbstractDataset)
22+
23+
The data set `pds` containing `ds` as a sub-group.
24+
`pds` is nothing for the root group.
25+
"""
2026
parentdataset(ds::AbstractDataset) = nothing
27+
2128
sync(ds::AbstractDataset) = nothing
2229

2330
"""

src/multifile.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ end
6262

6363
function parentdataset(mfds::MFDataset)
6464
ds = parentdataset.(mfds.ds)
65-
return MFDataset(ds,mfds.aggdim,mfds.isnewdim,mfds.constvars)
65+
66+
if isnothing(ds[1])
67+
return nothing
68+
else
69+
return MFDataset(ds,mfds.aggdim,mfds.isnewdim,mfds.constvars)
70+
end
6671
end
6772

6873
Base.Array(v::MFVariable) = Array(v.var)

0 commit comments

Comments
 (0)