Skip to content

das3_spice

C. Piker edited this page Sep 3, 2024 · 11 revisions

Streaming SPICE data injector and manipulator

Name

das3_spice - Modify das streams using SPICE kernels

Synopsis

das3_spice META_KERNEL [options] ...

Description

das3_spice is a filter, it reads a das2 or das3 stream containing time coordinates on standard input, modifies values and structures using SPICE information, and writes a das3 stream to standard output.

A SPICE meta-kernel file is always required as a parameter. In addition at least one SPICE operation must be provided on the command line.

Three types of operations are supported:

  • -I -> Just print meta-kernel information
  • -L -> Add body (typically spacecraft) location vectors in a given frame
  • -R -> Rotate vector variables into a new coordinate frame

The last two operations are described in successive sections below.

Adding Location Coordinates (Ephemerides)

To add location information in a given coordinate FRAME, provide command line arguments of the form:

   -L [BODY:]OUT_FRAME[,SYSTEM]

The BODY is the object whose location is desired. If omitted das3_spice will look for the "naifHostId", or failing that "instrumentHost" in the stream properties. If neither of those are present, das3_spice exits with an error.

The OUT_FRAME is the name of any SPICE frame, either built-in, or provided by the meta-kernel file. To list all defined frames use the '-L' option.

The coordinate SYSTEM is not required. If omitted, cartesian coordinates are assumed. The following list of coordinate systems are supported:

System Name Description
(cart)esian Cartesian x, y, z (the default)
(cyl)drical ISO 31-11 ρ, ϕ, z
(sph)erical ISO 31-11 r, θ, ϕ (θ = colatitude, north pole is at 0°)
planeto(centric) Spherical r, ϕ, θ' (θ' = latitude, positive longitude to the east)
planeto(detic) Ellipsoidal ϕ, θ',r' (θ' = latitude, positive longitude to the east, r' = altitude above the geode)
planeto(graphic) Ellipsoidal ϕ, θ',r' (θ' = latitude, positive longitude to the west, r' = altitude above the geode)

Full names can be used, but just the portion in parenthesis is sufficient.

The output stream will have location values added to each packet. These will be defined by adding additional <coord> elements to each <dataset>. The -L argument can be given multiple times to add additional location coordinates to the stream.

Rotating Coordinate and Data Vectors

To rotate vectors to another SPICE frame, provide command line arguments of the form:

  -R [IN_FRAME:]OUT_FRAME[,SYSTEM]

The IN_FRAME and colon are not required. If omitted das3_spice will attempt to rotate all vectors in the input stream to the given OUT_FRAME. Coordinate vectors added via das3_spice are not candidates for rotation, since this would be redundant.

The SYSTEM section defines the vector components to emit. SYSTEM can be one of:

  • (cart)esian
  • (cyl)indrical
  • (sph)erical

By default, any matching input coordinate vectors or data vectors are rotated and the original values are dropped from the stream. To change this behavior use '-k' to "keep" inputs. To only rotate either <coord> or <data> values, use '-c' or '-d'.

Rotation operations will not work for das2 streams because these do not have the concept of a geometric vector. Run das2 streams through das3_vec first to define input vectors from sets of scalers.

Angle Units

To avoid confusion, all angles are always output in decimal degrees. These are easiest to check by eye, and doesn't involve multiple fields such as arc-minutes and arc-seconds.

Options

-h, --help

Write this text to standard output and exit.

-l LEVEL, --log=LEVEL

Set the logging level, where LEVEL is one of 'debug', 'info', 'warning', 'error' in order of decreasing verbosity. All log messages go to the standard error channel. Defaults to 'info'.

-a IN_FRAME, --anon-frame=IN_FRAME

If the input stream has anonymous vector frames, assume they are in this frame.

-b MB, --buffer=MB

Normally das3_spice writes one output packet for each input packet. For better performance, use this option to batch process up to MB megabytes of data before each write. The special values 'inf', 'infinite' or '∞' can be used to only write packets after the input stream completes.

-c, --coords

Only rotate matching coordinate vectors, ignore data vectors.

-d, --data

Only rotate data vectors, ignore matching coordinate vectors.

-k, --keep

By default, the original input vectors are not emitted on the output stream, but this option may be used to preserve the original vectors alongside the rotated items.

-p [TYPE:]NAME=VALUE, --prop [TYPE:]NAME=VALUE

Add property NAME to the output stream header of the given TYPE with the given VALUE. If TYPE is missing, it defaults to "string". See the dasStream 3.0 definition document for details.

-I, --info

Just print all frames defined in the given meta-kernel to the standard error channel and exit.

-L [BODY:]OUT_FRAME[,SYSTEM], --locate=BODY:OUT_FRAME[,SYSTEM]

Add location data to the stream for the given BODY in the given SPICE frame. BODY may be an integer SPICE body ID code or a text string, and is usually a spacecraft name such as Cassini. The option may be given more then once. Each instance adds a new coordinate vector variable to the stream. See the DESCRIPTION section above for details.

-R [IN_FRAME:]OUT_FRAME[,SYSTEM], --rotate=[IN_FRAME:]OUT_FRAME[,SYSTEM]

Rotate all or some input vectors to the given SPICE frame. May be given more then once. See the DESCRIPTION section above for details.

Examples

  1. Just see what frames are defined in a given metakernel:

    das3_spice -L my_metakernel.tm
    
  2. Add IAU_JUPITER planetocentric coordinates to Juno/Waves streams:

    das_reader | das3_spice juno_metakern.tm -L JUNO:IAU_JUPITER,centric
    
  3. Convert TRACERS/MAG data vectors from the any loaded coordiante system into the TRACERS Sun Sychronous (TSS) frame and write the results to a CDF file:

    das_reader | das3_spice tra_metakern.tm -R TSS | das3_cdf -o ./
    

Addendum

See Also

Source: das3_spice.c

Author: C. Piker