Skip to content

Commit

Permalink
Finish s
Browse files Browse the repository at this point in the history
  • Loading branch information
helgee committed Feb 20, 2019
1 parent ffe8e31 commit 632fa30
Show file tree
Hide file tree
Showing 9 changed files with 1,794 additions and 915 deletions.
9 changes: 8 additions & 1 deletion src/cells.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Base: getindex, push!, append!, show, length, size
export SpiceIntCell, SpiceDoubleCell, SpiceCharCell, appnd, push!, append!, card, length, copy
export SpiceIntCell, SpiceDoubleCell, SpiceCharCell, appnd, push!, append!, card, length, copy, size_c

const CTRLSZ = 6

Expand Down Expand Up @@ -189,3 +189,10 @@ function Base.copy(cell::SpiceCharCell)
copy
end

"""
size_c(cell::SpiceCell)
Returns the maximum number of elements that `cell` can hold.
"""
size_c(cell) = cell.cell.size

32 changes: 32 additions & 0 deletions src/g.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export
gcpool,
gdpool,
georec,
getelm,
getfov,
gfpa,
gfpa!,
Expand Down Expand Up @@ -102,6 +103,37 @@ function georec(lon, lat, alt, re, f)
rectan
end

"""
getelm(frstyr, lines)
Given the "lines" of a two-line element set, parse the lines and return the elements in units
suitable for use in SPICE software.
### Arguments ###
- `frstyr`: Year of earliest representable two-line elements
- `lines`: A pair of "lines" containing two-line elements
### Output ###
- `epoch`: The epoch of the elements in seconds past J2000
- `elems`: The elements converted to SPICE units
### References ###
- [NAIF Documentation](https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/getelm_c.html)
"""
function getelm(frstyr, lines)
array, _, lineln = chararray(lines)
epoch = Ref{SpiceDouble}()
elems = Array{SpiceDouble}(undef, 10)
ccall((:getelm_c, libcspice), Cvoid,
(SpiceInt, SpiceInt, Ptr{SpiceChar}, Ref{SpiceDouble}, Ptr{SpiceDouble}),
frstyr, lineln, array, epoch, elems)
handleerror()
epoch[], elems
end

"""
getfov(instid, room=10, shapelen=128, framelen=128)
Expand Down
6 changes: 3 additions & 3 deletions src/l.jl
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ Returns an array of surface points
"""
function latsrf(method, target, et, fixref, lonlat)
npts = length(lonlat)
lonlat = permutedims(hcat(collect.(lonlat)...))
srfpts = Matrix{SpiceDouble}(undef, npts, 3)
lonlat = array_to_cmatrix(lonlat, n=2)
srfpts = Matrix{SpiceDouble}(undef, 3, npts)
ccall((:latsrf_c, libcspice), Cvoid,
(Cstring, Cstring, SpiceDouble, Cstring, SpiceInt, Ptr{SpiceDouble}, Ptr{SpiceDouble}),
method, target, et, fixref, npts, lonlat, srfpts)
handleerror()
[srfpts[i, :] for i in 1:size(srfpts,1)]
cmatrix_to_array(srfpts)
end

_lcase(in) = _lcase(in,length(in)+1)
Expand Down

0 comments on commit 632fa30

Please sign in to comment.