EranOfek / AstroPack

Astronomy & Astrophysics Software Pacakge
Other
17 stars 4 forks source link

Issue with celestial.SolarSys.getJPL_ephem not recognizing multiple matches #496

Closed saraylet closed 1 month ago

saraylet commented 1 month ago

When running the line of code:

JPLTable = celestial.SolarSys.getJPL_ephem('Stearns;','StartTime',2.460367402830201e+06,'StopTime',2.460367407229721e+06);

I get the following error:

Index exceeds the number of array elements. Index must not exceed 0.

Error in celestial.SolarSys.getJPL_ephem (line 300)
            Pos = min([PosJD(1); PosCD; PosDT]);

I noticed that in line 272 of getJPL_ephem it results in a value of false for multiple matches:


K>> contains(Output.result, 'Multiple major-bodies match string')

ans =

  logical

   0

even though there are multiple matches:


K>> Output.result

ans =

    *******************************************************************************
     JPL/DASTCOM            Small-body Index Search Results     2024-Aug-15 08:24:44

      Comet AND asteroid index search:

        NAME = STEARNS;

      Matching small-bodies: 

         Record #  Epoch-yr  Primary Desig  >MATCH NAME<
         --------  --------  -------------  -------------------------
             2035            1973 SC         Stearns
         90001881    1927    C/1927 E1       Stearns

      (2 matches. To SELECT, enter record # (integer), followed by semi-colon.)
     *******************************************************************************

The error occurs at line 300 where PosJD, PosCD, and PosDT are all empty.

EranOfek commented 1 month ago

You have to use the asteroid designation (number) and not name: e.g., celestial.SolarSys.getJPL_ephem('9804;','StartTime',2.460367402830201e+06,'StopTime',2.460367407229721e+06)