Телескопы покупают здесь


A A A A Автор Тема: CALCEPH, доступ к SPICE  (Прочитано 484 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн gashaАвтор темы

  • ****
  • Сообщений: 350
  • Благодарностей: 17
  • 61:45:28,6 N 34:21:39.5 E (134 + 15 этаж) м
    • Сообщения от gasha
    • Siä Karjalassa
CALCEPH, доступ к SPICE
« : 27 Янв 2019 [20:35:08] »
У французов есть библиотека доступа к файлам с эфемеридами CALCEPH.

По работе с DE файлами всё понятно. Застопорился со SPICE.

Эфемериды в виде SPICE: EPM, INPOP, JPL.

Простой пример:

#include <iostream>
#include "calceph.h"

using namespace std;

int main()
{
    int res;
    double jd0=2451624;
    double dt=0;
    double PV[6];
   
    /* open the ephemeris file */
    res = calceph_sopen("/home/icar/Ephemeris/EPHEM/EPM/epm/EPM2017/SPICE/epm2017.bsp");
   
    /* the heliocentric coordinates of Mars */
    calceph_scompute(jd0, dt, 4, 11, PV);
    cout.precision(10);
    cout << " Heliocentric coordinates of Mars" << endl;
    cout << " PV[0] = " << PV[0] << endl;
    cout << " PV[1] = " << PV[1] << endl;
    cout << " PV[2] = " << PV[2] << endl;
    cout << " PV[3] = " << PV[3] << endl;
    cout << " PV[4] = " << PV[4] << endl;
    cout << " PV[5] = " << PV[5] << endl;

    /* close the ephemeris file */
    calceph_sclose();

    return 0;
}

На выходе:

./a.out                                                                                                             
CALCEPH ERROR : Astronomical unit is not available in the ephemeris file                                                                                                           
 Heliocentric coordinates of Mars                                                                                                                                                 
 PV[0] = inf                                                                                                                                                                       
 PV[1] = inf                                                                                                                                                                       
 PV[2] = inf                                                                                                                                                                       
 PV[3] = -inf                                                                                                                                                                     
 PV[4] = inf                                                                                                                                                                       
 PV[5] = inf   

Если подключить как файл эфемерид epm2017.tpc, то на выходе другая ошибка:

./a.out                                                                                                             
CALCEPH ERROR : Can't find time  2.4516240000000000E+06 in the ephemeris file                                                                                                     
 Heliocentric coordinates of Mars                                                                                                                                                 
 PV[0] = 0                                                                                                                                                                         
 PV[1] = 2.12202817e-314                                                                                                                                                           
 PV[2] = 6.952805446e-310                                                                                                                                                         
 PV[3] = 4.645527104e-310                                                                                                                                                         
 PV[4] = 9.881312917e-324                                                                                                                                                         
 PV[5] = 4.645527107e-310 

Далее возьмём привычный файл epm2017_de.bin с эфемеридами:

./a.out                                                                                                             
 Heliocentric coordinates of Mars                                                                                                                                                 
 PV[0] = 1.004743374                                                                                                                                                               
 PV[1] = 0.9791716539
 PV[2] = 0.4219471524
 PV[3] = -0.009650821934
 PV[4] = 0.009715034305
 PV[5] = 0.004716897185

и всё хорошо.

Вот такая прелюдия. Подскажите, пожалуйста, как работать со SPICE? И хотелось бы именно с помощью calceph.
Спасибо.
БПЦ 15х50, Nikon Aculon 7x50, Celestron Advanced VX 8" N, Sky-Watcher BK 909AZ3, ТАЛ-65, Таир-3ФС, Canon EOS 60D, Sony Alpha NEX-3.

Оффлайн crypter

  • ***
  • Сообщений: 100
  • Благодарностей: 10
    • Сообщения от crypter
Re: CALCEPH, доступ к SPICE
« Ответ #1 : 28 Янв 2019 [11:08:19] »
#include <iostream>
#include "calceph.h"

using namespace std;

int main()
{
    const char *filear[2] = {"epm2017.bsp", "epm2017.tpc"};
    calcephbin *res;
    double jd0 = 2451624.0;
    double dt = 0;
    double PV[6];
   
    /* open the ephemeris file */
    res = calceph_open_array(2, filear);
    if (!res) {
        cout << " Error " << endl;
        return -1;
    }

    /* the heliocentric coordinates of Mars */
    calceph_compute(res, jd0, dt, 4, 11, PV);
    cout.precision(10);
    cout << " Heliocentric coordinates of Mars" << endl;
    cout << " PV[0] = " << PV[0] << endl;
    cout << " PV[1] = " << PV[1] << endl;
    cout << " PV[2] = " << PV[2] << endl;
    cout << " PV[3] = " << PV[3] << endl;
    cout << " PV[4] = " << PV[4] << endl;
    cout << " PV[5] = " << PV[5] << endl;

    /* close the ephemeris file */
    calceph_close(res);

    return 0;
}

Оффлайн gashaАвтор темы

  • ****
  • Сообщений: 350
  • Благодарностей: 17
  • 61:45:28,6 N 34:21:39.5 E (134 + 15 этаж) м
    • Сообщения от gasha
    • Siä Karjalassa
Re: CALCEPH, доступ к SPICE
« Ответ #2 : 28 Янв 2019 [17:31:03] »
Большое спасибо)) 
В тоже время я, как обычно, читал мануал одним местом)  Там ведь всё написано...

В связи с ограничениям в библиотеке calceph, работа с BSP файлами JPL на данный момент невозможна.
« Последнее редактирование: 28 Янв 2019 [17:39:37] от gasha »
БПЦ 15х50, Nikon Aculon 7x50, Celestron Advanced VX 8" N, Sky-Watcher BK 909AZ3, ТАЛ-65, Таир-3ФС, Canon EOS 60D, Sony Alpha NEX-3.