JuliaSpace / SatelliteToolbox.jl

A toolbox for satellite analysis written in julia language.
MIT License
248 stars 33 forks source link

Daily Ap index using get_Ap() and get_space_indices() #80

Closed sxd190026 closed 2 years ago

sxd190026 commented 2 years ago

I am trying to use NRLMSIS for getting neutral density, where daily Ap index is one of the arguments. I am trying to use the function "get_Ap" as given below:

get_Ap(date_to_jd(DateTime(2019,1,1,0,0,0)); mean = (), daily=true) but it generates the following error message:

IndexError: <PyCall.jlwrap (in a Julia function called from Python) JULIA: BoundsError: attempt to access 1216-element interpolate((::Vector{Float64},), ::Vector{StaticArrays.SVector{8, Float64}}, Gridded(Constant{Interpolations.Nearest}())) with element type StaticArrays.SVector{8, Float64} at index [2.4584845e6] Stacktrace: [1] throw_boundserror(A::Interpolations.GriddedInterpolation{StaticArrays.SVector{8, Float64}, 1, StaticArrays.SVector{8, Float64}, Interpolations.Gridded{Interpolations.Constant{Interpolations.Nearest, Interpolations.Throw{Interpolations.OnGrid}}}, Tuple{Vector{Float64}}}, I::Tuple{Float64}) @ Base ./abstractarray.jl:691 [2] GriddedInterpolation @ ~/.julia/packages/Interpolations/y4lLj/src/gridded/indexing.jl:3 [inlined] [3] get_Ap(JD::Float64; mean::Tuple{}, daily::Bool) @ SatelliteToolbox ~/.julia/packages/SatelliteToolbox/EKFPG/src/earth/space_indices/wdcfiles.jl:91 [4] top-level scope @ none:3 [5] eval @ ./boot.jl:373 [inlined] [6] eval @ ./Base.jl:68 [inlined] [7] (::var"#73#74")(globals::PyObject, locals::PyObject) @ Main ~/.local/lib/python3.9/site-packages/julia/pyjulia_helper.jl:91 [8] (::PyCall.FuncWrapper{Tuple{PyObject, PyObject}, var"#73#74"})(::PyObject, ::Vararg{PyObject}; kws::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ PyCall ~/.julia/packages/PyCall/7a7w0/src/callback.jl:56 [9] (::PyCall.FuncWrapper{Tuple{PyObject, PyObject}, var"#73#74"})(::PyObject, ::Vararg{PyObject}) @ PyCall ~/.julia/packages/PyCall/7a7w0/src/callback.jl:56 [10] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ Base ./essentials.jl:716 [11] invokelatest(::Any, ::Any, ::Vararg{Any}) @ Base ./essentials.jl:714 [12] _pyjlwrapcall(f::PyCall.FuncWrapper{Tuple{PyObject, PyObject}, var"#73#74"}, args::Ptr{PyCall.PyObjectstruct}, kw::Ptr{PyCall.PyObject_struct}) @ PyCall ~/.julia/packages/PyCall/7a7w0/src/callback.jl:28 [13] pyjlwrapcall(self::Ptr{PyCall.PyObjectstruct}, args::Ptr{PyCall.PyObjectstruct}, kw::Ptr{PyCall.PyObject_struct}) @ PyCall ~/.julia/packages/PyCall/7a7w0/src/callback.jl:44>

I tried the same using get_space_index(Ap(),date_to_jd(DateTime(2019,1,1,0,0,0))), however that runs into error as well.

RuntimeError: <PyCall.jlwrap (in a Julia function called from Python) JULIA: The data for the requested Julian Day is not available! Stacktrace: [1] error(s::String) @ Base ./error.jl:33 [2] get_space_index @ ~/.julia/packages/SatelliteToolbox/EKFPG/src/earth/space_indices/space_indices.jl:43 [inlined] [3] get_space_index(#unused#::Val{:Ap}, JD::Float64) @ SatelliteToolbox ~/.julia/packages/SatelliteToolbox/EKFPG/src/earth/space_indices/space_indices.jl:156 [4] top-level scope @ none:3 [5] eval @ ./boot.jl:373 [inlined] [6] eval @ ./Base.jl:68 [inlined] [7] (::var"#77#78")(globals::PyObject, locals::PyObject) @ Main ~/.local/lib/python3.9/site-packages/julia/pyjulia_helper.jl:91 [8] (::PyCall.FuncWrapper{Tuple{PyObject, PyObject}, var"#77#78"})(::PyObject, ::Vararg{PyObject}; kws::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ PyCall ~/.julia/packages/PyCall/7a7w0/src/callback.jl:56 [9] (::PyCall.FuncWrapper{Tuple{PyObject, PyObject}, var"#77#78"})(::PyObject, ::Vararg{PyObject}) @ PyCall ~/.julia/packages/PyCall/7a7w0/src/callback.jl:56 [10] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) @ Base ./essentials.jl:716 [11] invokelatest(::Any, ::Any, ::Vararg{Any}) @ Base ./essentials.jl:714 [12] _pyjlwrapcall(f::PyCall.FuncWrapper{Tuple{PyObject, PyObject}, var"#77#78"}, args::Ptr{PyCall.PyObjectstruct}, kw::Ptr{PyCall.PyObject_struct}) @ PyCall ~/.julia/packages/PyCall/7a7w0/src/callback.jl:28 [13] pyjlwrapcall(self::Ptr{PyCall.PyObjectstruct}, args::Ptr{PyCall.PyObjectstruct}, kw::Ptr{PyCall.PyObject_struct}) @ PyCall ~/.julia/packages/PyCall/7a7w0/src/callback.jl:44>

Am I doing something wrong? Would be a great if someone can suggest a way out of this. I am using PyJulia to write Julia codes in IPython environment