AndrewAnnex / SpiceyPy

SpiceyPy: a Pythonic Wrapper for the SPICE Toolkit.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Strange data artifacts on Juno data

gabrielb09 opened this issue · comments

I have been using SpiceyPy (to great effect), to process trajectory information from the Juno Mission. I have been using the subpnt function to gather latitude, longitude and the skpos function to gather the position vectors for Juno during its orbits. For each orbit I use the meta kernel provided by the JADE team. My trajectory results appear to be generally accurate however several orbits have strange artifacts in them. These artifacts appear as large leaps in the the position vector and corresponding jumps in the latitude/longitude data.

Expected behavior
The web based SPICE interface (with the same meta kernel) produces data which is similar to the SpiceyPy output but without the artifacts. (I have attached plots for comparison)

Unknown
WGC_SubObserverPoint_20201015125306_0

Unknown_2
WGC_SubObserverPoint_20201015125306_1

To Reproduce
This is the code I've been using to gather the position information:

    spice.furnsh('./Kernels/PJ{}_metakernel.txt'.format(pj))

    time_str = np.array([t.iso for t in data_Table['UTC']])
    spiceyTimes = spice.str2et(time_str)

    positions, lightTimes = spice.spkpos('JUNO', spiceyTimes, 'IAU_JUPITER', 'NONE', 'JUPITER_BARYCENTER')
    lon = []
    lat = []
    for spiceyTime in tqdm(spiceyTimes):
        spoint, trgepc, srfvec = spice.subpnt('NEAR POINT: ELLIPSOID', 'JUPITER', spiceyTime, 'IAU_JUPITER', 'NONE', 'JUNO')
        srad, slon, slat = spice.reclat(spoint)
        lon.append(slon * spice.dpr())
        lat.append(slat * spice.dpr())

data_Table['UTC'] is a list of times with a dt of 60 seconds spanning from 2017-297/16:12:31 to 2017-297/19:12:31

And the meta kernel I have been using is:

PJ09_metakernel.txt
The specific kernels referenced can be downloaded through NAIF with the urls contained In the following file

Kernel_url.txt

Desktop (please complete the following information):

  • SpiceyPy Version 3.1.1
  • OS: Mac OsX 10.15.5
  • OS Architecture 64bit
  • Python Version 3.9.0
  • Python Architecture 64bit

What web based SPICE interface were you using? I'm also confused about the time ranges, it's hard to compare the graphs with different scaling and axis labels.

The web based interface is WebGeocalc its provided and maintained by NAIF. While the plots above have different aspect ratios they cover the exact same span of time (2017-297/16:12:31 to 2017-297/19:12:31) and show the same data (longitude for the two top plots and latitude for the two bottom plots).

@gabrielb09 thanks for the detailed post, could you also post the exact list of the data table of utc dates (the time_str array as a csv) or how you generated (exact python commands)? I am wondering if there is some issue with how those et times are being converted. You can probably quickly check the spiceytimes array to ensure it is monotonic as well, if they are not then the data artifact is caused by querying for the spacecraft state at a unexpected time

@gabrielb09 I confirmed that this looks like a issue with how you are converting your utc times into et times, I made the following notebook with your code and with a different procedure to produce the times and got the same plots as you made with webgeocalc
spiceypy_debug_juno.pdf

Thank you so much for your help, after further investigation you were right! My time array had some missing values, that will teach me to blindly trust my data!