timholy / Grid.jl

Interpolation and related operations on grids
MIT License
47 stars 26 forks source link

Issue with example #72

Closed mkborregaard closed 8 years ago

mkborregaard commented 8 years ago

This bit from readme.md fails with an error:

x = -1.0:0.1:1.0
y = 2.0:0.5:10.0
z_2d = Float64[sin(i+j) for i in x, j in y]

z_2di = CoordInterpGrid((x,y), z_2d, BCnil, InterpQuadratic)

gives the error:

Invalid location

 in set_position(::Grid.InterpGridCoefs{Float64,Grid.InterpQuadratic}, ::Type{Grid.BCnil}, ::Bool, ::Bool, ::Array{Float64,1}) at /Users/michael/.julia/v0.5/Grid/src/interp.jl:403
 in _getindex at /Users/michael/.julia/v0.5/Grid/src/interp.jl:143 [inlined]
 in getindex at /Users/michael/.julia/v0.5/Grid/src/interp.jl:154 [inlined]
 in getindex(::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}, ::Int64, ::Int64) at /Users/michael/.julia/v0.5/Grid/src/coord.jl:39
 in isassigned(::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}, ::Int64, ::Int64, ::Vararg{Int64,N}) at ./abstractarray.jl:186
 in alignment(::IOContext{Base.AbstractIOBuffer{Array{UInt8,1}}}, ::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}, ::Array{Int64,1}, ::Array{Int64,1}, ::Int64, ::Int64, ::Int64) at ./show.jl:1277
 in print_matrix(::IOContext{Base.AbstractIOBuffer{Array{UInt8,1}}}, ::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}, ::String, ::String, ::String, ::String, ::String, ::String, ::Int64, ::Int64) at ./show.jl:1407
 in print_matrix(::IOContext{Base.AbstractIOBuffer{Array{UInt8,1}}}, ::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}, ::String, ::String, ::String) at ./show.jl:1379
 in #showarray#330(::Bool, ::Function, ::IOContext{Base.AbstractIOBuffer{Array{UInt8,1}}}, ::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}, ::Bool) at ./show.jl:1618
 in limitstringmime(::MIME{Symbol("text/plain")}, ::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}) at /Users/michael/.julia/v0.5/IJulia/src/execute_request.jl:31
 in display_dict(::Grid.CoordInterpGrid{Float64,2,Grid.BCnil,Grid.InterpQuadratic,Tuple{FloatRange{Float64},FloatRange{Float64}}}) at /Users/michael/.julia/v0.5/IJulia/src/execute_request.jl:46
 in execute_request(::ZMQ.Socket, ::IJulia.Msg) at /Users/michael/.julia/v0.5/IJulia/src/execute_request.jl:200
 in eventloop(::ZMQ.Socket) at /Users/michael/.julia/v0.5/IJulia/src/eventloop.jl:8
 in (::IJulia.##9#15)() at ./task.jl:360

Also, it is very unclear from readme.md what is the difference between InterpGrid and CoordInterpGrid - could you elaborate please?

tomasaschan commented 8 years ago

Also from the readme:

Note: for interpolation, the successor to Grid is Interpolations. Julia 0.5 will be the last supported release for Grid.

Is there a reason you're using Grid.jl, and not Interpolations.jl? The latter is faster, better tested, and more actively maintained, and has (to our knowledge) all features that the former has, and then some.

mkborregaard commented 8 years ago

Sorry! I for some reason read the readme as if Grid was the successor of Interpolations, not the other way around. Should I just close?

tomasaschan commented 8 years ago

@mkborregaard Sorry for not getting back to you on this - haven't spent much time in front of the screen over the weekend.

I'll try to clarify that sentence in the readme, to assist future readers :) Do file issues over att Interpolations.jl if you can't get it working as you'd like!

mkborregaard commented 8 years ago

Alas, the world is full of slackers that do not work on the weekend :smiley: Nice clarification on the readme!