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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GeoEnergyIO"
uuid = "3b1dd628-313a-45bb-9d8d-8f3c48dcb5d4"
authors = ["Olav Møyner <olav.moyner@gmail.com> and contributors"]
version = "1.1.31"
version = "1.1.32"

[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
Expand Down
3 changes: 2 additions & 1 deletion ext/GeoEnergyIOPythonCallExt/GeoEnergyIOPythonCallExt.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module GeoEnergyIOPythonCallExt
import GeoEnergyIO
using PythonCall
import Dates
import Dates: DateTime
import Jutul: si_units

function GeoEnergyIO.read_summary_impl(pth; extra_out = false, verbose = false)
Expand All @@ -28,6 +28,7 @@ module GeoEnergyIOPythonCallExt
end
t_total += t_kw
end
out["START_DATE"] = pyconvert(DateTime, smry.getStartTime())
if extra_out
ret = (out, smry)
else
Expand Down
4 changes: 3 additions & 1 deletion src/IXParser/conversion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ function convert_resqml(resqml, unit_systems; verbose = false, strict = false, s
out = Dict{String, Any}()
for r in get(resqml, "props", [])
v = convert_resqml_props(r, unit_systems, verbose = verbose, strict = strict)
out[v["title"]] = v
if !ismissing(v)
out[v["title"]] = v
end
end
geom_and_props = get(resqml, "geom_and_props", [])
for (i, g) in enumerate(geom_and_props)
Expand Down
46 changes: 25 additions & 21 deletions src/IXParser/resqml.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,30 +57,34 @@ function convert_resqml_props(r, unit_systems = missing; verbose = false, strict
break
end
end
uuid = find_string_by_tag(prop, "eml20:UUID")

out = Dict{String, Any}()
out["is_discrete"] = is_discrete
out["is_continuous"] = is_continuous
out["UUID"] = uuid
out["UUID_obj"] = uuid_obj
out["kind"] = find_string_by_tag(prop, "resqml20:Kind")
out["title"] = find_string_by_tag(prop, "eml20:Title")
out["unit"] = find_string_by_tag(prop, "resqml20:UOM")
# Are values always patch0?
read_obj = HDF5.read(r.h5["/RESQML/$uuid_obj"])
if length(keys(read_obj)) == 1
read_obj = only(values(read_obj))
if is_continuous
read_obj, out["unit"] = convert_resqml_units(read_obj, out["unit"], out["title"], unit_systems; throw = strict)
if ismissing(prop)
println("No discrete or continuous property found in RESQML data entry.")
out = missing
else
uuid = find_string_by_tag(prop, "eml20:UUID")
out = Dict{String, Any}()
out["is_discrete"] = is_discrete
out["is_continuous"] = is_continuous
out["UUID"] = uuid
out["UUID_obj"] = uuid_obj
out["kind"] = find_string_by_tag(prop, "resqml20:Kind")
out["title"] = find_string_by_tag(prop, "eml20:Title")
out["unit"] = find_string_by_tag(prop, "resqml20:UOM")
# Are values always patch0?
read_obj = HDF5.read(r.h5["/RESQML/$uuid_obj"])
if length(keys(read_obj)) == 1
read_obj = only(values(read_obj))
if is_continuous
read_obj, out["unit"] = convert_resqml_units(read_obj, out["unit"], out["title"], unit_systems; throw = strict)
else
# Assume that units only apply for continuous props
@assert ismissing(out["unit"])
end
else
# Assume that units only apply for continuous props
@assert ismissing(out["unit"])
@warn "Expected only one dataset in /RESQML/$uuid_obj, got $(keys(read_obj)). Returning all values. No unit conversion will be done."
end
else
@warn "Expected only one dataset in /RESQML/$uuid_obj, got $(keys(read_obj)). Returning all values. No unit conversion will be done."
out["values"] = read_obj
end
out["values"] = read_obj
return out
end

Expand Down
4 changes: 2 additions & 2 deletions src/InputParser/keywords/schedule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:WRFTPLT})
end

function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:GRUPTREE})
parser_message(cfg, outer_data, "GRUPTREE", PARSER_MISSING_SUPPORT)
skip_record(f)
rec = parse_defaulted_group(f, ["Default", "Default"])
push_and_create!(data, "GRUPTREE", rec)
end

