#!/bin/csh

#
# Set FRMDIFF location.
#
set FRMDIFF = "/naif/toolkit/exe/frmdiff"

#
# Set supporting kernel names.
#
set KERNELS = "/ftp/pub/naif/JUNO/kernels/lsk/naif0009.tls /ftp/pub/naif/JUNO/kernels/sclk/JNO_SCLKSCET.00001.tsc /home/bsemenov/juno/data/fk/juno_v05.tf"

#
# Set CK names.
#
set SCCK    = "/ftp/pub/naif/JUNO/kernels/ck/juno_sc_rec_111115_111115_JADEHVCO_v01.bc"

set CHUACK  = "/ftp/pub/naif/JUNO/misc/fgm/20111129/juno_chua_rec_111115_111116_v01.bc"
set CHUBCK  = "/ftp/pub/naif/JUNO/misc/fgm/20111129/juno_chub_rec_111115_111116_v01.bc"
set CHUCCK  = "/ftp/pub/naif/JUNO/misc/fgm/20111129/juno_chuc_rec_111115_111116_v01.bc"
set CHUDCK  = "/ftp/pub/naif/JUNO/misc/fgm/20111129/juno_chud_rec_111115_111116_v01.bc"

set MOBIBCK = "/ftp/pub/naif/JUNO/misc/fgm/20111129/juno_mobib_rec_111115_111116_v01.bc"
set MOBOBCK = "/ftp/pub/naif/JUNO/misc/fgm/20111129/juno_mobob_rec_111115_111116_v01.bc"

set FGMOBCK = "/ftp/pub/naif/JUNO/misc/fgm/20111129/juno_sc2fgmob_zero_110801_171101_v01.bc"
set FGMIBCK = "/ftp/pub/naif/JUNO/misc/fgm/20111129/juno_sc2fgmib_zero_110801_171101_v01.bc"

#
# Set comparison table prefix. The names are have the following pattern
# 
#    PREF_CHECKFRAME_CHAIN1_vs_CHAIN2.txt
#
# e.g. file PREF_fgmob_mobob_vs_sc.txt contains conparison of FGM_OB 
# orientation computed using chains with J2000-references orientation
# for MOB_OB and for SC.
#
set PREF    = "check_asc_cks_v01"

#
# Check FGM orientation for MOB chain vs SC chain. 
#

$FRMDIFF -k  $KERNELS \
        -k2 $FGMOBCK \
        -f1 J2000 \
        -t1 JUNO_FGM_OB \
        -c1 JUNO_SPACECRAFT \
        -c2 JUNO_SPACECRAFT \
        -f  'YYYY-MM-DDTHR:MN:SC ::RND' \
        -s 10 \
        -t dumpea \
        -x degrees \
        $MOBOBCK \
        $SCCK \
        > ${PREF}_fgmob_mobob_vs_sc.txt
        
$FRMDIFF -k  $KERNELS \
        -k2 $FGMIBCK \
        -f1 J2000 \
        -t1 JUNO_FGM_IB \
        -c1 JUNO_SPACECRAFT \
        -c2 JUNO_SPACECRAFT \
        -f  'YYYY-MM-DDTHR:MN:SC ::RND' \
        -s 10 \
        -t dumpea \
        -x degrees \
        $MOBIBCK \
        $SCCK \
        > ${PREF}_fgmib_mobib_vs_sc.txt
       
#
# Check FGM orientation for MOB chain vs CHU chains
#
$FRMDIFF -k  $KERNELS \
        -f1 J2000 \
        -t1 JUNO_FGM_IB \
        -f  'YYYY-MM-DDTHR:MN:SC ::RND' \
        -s 10 \
        -t dumpea \
        -x degrees \
        $MOBIBCK \
        $CHUDCK \
        > ${PREF}_fgmib_mobib_vs_chud.txt
        
