pyjulia
pyjulia copied to clipboard
Identifiers with subscripts and superscripts
As mentioned in the documention, Python3 normalizes some unicode identifiers, in particular those including subscripts and superscripts.
Now, I have a julia function that needs input arguments written with sub/superscripts. How can I pass the correct identifer to the function ?
Otherwise, in the same way function!() is converted to function_b(), coud we think of converting Rₛ to Rs ?
>>> from julia import PlantBiophysics as PB
>>> leaf = PB.LeafModels(
energy = PB.Monteith(),
photosynthesis = PB.Fvcb(),
stomatal_conductance = PB.Medlyn(0.03, 12.0),
Rₛ = 13.747, skyFraction = 1.0, PPFD = 1500.0, d = 0.03
)
┌ Warning: use values(kwargs) and keys(kwargs) instead of kwargs.data and kwargs.itr
│ caller = #MutableNamedTuple#1 at MutableNamedTuples.jl:9 [inlined]
└ @ Core ~/.julia/packages/MutableNamedTuples/6Sa4J/src/MutableNamedTuples.jl:9
┌ Warning: use values(kwargs) and keys(kwargs) instead of kwargs.data and kwargs.itr
│ caller = #MutableNamedTuple#1 at MutableNamedTuples.jl:9 [inlined]
└ @ Core ~/.julia/packages/MutableNamedTuples/6Sa4J/src/MutableNamedTuples.jl:9
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
/var/folders/v1/6y176c8d2jz06qr8rd3jq_480000gn/T/ipykernel_82531/2481116038.py in <module>
----> 1 leaf = PB.LeafModels(
2 energy = PB.Monteith(),
3 photosynthesis = PB.Fvcb(),
4 stomatal_conductance = PB.Medlyn(0.03, 12.0),
5 Rₛ = 13.747, skyFraction = 1.0, PPFD = 1500.0, d = 0.03
RuntimeError: <PyCall.jlwrap (in a Julia function called from Python)
JULIA: Key Rs not found as a variable of any provided models
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] init_variables_manual(::Missing, ::Vararg{Any}; vars::Base.Pairs{Symbol, Float64, NTuple{4, Symbol}, NamedTuple{(:Rs, :skyFraction, :PPFD, :d), NTuple{4, Float64}}})
@ PlantBiophysics ~/.julia/packages/PlantBiophysics/BC7Kh/src/models_helpers.jl:320
[3] PlantBiophysics.LeafModels(; interception::Missing, energy::PlantBiophysics.Monteith{Float64, Int64}, photosynthesis::PlantBiophysics.Fvcb{Float64}, stomatal_conductance::PlantBiophysics.Medlyn{Float64}, status::Base.Pairs{Symbol, Float64, NTuple{4, Symbol}, NamedTuple{(:Rs, :skyFraction, :PPFD, :d), NTuple{4, Float64}}})
@ PlantBiophysics ~/.julia/packages/PlantBiophysics/BC7Kh/src/structs/concrete_component_structs.jl:110
[4] invokelatest(::Any; kwargs::Base.Pairs{Symbol, Any, NTuple{7, Symbol}, NamedTuple{(:energy, :photosynthesis, :stomatal_conductance, :Rs, :skyFraction, :PPFD, :d), Tuple{PlantBiophysics.Monteith{Float64, Int64}, PlantBiophysics.Fvcb{Float64}, PlantBiophysics.Medlyn{Float64}, Float64, Float64, Float64, Float64}}})
@ Base ./essentials.jl:718
[5] _pyjlwrap_call(f::Type, args_::Ptr{PyCall.PyObject_struct}, kw_::Ptr{PyCall.PyObject_struct})
@ PyCall ~/.julia/packages/PyCall/L0fLP/src/callback.jl:32
[6] pyjlwrap_call(self_::Ptr{PyCall.PyObject_struct}, args_::Ptr{PyCall.PyObject_struct}, kw_::Ptr{PyCall.PyObject_struct})
@ PyCall ~/.julia/packages/PyCall/L0fLP/src/callback.jl:44>