Skip to content

Commit

Permalink
improve tests for writing datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Barth committed Oct 5, 2023
1 parent 8a5efc9 commit 06730ec
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions test/test_multifile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ function example_file(i,array, fname = tempname();
#nclon[:] = 1:size(array,1)
#nclat[:] = 1:size(array,2)
nctime.var[:] = i

nclon[:] = 1:size(array,1)
nclat[:] = 1:size(array,2)
end
return fname
end
Expand Down Expand Up @@ -147,13 +150,22 @@ for deferopen in (false,true)
write(fname_merged,mfds)

ds_merged = NCDataset(fname_merged)
@test mfds.dim["time"] == size(C,3)

@test mfds.dim["time"] == size(C,3)
@test mfds["time"][:] == ds_merged["time"][:]
@test mfds["lon"][:] == ds_merged["lon"][:]
@test name(mfds[CF"time"]) == "time"

close(ds_merged)


# save subset of aggregated file
fname_merged = tempname()
write(fname_merged,mfds,idimensions = Dict("lon" => 1:1))

ds_merged = NCDataset(fname_merged)
@test mfds["lon"][1:1] == ds_merged["lon"][:]
close(ds_merged)

# show
buf = IOBuffer()
show(buf,mfds)
Expand Down

0 comments on commit 06730ec

Please sign in to comment.