-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
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
Issue in writing dict type #38
Comments
Can you provide some example values of julia> function SaveNPZ(loc,ROMParam, U)
if ispath(loc) == false
#println("Current working directory \n", pwd() )
# Make the directory....
mkdir(loc)
end
tmp_file = joinpath(loc,"mydata.npz") #string( loc,"Zone_",string(j) )loc
println(tmp_file)
npzwrite(tmp_file, Dict("ROMParam" => ROMParam, "U" => U) )
end
SaveNPZ (generic function with 1 method)
julia> SaveNPZ("data", 1, 1)
data/mydata.npz
julia> npzread("data/mydata.npz")
Dict{String,Int64} with 2 entries:
"U" => 1
"ROMParam" => 1
|
Hi Jishnub, |
I'm not sure if this package supports writing dictionaries or other non-array python objects. Meanwhile you may use julia> np = pyimport("numpy");
julia> np.savez("temp.npz", U = Dict("a"=>4))
julia> f = np.load("temp.npz");
julia> f.get("U")
0-dimensional Array{PyObject,0}:
PyObject {'a': 4}
julia> f.get("U")[].get("a")
4 |
Hi Jishnub, |
Hi,
Thank you for the NPZ.jl package. I am using the package as follows
I am getting following error at the runtime not sure what I am doing wrong..novice to julia...!!
ERROR: LoadError: MethodError: no method matching npzwritearray(::ZipFile.WritableFile, ::Dict{Any,Any}) Closest candidates are: npzwritearray(::IO, !Matched::AbstractArray{UInt8,N} where N, !Matched::DataType, !Matched::Array{Int64,1}) at /Users/shar306/.julia/packages/NPZ/OBINJ/src/NPZ.jl:273 npzwritearray(::IO, !Matched::AbstractArray{T,N} where N) where T at /Users/shar306/.julia/packages/NPZ/OBINJ/src/NPZ.jl:298 npzwritearray(::IO, !Matched::T) where T<:Number at /Users/shar306/.julia/packages/NPZ/OBINJ/src/NPZ.jl:302
The text was updated successfully, but these errors were encountered: