We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyError: key Irrational{:π} not found
Irrational
Describe the bug
It seems you cannot save an Irrational as an attribute.
To Reproduce
using NCDatasets ds = NCDataset("/tmp/test.nc", "c") defDim(ds, "x", 10) v = defVar(ds, "food", Float32, ("x",), attrib = Dict("pie" => π))
Expected behavior
I guess the error makes sense since the NetCDF library doesn't know about Julia's Irrational type and C does not have an irrational type.
As a package nicety would it make sense to convert Irrationals to Float64 for this use case?
Float64
Environment
$ uname -a Linux manjaro 5.0.15-1-MANJARO #1 SMP PREEMPT Fri May 10 19:51:04 UTC 2019 x86_64 GNU/Linux
_ _ _ _(_)_ | Documentation: https://docs.julialang.org (_) | (_) (_) | _ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. | | | | | | |/ _` | | | | |_| | | | (_| | | Version 1.5.1 (2020-08-25) _/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release |__/ | (@v1.5) pkg> st Status `~/.julia/environments/v1.5/Project.toml` [fbb218c0] BSON v0.2.6 [6e4b80f9] BenchmarkTools v0.5.0 [aae7a2af] DiffEqFlux v1.23.0 [e30172f5] Documenter v0.25.2 [442a2c76] FastGaussQuadrature v0.4.2 [f6369f11] ForwardDiff v0.10.12 [98b081ad] Literate v2.7.0 [85f8d34a] NCDatasets v0.10.4 [d848d694] OceanTurb v0.3.3 [9e8cae18] Oceananigans v0.40.0 [5fb14364] OhMyREPL v0.5.8 [91a5bcdd] Plots v1.6.3 [c3e4b0f8] Pluto v0.11.14 [f27b6e38] Polynomials v1.1.7 [92933f4c] ProgressMeter v1.4.0 [438e738f] PyCall v1.92.1 [d330b81b] PyPlot v2.9.0 [295af30f] Revise v2.7.6 [24249f21] SymPy v1.0.28 [a759f4b9] TimerOutputs v0.5.6 [e88e6eb3] Zygote v0.5.8 [d6f4376e] Markdown
Full output
ERROR: KeyError: key Irrational{:π} not found Stacktrace: [1] getindex at ./dict.jl:467 [inlined] [2] nc_put_att(::Int32, ::Int32, ::String, ::Irrational{:π}) at /home/alir/.julia/packages/NCDatasets/HhdCu/src/netcdf_c.jl:524 [3] setindex!(::NCDatasets.Attributes{NCDataset{Nothing}}, ::Irrational{:π}, ::String) at /home/alir/.julia/packages/NCDatasets/HhdCu/src/attributes.jl:57 [4] defVar(::NCDataset{Nothing}, ::String, ::DataType, ::Tuple{String}; kwargs::Base.Iterators.Pairs{Symbol,Dict{String,Irrational{:π}},Tuple{Symbol},NamedTuple{(:attrib,),Tuple{Dict{String,Irrational{:π}}}}}) at /home/alir/.julia/packages/NCDatasets/HhdCu/src/cfvariable.jl:158 [5] top-level scope at REPL[13]:1
The text was updated successfully, but these errors were encountered:
FieldSlicer
NetCDFOutputWriter
No branches or pull requests
Describe the bug
It seems you cannot save an
Irrational
as an attribute.To Reproduce
Expected behavior
I guess the error makes sense since the NetCDF library doesn't know about Julia's
Irrational
type and C does not have an irrational type.As a package nicety would it make sense to convert
Irrational
s toFloat64
for this use case?Environment
Full output
The text was updated successfully, but these errors were encountered: