Skip to content

Accessing dicts with jl.Symbol keys from python #5

@havahol

Description

@havahol

Several of the objects from JutulDarcy has field that can be accessed through using a Julia Symbol as a dict key. An example:

state[:Reservoir][:Pressure]

Accessing these fields from Python becomes quite verbose:

state[jd.jl.Symbol('Reservoir')][jd.jl.Symbol('Pressure')]

We should either update JutulDarcy.jl to accept strings as keys as well, or find a less verbose access method on the Python side

Encountered objects (from PR #3) for this issue in PyJutulDarcy:

  • DataDomain objects
  • MultiModel objects
  • The return value from setup_reservoir_state which is a Dict{Any, Any}. For this specific one, perhaps the wrapper should call symdict_to_pydict before return?

For examples, see notebook/equilibrium_state.ipynb and set_secondary_variable! wrapper from PR #3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions