# CODA SP3 Mapping Description

CODA provides access to SP3 data. This is done by importing the full file and providing access to an in-memory structure of the data via the CODA data types. Below we will describe how CODA maps the SP3 product structure to one that is based on the CODA data types. We assume you already have a decent understanding of the SP3 format and its details.

A SP3 file consists of a header section followed by a series of epoch data records. Each epoch data record contains the epoch and, for each satellite, a Position and Clock Record and (depending on the Position/Velocity Flag field in the header) a Velocity and Clock Rate-of-Change Record. Both records can be accompanied by a Correlation record.

CODA will try to provide as direct a mapping to the SP3 data as possible. This means that the in memory data structure will follow to a large extend the order in which data is stored in the file. Below the mapping for the SP3 data is provided.

The following table gives the mapping of header sections to CODA parameters

CODA path to variable | type class | read type
--- | --- | ---
/header/pos_vel | string | char
/header/datetime_start | time | double
/header/num_epochs | integer | int32
/header/data_used | text | string
/header/coordinate_sys | text | string
/header/orbit_type | text | string
/header/agency | text | string
/header/gps_week | integer | int16
/header/sec_of_week | real | double
/header/epoch_interval | real | double
/header/mjd_start | integer | int32
/header/frac_day | real | double
/header/num_satellites | integer | uint8
/header/sat_id[] | text | string
/header/sat_accuracy[] | integer | int16
/header/file_type | text | string
/header/time_system | text | string
/header/base_pos_vel | real | double
/header/base_clk_rate | real | double

The following table gives the mapping of the epoch records structure to CODA parameters. An SP3 file can contain multiple epoch records. Each epoch record contains the epoch (datetime start) and a maximum of four records per satellite: Position and Clock Record, Position and Clock Correlation Record (included as an optional `corr` field in the Position and Clock Record), Velocity and Clock Rate-of-Change Record, and Velocity and Clock Rate-of-Change Correlation Record (included as an optional `corr` field in the Velocity and Clock Rate-of-Change Record). Note that CODA will not convert any of the values that are stored as exponent-encoded values for you (e.g. the standard deviation values). Any blank integer or floating point values will be set to 0 when read.

CODA path to variable | type class | read type
--- | --- | ---
/record[]/epoch | time | double
/record[]/pos_clk[]/vehicle_id | text | char
/record[]/pos_clk[]/x_coordinate | real | double
/record[]/pos_clk[]/y_coordinate | real | double
/record[]/pos_clk[]/z_coordinate | real | double
/record[]/pos_clk[]/clock | real | double
/record[]/pos_clk[]/x_sdev | integer | int8
/record[]/pos_clk[]/y_sdev | integer | int8
/record[]/pos_clk[]/z_sdev | integer | int8
/record[]/pos_clk[]/clock_sdev | integer | int16
/record[]/pos_clk[]/clock_event_flag | string | char
/record[]/pos_clk[]/clock_pred_flag | string | char
/record[]/pos_clk[]/maneuver_flag | string | char
/record[]/pos_clk[]/orbit_pred_flag | string | char
/record[]/pos_clk[]/corr/x_sdev | integer | int16
/record[]/pos_clk[]/corr/y_sdev | integer | int16
/record[]/pos_clk[]/corr/z_sdev | integer | int16
/record[]/pos_clk[]/corr/clock_sdev | integer | int32
/record[]/pos_clk[]/corr/xy_corr | integer | int32
/record[]/pos_clk[]/corr/xz_corr | integer | int32
/record[]/pos_clk[]/corr/xc_corr | integer | int32
/record[]/pos_clk[]/corr/yz_corr | integer | int32
/record[]/pos_clk[]/corr/yc_corr | integer | int32
/record[]/pos_clk[]/corr/zc_corr | integer | int32
/record[]/vel_rate[]/vehicle_id | text | char
/record[]/vel_rate[]/x_velocity | real | double
/record[]/vel_rate[]/y_velocity | real | double
/record[]/vel_rate[]/z_velocity | real | double
/record[]/vel_rate[]/clock_rate | real | double
/record[]/vel_rate[]/xvel_sdev | integer | int8
/record[]/vel_rate[]/yvel_sdev | integer | int8
/record[]/vel_rate[]/zvel_sdev | integer | int8
/record[]/vel_rate[]/clkrate_sdev | integer | int16
/record[]/vel_rate[]/corr/xvel_sdev | integer | int16
/record[]/vel_rate[]/corr/yvel_sdev | integer | int16
/record[]/vel_rate[]/corr/zvel_sdev | integer | int16
/record[]/vel_rate[]/corr/clkrate_sdev | integer | int32
/record[]/vel_rate[]/corr/xy_corr | integer | int32
/record[]/vel_rate[]/corr/xz_corr | integer | int32
/record[]/vel_rate[]/corr/xc_corr | integer | int32
/record[]/vel_rate[]/corr/yz_corr | integer | int32
/record[]/vel_rate[]/corr/yc_corr | integer | int32
/record[]/vel_rate[]/corr/zc_corr | integer | int32