Skip to content

Commit

Permalink
Merge pull request #64 from ChevronETC/defaultgeom
Browse files Browse the repository at this point in the history
Add a default geometry
  • Loading branch information
samtkaplan authored May 30, 2024
2 parents c4f16a1 + da578d3 commit 9b21d8c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/CloudSeis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2356,16 +2356,27 @@ Return the geometry (if any) associated with the
CloudSeis data-set.
"""
function TeaSeis.geometry(io::CSeis)

g = io.geometry
# sample_order = get_sample_order(io)
modelstrides = get_model_strides(io)

if g === nothing
g = Geometry(;
ox=0.0, oy=0.0, oz=0.0,
ux=0.0, uy=0.0, uz=(size(io,1)-1)*pincs(io,1),
vx=0.0, vy=(size(io,2)-1)*pincs(io,2), vz=0.0,
wx=(size(io,3)-1)*pincs(io,3), wy=0.0, wz=0.0,
u1=1,un=size(io,1),
v1=1,vn=size(io,2),
w1=1,wn=size(io,3)
)
end

g.modelstride_u = modelstrides["u"]
g.modelstride_v = modelstrides["v"]
g.modelstride_w = modelstrides["w"]

return g

g
end

"""
Expand Down
15 changes: 15 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1348,5 +1348,20 @@ end
@test z["flow"]["processes"][1]["process"] == "myprocess3"
@test z["flow"]["processes"][1]["parameters"] == Dict("six"=>6, "seven"=>7)

rm(io)
end

@testset "default geometry" for cloud in clouds
container = mkcontainer(cloud, "test-$(uuid4())-cs")
io = csopen_robust(container, "w", axis_lengths=[10,12,20])
close(io)

io = csopen(container)
g = geometry(io)

@test g.un == 10
@test g.vn == 12
@test g.wn == 20

rm(io)
end

0 comments on commit 9b21d8c

Please sign in to comment.