Skip to content

Commit

Permalink
Fix for short TOPS arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
moyner committed Apr 22, 2024
1 parent 2424287 commit 1790ae5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/CornerPointGrid/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,16 @@ function mesh_from_dxdydz_and_tops(grid; actnum = get_effective_actnum(grid))
cartdims = grid["cartDims"]
nx, ny, nz = cartdims
function meshgrid_section(k)
gvec = grid[k]
haskey(grid, k) || throw(ArgumentError("Section GRID must have $k section when using DX/DY/DZ/TOPS format."))
return reshape(grid[k], cartdims)
if k == "TOPS" && length(gvec) < nx*ny*nz
# We only need the top layer - extract this and discard the rest if
# too little data is provided.
out = reshape(gvec[1:nx*ny], nx, ny, 1)
else
out = reshape(gvec, cartdims)
end
return out
end
ismissing(nnc) || length(nnc) == 0 || throw(ArgumentError("NNC is not supported together with DX/DY/DZ/TOPS mesh."))
# @assert all(actnum)
Expand Down

0 comments on commit 1790ae5

Please sign in to comment.