Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/teaseisio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ function write_extentmanager(io::JSeis)
write_parproperty(extentman, "VFIO_VERSION", "string", " 2006.2 ")
write_parproperty(extentman, "VFIO_EXTSIZE", "long", " $(io.trcextents[1].size) ")
write_parproperty(extentman, "VFIO_MAXFILE", "int", " $(length(io.trcextents)) ")
write_parproperty(extentman, "VFIO_MAXPOS", "long", " $(prod(io.axis_lengths[2:end]) * tracelength(io) - 1) ")
write_parproperty(extentman, "VFIO_MAXPOS", "long", " $(prod(io.axis_lengths[2:end]) * tracelength(io)) ")
write_parproperty(extentman, "VFIO_EXTNAME", "string", " TraceFile ")
write_parproperty(extentman, "VFIO_POLICY", "string", " RANDOM ")

Expand All @@ -896,7 +896,7 @@ function write_extentmanager(io::JSeis)
write_parproperty(extentman, "VFIO_VERSION", "string", " 2006.2 ")
write_parproperty(extentman, "VFIO_EXTSIZE", "long", " $(io.hdrextents[1].size) ")
write_parproperty(extentman, "VFIO_MAXFILE", "int", " $(length(io.hdrextents)) ")
write_parproperty(extentman, "VFIO_MAXPOS", "long", " $(prod(io.axis_lengths[2:end]) * headerlength(io) - 1) ")
write_parproperty(extentman, "VFIO_MAXPOS", "long", " $(prod(io.axis_lengths[2:end]) * headerlength(io)) ")
write_parproperty(extentman, "VFIO_EXTNAME", "string", " TraceHeaders ")
write_parproperty(extentman, "VFIO_POLICY", "string", " RANDOM ")

Expand Down
18 changes: 18 additions & 0 deletions test/test_teaseisio.jl
Original file line number Diff line number Diff line change
Expand Up @@ -715,3 +715,21 @@ end
write(io, trcs, :, :, :)
@test isfile(joinpath(c,"second","foo","test.js","TraceFile0"))
end

# issue https://github.com/ChevronETC/TeaSeis.jl/issues/28
@testset "teaseisio, VFIO_MAXPOS should be the size of the extent rather than an offset" begin
c = pwd()
ENV["JAVASEIS_DATA_HOME"] = joinpath(c, "primary")
io = jsopen(joinpath(ENV["JAVASEIS_DATA_HOME"], "test.js"), "w", axis_lengths=[3,3,10], secondaries=[joinpath(c,"second")], nextents=3)
close(io)
io = jsopen(joinpath(ENV["JAVASEIS_DATA_HOME"], "test.js"))

expected_extent_size = sizeof(Float32)*size(io,1)*size(io,2)*(div(10,3)+1)
expected_total_size = sizeof(Float32)*prod(size(io))
@test io.trcextents[1].size == expected_extent_size
@test io.trcextents[2].size == expected_extent_size

# the last extent size is computed from, in part, VFIO_MAXPOS
@test io.trcextents[3].size == expected_total_size - 2*expected_extent_size
rm(io)
end
Loading