Help needed for gfoclt_c call
Closed this issue ยท 6 comments
Hi Greg!
As you know, I validate ANISE against SPICE using your library. For nyx-space/anise#297, I've added the occultation computation using the algorithm I derived for Nyx several years ago. I have strong reasons to believe that the algorithm is correct, as seen in this recent GEO eclipsing analysis. After the (many) verification tests, now is time for validation, and what better tool than SPICE?
Anyway, I'm trying to understand how I can call gfoclt
. The rust doc expects *mut i8
even for inputs that the SPICE docs say should be strings (like the frame type).
Where can I see an example on how I should be interfacing with this function?
Thanks
Hi @ChristopherRabotin! You did stunning progress on ANISE since last time we talked, huge congrats! For occultations and eclipses, I'm very familiar and use very often the occult
function instead of gfoclt
. So I can help on the tests if you need!
With current C bindings for rust-spice, functions taking ConstSpiceChar *
as input, expects *mut i8
. We have a macro to help with that here.
The interface with gfoclt
is still raw FFI but the occult
has a nice interface already, see here.
I will add the idiomatic rust interface to gfoclt
for the future need.
Let me know if this helped you :)
Great, thanks! I'll look into it. I didn't even know of occult, but this looks exactly like what I'm trying to implement.
I've implemented the computation in nyx-space/anise#307 . That said, it doesn't account for the DSK yet because ANISE does not support those (yet!).
Hi Greg,
Have you used the POINT
method of the occult function in SPICE? I'm trying to validate the line of sight computation in ANISE after seeing some discrepancy compared to other software for the LOS algorithm only (the shadowing algorithm matches the SPICE results exactly).
I tried defining a "pinpoint" location in a text file as follows:
\begintext
SITES = ('MADRIDVAL')
MADRIDVAL_FRAME = 'IAU_EARTH'
MADRIDVAL_IDCODE = 3990001
MADRIDVAL_CENTER = 399
MADRIDVAL_LATLON = ( 40.427222, 4.250556, 0.834939 )
MADRIDVAL_TOPO_FRAME = 'MADRIDVAL_TOPO'
MADRIDVAL_TOPO_ID = 3990001
MADRIDVAL_UP = 'Z'
MADRIDVAL_NORTH = 'X'
\begintext
For the occultation and line of sight validation only
Here is how it's defined in the validate_gh_283_multi_barycenter_and_los test.
MADRIDVAL_TOPO_FRAME = 'MADRID_TOPO'
MADRIDVAL_TOPO_ID = 3990001
MADRIDVAL_UP = 'Z'
MADRIDVAL_NORTH = 'X'
let latitude_deg = 40.427_222;
let longitude_deg = 4.250_556;
let height_km = 0.834_939;
let iau_earth = almanac.frame_from_uid(IAU_EARTH_FRAME).unwrap();
PINPOINT Inputs
=======================================================
\begindata
SITES += 'NDOSL_AC2J'
NDOSL_AC2J_CENTER = 399
NDOSL_AC2J_FRAME = 'ITRF93'
NDOSL_AC2J_IDCODE = 399100208
NDOSL_AC2J_LATLON = ( -7.9179155833, 345.6092320833, 0.071470 )
NDOSL_AC2J_TOPO_FRAME = 'NDOSL_AC2J_TOPO'
NDOSL_AC2J_TOPO_ID = 399100208
NDOSL_AC2J_UP = 'Z'
NDOSL_AC2J_NORTH = 'X'
And then calling the occult function as follows:
sp.occult("-85", "POINT", " ", "Moon" , "ELLIPSOID", "IAU_MOON", abcorr, "NDOSL_AC2J", epoch.to_et_seconds())
Where the ET is 755956869.183453
and abcorr
is set to NONE
.
I get this error:
Toolkit version: CSPICE_N0067
SPICE(IDCODENOTFOUND) --
The observer, 'NDOSL_AC2J', is not a recognized name for an ephemeris object. The cause of this problem may be that you need an updated version of the SPICE toolkit.
occult_c --> OCCULT --> ZZGFOCIN
This approach should be identical to what's in example #1 of https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/occult_c.html. So I'm not sure what is going on here.
Any idea?
Thanks
P.S.: Here is a copy of the LRO BSP file: http://public-data.nyxspace.com/nyx/examples/lrorg_2023349_2024075_v01_LE.bsp .
Hey Chris! Yes first I already used the POINT
method of occult
spice function (Didymos/Dimorphos wrt Sun/spacecraft, same with Mars/Phobos/Deimos) for quick tests, but always found better results with ELLIPSOID
or DSK/UNPRIORITIZED
if available.
I'll look at the example and try to reproduce it to understand the difference. For the moment it simply looks like not enough info loaded in your kernel pool for your observer NDOSL_AC2J
.
I don't understand what you try to achieve. In my case it was occultation/eclipse calculation. What is a pinpoint? English barrier here haha. Do you want to see if you longitude/latitude surface point on the Moon is shadowed?
It isn't urgent, I validated the computation through the results of another tool for now. I was trying to use SPICE to see whether a the Moon would prevent a ground station on the Earth from seeing a lunar orbiter. When computing the azimuth, elevation, and range data, the elevation tells us whether the other object is above or below the horizon, but that is only part of the problem.