#- Version # # 1.0.0 -- PHX/GrnVly_LLB_102407 -- December 27, 2007 # # Initial version; based on MER-1/2 aliases. # # #- Contact Information # # Boris Semenov, 1-818-354-8135, Boris.Semenov@jpl.nasa.gov # #- Abstract # # This file contains UNIX c- or tc-shell aliases providing short cuts # for the common time conversions supported by SPICE's CHRONOS # utility, applicable to PHX. # # Majority of the PHX time conversion aliases have form: # # from2to # # where [from] and [to] is any of the following time system/types: # # Acronym Description # --------- -------------------------------------------------- # lmst Local Mean Solar Time (LMST) # ltst Local True Solar Time (LTST) # scet UTC Spacecraft Event Time (UTC SCET) # ert UTC Earth Receive Time (UTC ERT) # sclk Spacecraft on-board Clock (SCLK), byte-based # sclkd Spacecraft on-board Clock (SCLK), decimal # # For example: # # lmst2scet from LMST to UTC SCET for PHX # scet2sclk from UTC SCET to SCLK for PHX # # Aliases are also provided for the following "special" conversions: # # scet2ett between UTC SCET and UTC Earth Transmit Time (ETT) # ett2scet # # scet2et between UTC SCET and Ephemeris Time (ET) expressed # et2scet as ephemeris seconds past J2000 # # scet2doy between UTC SCET in month/day and UTC in DOY formats # doy2scet # # sclk2hex between SLCK in decimal and hexadecimal # hex2sclk representation # # scet2lsun computes L-sub-S for given UTC SCET # # scet2lt computes one way light time for given UTC SCET # # scet2pst computes PST and PDT for given UTC SCET # scet2pdt # # scet2pstert computes PST/ERT for a given UTC SCET # # scet2pdtert computes PDT/ERT for a given UTC SCET # # Two auxiliary aliases are provided to display kernels used by CHRONOS: # # chronos.sclk displays original SCLK name # chronos.kernels display all kernels used by CHRONOS # # #- Environment # # These variables contain complete path to the normal and LMST # CHRONOS setup files # setenv PHX_LMST_CHRONOS_SETUP "/home/bsemenov/phoenix/chronos/setups/chronos_lmst.phx_grnvlyllb" setenv PHX_LTST_CHRONOS_SETUP "/home/bsemenov/phoenix/chronos/setups/chronos.phx_grnvlyllb" setenv CHRONOS_EXECUTABLE "/naif/toolkit/exe/chronos" # #- Aliases # # From LMST to all other other time systems. # # To convert from LMST to other time systems CHRONOS must be run twice # and the LMST should be pre-parsed to look like SCLK string. # alias lmst2ltst \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from et -fromtype seconds -to lst -nolabel -time `echo \!* | sed "s/SOL/ /g" | sed "s/sol/ /g" | $CHRONOS_EXECUTABLE -setup $PHX_LMST_CHRONOS_SETUP -from sclk -to et -totype seconds -nolabel -batch`' alias lmst2scet \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from et -fromtype seconds -to utc -nolabel -time `echo \!* | sed "s/SOL/ /g" | sed "s/sol/ /g" | $CHRONOS_EXECUTABLE -setup $PHX_LMST_CHRONOS_SETUP -from sclk -to et -totype seconds -nolabel -batch`' alias lmst2ert \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from et -fromtype seconds -to utc -totype ert -nolabel -time `echo \!* | sed "s/SOL/ /g" | sed "s/sol/ /g" | $CHRONOS_EXECUTABLE -setup $PHX_LMST_CHRONOS_SETUP -from sclk -to et -totype seconds -nolabel -batch`' alias lmst2sclk \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from et -fromtype seconds -to sclk -nolabel -time `echo \!* | sed "s/SOL/ /g" | sed "s/sol/ /g" | $CHRONOS_EXECUTABLE -setup $PHX_LMST_CHRONOS_SETUP -from sclk -to et -totype seconds -nolabel -batch`' # # From all other time systems to LMST. # # To convert from other time systems to LMST CHRONOS must be run twice # and the LMST should be post-parsed to look like 'SOL # HR:MN:SC' string. # alias ltst2lmst \ '$CHRONOS_EXECUTABLE -setup $PHX_LMST_CHRONOS_SETUP -from et -fromtype seconds -to sclk -nolabel -time `$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from lst -to et -totype seconds -nolabel -time \!*` | sed "s/1\/\0\{1,5\}/SOL /g" | sed "s/\:/ /"' alias scet2lmst \ '$CHRONOS_EXECUTABLE -setup $PHX_LMST_CHRONOS_SETUP -from et -fromtype seconds -to sclk -nolabel -time `$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -to et -totype seconds -nolabel -time \!*` | sed "s/1\/\0\{1,5\}/SOL /g" | sed "s/\:/ /"' alias ert2lmst \ '$CHRONOS_EXECUTABLE -setup $PHX_LMST_CHRONOS_SETUP -from et -fromtype seconds -to sclk -nolabel -time `$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -fromtype ert -to et -totype seconds -nolabel -time \!*` | sed "s/1\/\0\{1,5\}/SOL /g" | sed "s/\:/ /"' alias sclk2lmst \ '$CHRONOS_EXECUTABLE -setup $PHX_LMST_CHRONOS_SETUP -from et -fromtype seconds -to sclk -nolabel -time `$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from sclk -to et -totype seconds -nolabel -time \!* ` | sed "s/1\/\0\{1,5\}/SOL /g" | sed "s/\:/ /"' # # Between all time systems EXCEPT LMST. # # These conversions require a single CHRONOS run without pre- or # post-parsing. # # # From LTST to other time systems EXCEPT LMST. # alias ltst2scet \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from lst -to utc -nolabel -time ' alias ltst2ert \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from lst -to utc -totype ert -nolabel -time ' alias ltst2sclk \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from lst -to sclk -nolabel -time ' # # From SCET to other time systems EXCEPT LMST. # alias scet2ltst \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -to lst -nolabel -time ' alias scet2ert \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -to utc -totype ert -nolabel -time ' alias scet2sclk \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -to sclk -nolabel -time ' # # From ERT to other time systems EXCEPT LMST. # alias ert2ltst \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -fromtype ert -to lst -nolabel -time ' alias ert2scet \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -fromtype ert -to utc -nolabel -time ' alias ert2sclk \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -fromtype ert -to sclk -nolabel -time ' # # From SCLK to other time systems EXCEPT LMST. # alias sclk2ltst \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from sclk -to lst -nolabel -time ' alias sclk2scet \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from sclk -to utc -nolabel -time ' alias sclk2ert \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from sclk -to utc -totype ert -nolabel -time ' # # Special aliases # alias scet2ett \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -to utc -totype ett -nolabel -time ' alias ett2scet \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -fromtype ett -to utc -nolabel -time ' alias scet2et \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -to et -totype seconds -nolabel -time ' alias et2scet \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from et -fromtype seconds -to utc -nolabel -time ' alias scet2doy \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -to utc -format YYYY-DOY//HR:MN:SC.\#\#\# ::RND -nolabel -time ' alias doy2scet \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -to utc -format YYYY-MM-DD HR:MN:SC.\#\#\# ::RND -nolabel -time ' alias sclk2hex \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from sclk -to sclk -totype hex -nolabel -time ' alias hex2sclk \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from sclk -fromtype hex -to sclk -nolabel -time ' alias scet2lsun \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -to lst -totype lsun -nolabel -time ' alias scet2lt \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -to utc -totype lt -nolabel -time ' alias scet2pst \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -to utc -format YYYY-MM-DD HR:MN:SC.\#\#\# ::RND ::UTC-8 PST -nolabel -time ' alias scet2pdt \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -to utc -format YYYY-MM-DD HR:MN:SC.\#\#\# ::RND ::UTC-7 PDT -nolabel -time ' # # Going from "decimal" SCLK to all other except LMST: # # - expects input like "N/SSSSSSSSS.DDDD..." or "SSSSSSSSS.DDDD..." # - run sed to remove partition (if present) # - run sed to replace "." with " 0." # - run awk to convert integer and decimal second to "normal" SCLK # - run CHRONOS with LTST setup to convert to output time system # alias sclkd2scet \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from sclk -to utc -nolabel -time `echo \!* | sed "s/[0-9]\///g" | sed "s/\./ 0\./g" | awk '"'"'{printf ("%010d:%03.0f\n",$1,$2*256)}'"'"'`' alias sclkd2ert \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from sclk -to utc -totype ert -nolabel -time `echo \!* | sed "s/[0-9]\///g" | sed "s/\./ 0\./g" | awk '"'"'{printf ("%010d:%03.0f\n",$1,$2*256)}'"'"'`' alias sclkd2sclk \ 'echo \!* | sed "s/[0-9]\///g" | sed "s/\./ 0\./g" | awk '"'"'{printf ("%010d:%03.0f\n",$1,$2*256)}'"'" alias sclkd2ltst \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from sclk -to lst -nolabel -time `echo \!* | sed "s/[0-9]\///g" | sed "s/\./ 0\./g" | awk '"'"'{printf ("%010d:%03.0f\n",$1,$2*256)}'"'"'`' # # Going from "decimal" SCLK to LMST: # # - run sed to remove partition (if present) # - run sed to replace "." with " 0." # - run awk to convert integer and decimal second to "normal" SCLK # - run CHRONOS with LTST setup to convert to ET seconds # - run CHRONOS with LMST setup to convert to LMST express as SCLK # - run sed to replace partition, "1/", with "SOL " # - run sed replace first ":" with blank to make output look like # "SOL DDD HR:MN:SC" # alias sclkd2lmst \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from sclk -to et -totype seconds -nolabel -time `echo \!* | sed "s/[0-9]\///g" | sed "s/\./ 0\./g" | awk '"'"'{printf ("%010d:%03.0f\n",$1,$2*256)}'"'"'` | $CHRONOS_EXECUTABLE -setup $PHX_LMST_CHRONOS_SETUP -from et -fromtype seconds -to sclk -nolabel -batch | sed "s/1\/\0\{1,5\}/SOL /g" | sed "s/\:/ /"' # # Going all other except LMST to "decimal" SCLK: # # - run CHRONOS with LTST setup to convert from input time to SCLK # - run sed to replace partition separator, "/", with " " # - run sed to replace field separator, ".", with " " # - run awk to convert three tokens of "normal" SCLK to integer and # decimal SCLK # - output looks like "N/SSSSSSSSS.DDD" or "SSSSSSSSS.DDD" # alias scet2sclkd \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -to sclk -nolabel -time \!* | sed "s/\// /g" | sed "s/\./ /g" | awk '"'"'{printf ("%010d.%03.0f\n",$2,$3/256*1000)}'"'" alias ert2sclkd \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -fromtype ert -to sclk -nolabel -time \!* | sed "s/\// /g" | sed "s/\./ /g" | awk '"'"'{printf ("%010d.%03.0f\n",$2,$3/256*1000)}'"'" alias sclk2sclkd \ 'echo \!* | sed "s/\// /g" | sed "s/\./ /g" | awk '"'"'{printf ("%010d.%03.0f\n",$2,$3/256*1000)}'"'" alias ltst2sclkd \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from lst -to sclk -nolabel -time \!* | sed "s/\// /g" | sed "s/\./ /g" | awk '"'"'{printf ("%010d.%03.0f\n",$2,$3/256*1000)}'"'" # # Going from LMST to "decimal" SCLK: # # - run sed to remove SOL marker (twice, for lowercase and uppercase) # - run CHRONOS with LMST setup to convert LMST in SLCK form to ET seconds # - run CHRONOS with LTST setup to convert ET to "normal" SCLK # - run sed to replace partition separator, "/", with " " # - run sed to replace field separator, ".", with " " # - run awk to convert three tokens of "normal" SCLK to integer and # decimal SCLK # - output looks like "N/SSSSSSSSS.DDD" or "SSSSSSSSS.DDD" # alias lmst2sclkd \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from et -fromtype seconds -to sclk -nolabel -time `echo \!* | sed "s/SOL/ /g" | sed "s/sol/ /g" | $CHRONOS_EXECUTABLE -setup $PHX_LMST_CHRONOS_SETUP -from sclk -to et -totype seconds -nolabel -batch` | sed "s/\// /g" | sed "s/\./ /g" | awk '"'"'{printf ("%010d.%03.0f\n",$2,$3/256*1000)}'"'" # # Two auxiliary aliases are provided to display kernels used by CHRONOS. # In 'chronos.kernels' the output of CHRONOS run with -trace option is # post-formatted to be a file list, one per line. In 'chronos.sclk' the # original SCLK name is pulled out of the comments of the SCLK file, the # name of which is extracted from CHRONOS/-trace output. # alias chronos.kernels \ 'chronos -setup $PHX_LTST_CHRONOS_SETUP -from utc -to utc -time "2003 jan 1 12:00" -trace | grep -v "Actual command line" | egrep -i "\/phoenix\/|\/phx\/" | sed '"'"'s/SPK\: //g'"'"' | sed '"'"'s/TEXT\: //g'"'"' | awk '"'"'{print $1}'"'" alias chronos.sclk \ 'grep FILE_NAME `chronos -setup $PHX_LTST_CHRONOS_SETUP -from utc -to utc -time "2003 jan 1 12:00" -trace | egrep "\/sclk\/phx\.tsc|\/PHX_SCLKSCET\......\.tsc"` | grep -v ";" | awk '"'"'{print $3}'"'" # # Aliases to convert from UTC SCET to PST/ERT and PDT/ERT. # alias scet2pstert \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -to utc -totype ert -format YYYY-MM-DD HR:MN:SC.\#\#\# ::RND ::UTC-8 PST -nolabel -time ' alias scet2pdtert \ '$CHRONOS_EXECUTABLE -setup $PHX_LTST_CHRONOS_SETUP -from utc -to utc -totype ert -format YYYY-MM-DD HR:MN:SC.\#\#\# ::RND ::UTC-7 PDT -nolabel -time '