Skip to content

Commit

Permalink
use save_zip and load_zip
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 committed Oct 17, 2023
1 parent d8ac5ef commit 053a6d1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MEDYANSimRunner"
uuid = "b58a3b99-22e3-44d1-b5ea-258f082a6fe8"
authors = ["nhz2 <[email protected]>"]
version = "0.4.1"
version = "0.4.2"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
Expand All @@ -23,5 +23,5 @@ DeepDiffs = "1"
JSON3 = "1"
LoggingExtras = "1"
OrderedCollections = "1"
SmallZarrGroups = "0.5, 0.6, 0.7"
SmallZarrGroups = "0.7.1"
julia = "1.9"
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ Random.seed!(collect(reinterpret(UInt64, sha256(job))))
job_header, state = setup(job)
save job_header
step = 0
SmallZarrGroups.save_dir(snapshot_zip_file, save_snapshot(step, state))
state = load_snapshot(step, SmallZarrGroups.load_dir(snapshot_zip_file), state)
SmallZarrGroups.save_zip(snapshot_zip_file, save_snapshot(step, state))
state = load_snapshot(step, SmallZarrGroups.load_zip(snapshot_zip_file), state)
while true
state = loop(step, state)
step = step + 1
SmallZarrGroups.save_dir(snapshot_zip_file, save_snapshot(step, state))
state = load_snapshot(step, SmallZarrGroups.load_dir(snapshot_zip_file), state)
SmallZarrGroups.save_zip(snapshot_zip_file, save_snapshot(step, state))
state = load_snapshot(step, SmallZarrGroups.load_zip(snapshot_zip_file), state)
if done(step::Int, state)[1]
break
end
Expand Down
4 changes: 2 additions & 2 deletions src/outputdiff.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ function print_traj_diff(io::IO, jobout1::AbstractString, jobout2::AbstractStrin
for snapshotname in (snapshots1 snapshots2)
full_name1 = joinpath(snapshot1dir, snapshotname)
full_name2 = joinpath(snapshot2dir, snapshotname)
group1 = SmallZarrGroups.load_dir(full_name1)
group2 = SmallZarrGroups.load_dir(full_name2)
group1 = SmallZarrGroups.load_zip(full_name1)
group2 = SmallZarrGroups.load_zip(full_name2)
SmallZarrGroups.print_diff(io, group1, group2, full_name1, full_name2, "", startswith("#"))
end
elseif snapshot1dir_exists && !snapshot2dir_exists
Expand Down
6 changes: 2 additions & 4 deletions src/run-sim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,12 @@ end

function zip_group(g::ZGroup)::Vector{UInt8}
io = IOBuffer()
writer = SmallZarrGroups.ZarrZipWriter(io)
SmallZarrGroups.save_dir(writer, g)
SmallZarrGroups.closewriter(writer)
SmallZarrGroups.save_zip(io, g)
take!(io)
end

function unzip_group(data::Vector{UInt8})::ZGroup
SmallZarrGroups.load_dir(SmallZarrGroups.ZarrZipReader(data))
SmallZarrGroups.load_zip(data)
end


0 comments on commit 053a6d1

Please sign in to comment.