function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:AQUFETP})
Expand Down
46 changes: 27 additions & 19 deletions src/InputParser/keywords/special.jl
Original file line number Diff line number Diff line change
Expand Up @@ -300,18 +300,18 @@ function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:MULTIPLY})
ju = parsed[6]
kl = parsed[7]
ku = parsed[8]
target = get_operation_section(outer_data, dst)
Ibox, Jbox, Kbox = (il, iu), (jl, ju), (kl, ku)
do_apply = true
if ismissing(target)
if dst == "PORV" && haskey(grid, "PORO")
# TODO: Bit of a hack
target = grid["PORO"]
elseif dst in ("TRANX", "TRANY", "TRANZ")
dir = dst[end]
push_and_create!(data, "MULTRAN$dir", [(i = Ibox, j = Jbox, k = Kbox, factor = factor)])
do_apply = false
else
if dst == "PORV" && haskey(grid, "PORO")
# TODO: Bit of a hack
target = grid["PORO"]
elseif dst in ("TRANX", "TRANY", "TRANZ")
dir = dst[end]
push_and_create!(data, "MULTRAN$dir", [(i = Ibox, j = Jbox, k = Kbox, factor = factor)])
do_apply = false
else
target = get_operation_section(outer_data, dst)
if ismissing(target)
do_apply = false
parser_message(cfg, outer_data, "MULTIPLY", "Unable to apply MULTIPLY to non-declared field $dst. Skipping.")
end
Expand All @@ -323,7 +323,6 @@ function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:MULTIPLY})
end
end


function apply_multiply!(target::AbstractVector, factor, I, J, K, dims)
apply_multiply!(reshape(target, dims), factor, I, J, K, dims)
end
Expand Down Expand Up @@ -440,16 +439,25 @@ end

function parse_keyword!(data, outer_data, units, cfg, f, ::Val{:EDITNNC})
rec = read_record(f)
grid = outer_data["GRID"]
dims = grid["cartDims"]

while length(rec) > 0
parsed = parse_defaulted_line(rec, [-1, -1, -1, -1, -1, -1, 1.0, 0, 0, 0, 0, "X+", "X+", 0.0])
for i in 1:6
@assert parsed[i] > 0 "Entry $i in record $parsed was defaulted."
end
push_and_create!(data, "EDITNNC", parsed)
i1 = parsed[1]
j1 = parsed[2]
k1 = parsed[3]
i2 = parsed[4]
j2 = parsed[5]
j3 = parsed[6]
c1 = (i1, j1, k1)
c2 = (i2, j2, j3)
i1 > 0 || error("EDITNNC requires explicit cell indices (I index for first cell is defaulted or less than 1).")
i2 > 0 || error("EDITNNC requires explicit cell indices (I index for second cell is defaulted or less than 1).")
j1 > 0 || error("EDITNNC requires explicit cell indices (J index for first cell is defaulted or less than 1).")
j2 > 0 || error("EDITNNC requires explicit cell indices (J index for second cell is defaulted or less than 1).")
k1 > 0 || error("EDITNNC requires explicit cell indices (K index for first cell is defaulted or less than 1).")
j3 > 0 || error("EDITNNC requires explicit cell indices (K index for second cell is defaulted or less than 1).")

push_and_create!(data, "EDITNNC", [(c1 = c1, c2 = c2, trans_mult = parsed[7], diffuse_mult = parsed[end])])
rec = read_record(f)
end
parser_message(cfg, outer_data, "EDITNNC", PARSER_JUTULDARCY_MISSING_SUPPORT)
return data
end
Loading