$FRMDIFF -k  $KERNELS \
        -f1 J2000 \
        -t1 JUNO_FGM_IB \
        -f  'YYYY-MM-DDTHR:MN:SC ::RND' \
        -s 10 \
        -t dumpea \
        -x degrees \
        $MOBIBCK \
        $CHUCCK \
        > ${PREF}_fgmib_mobib_vs_chuc.txt
        
$FRMDIFF -k  $KERNELS \
        -f1 J2000 \
        -t1 JUNO_FGM_OB \
        -f  'YYYY-MM-DDTHR:MN:SC ::RND' \
        -s 10 \
        -t dumpea \
        -x degrees \
        $MOBOBCK \
        $CHUBCK \
        > ${PREF}_fgmob_mobob_vs_chub.txt

$FRMDIFF -k  $KERNELS \
        -f1 J2000 \
        -t1 JUNO_FGM_OB \
        -f  'YYYY-MM-DDTHR:MN:SC ::RND' \
        -s 10 \
        -t dumpea \
        -x degrees \
        $MOBOBCK \
        $CHUACK \
        > ${PREF}_fgmob_mobob_vs_chua.txt

#
# Check FGM orientation for pairs of CHU chains.
#
$FRMDIFF -k  $KERNELS \
        -f1 J2000 \
        -t1 JUNO_FGM_IB \
        -f  'YYYY-MM-DDTHR:MN:SC ::RND' \
        -s 10 \
        -t dumpea \
        -x degrees \
        $CHUDCK \
        $CHUCCK \
        > ${PREF}_fgmib_chud_vs_chuc.txt
        
$FRMDIFF -k  $KERNELS \
        -f1 J2000 \
        -t1 JUNO_FGM_OB \
        -f  'YYYY-MM-DDTHR:MN:SC ::RND' \
        -s 10 \
        -t dumpea \
        -x degrees \
        $CHUBCK \
        $CHUACK \
        > ${PREF}_fgmob_chub_vs_chua.txt
        
#
# Check SC orientation for pairs of CHU chains.
#
$FRMDIFF -k  $KERNELS \
        -f1 J2000 \
        -t1 JUNO_SPACECRAFT \
        -f  'YYYY-MM-DDTHR:MN:SC ::RND' \
        -s 10 \
        -t dumpea \
        -x degrees \
        $CHUDCK \
        $CHUACK \
        > ${PREF}_sc_chud_vs_chua.txt
        
$FRMDIFF -k  $KERNELS \
        -f1 J2000 \
        -t1 JUNO_SPACECRAFT \
        -f  'YYYY-MM-DDTHR:MN:SC ::RND' \
        -s 10 \
        -t dumpea \
        -x degrees \
        $CHUDCK \
        $CHUBCK \
        > ${PREF}_sc_chud_vs_chub.txt
        
$FRMDIFF -k  $KERNELS \
        -f1 J2000 \
        -t1 JUNO_SPACECRAFT \
        -f  'YYYY-MM-DDTHR:MN:SC ::RND' \
        -s 10 \
        -t dumpea \
        -x degrees \
        $CHUCCK \
        $CHUACK \
        > ${PREF}_sc_chuc_vs_chua.txt

$FRMDIFF -k  $KERNELS \
        -f1 J2000 \
        -t1 JUNO_SPACECRAFT \
        -f  'YYYY-MM-DDTHR:MN:SC ::RND' \
        -s 10 \
        -t dumpea \
        -x degrees \
        $CHUCCK \
        $CHUBCK \
        > ${PREF}_sc_chuc_vs_chub.txt
        
#
# Check SC orientation for two MOB chains.
#
$FRMDIFF -k  $KERNELS \
        -f1 J2000 \
        -t1 JUNO_SPACECRAFT \
        -f  'YYYY-MM-DDTHR:MN:SC ::RND' \
        -s 10 \
        -t dumpea \
        -x degrees \
        $MOBOBCK \
        $MOBIBCK \
        > ${PREF}_sc_mobob_vs_mobib.txt

#
# All done.
#
exit
