MESSENGER Magnetometer EDR-to-CDR Processing Version 2d 14 June 2011 Prepared by Haje Korth and Brian Anderson The Johns Hopkins University Applied Physics Laboratory Laurel, MD 21784 USA Change Log DATE SECTIONS CHANGED REASON FOR CHANGE REVISION 6/14/11 Change Log Added change log. V2d 6/14/11 12 Added information on changes incorporated in processing code versions 1.4, 1.5, and 1.6. V2d Table of Contents 1 Purpose 4 2 Introduction 4 3 Coordinate Systems 4 3.1 Sensor and Spacecraft Coordinates 4 3.2 J2000 Coordinates 5 3.3 Mercury Solar Orbital (MSO) Coordinates 5 3.4 Mercury Body Fixed (MBF) Coordinates 5 3.5 Radial-Tangential-Normal (RTN) Coordinates 6 4 SPICE Kernels 6 5 Time Latency Correction 7 6 Heater Correction 8 7 Absolute Calibration and Relative Alignment 9 8 UTC Conversion 10 9 Spacecraft Position Determination 10 9.1 Cartesian Coordinates 10 9.2 Spherical Coordinates 11 10 Coordinate System Transformation 11 11 Data Quality 12 12 Version History 13 13 References 14 1 Purpose This document provides a preliminary description of the conversion of MESSENGER Magnetometer Experimental Data Records (EDRs) to Calibrated Data Records (CDRs). The processing steps described in this document represent the state of knowledge at the date of this document. This document will be updated as appropriate when major increments in CDR generation occur and which warrant re-delivery to PDS and will eventually be replaced by the peer- reviewed in-flight calibration description. 2 Introduction The Science EDRs are the raw data records used to derive magnetic field data used for scientific analysis. The Science EDRs contain 3-axis field samples from the magnetometer at the commanded sample rate as well as the Mission Elapsed Time (MET) and a range flag indicating the dynamic range the magnetometer operated in at the time of the observation. There are two dynamic ranges, a fine range of ?1,530 nT (range flag 0) and a coarse range of ?51,300 nT (range flag 1). Before the science data can be used for scientific analysis, the count rates in the EDRs must be converted to physical units and the data must be transformed into meaningful physical reference systems. This conversion yields calibrated data which are stored in Calibrated Data Records or CDRs. The processing steps from the EDR to the CDR level are described in this document and include: (1) the accounting of time latency between the registered and actual times of the observation and conversion from spacecraft mission elapsed time (MET) to UTC; (2) subtraction of the magnetometer DC offsets for the three axes; (3) conversion from engineering units to physical units; (4) coordinate transformation from sensor to spacecraft coordinates and to other physical interplanetary and planetary reference frames; (5) assignment of a data quality flag to the observations. 3 Coordinate Systems The calibrated data are transformed into several coordinate systems necessary for scientific analysis: J2000 inertial, Mercury Solar Orbital (MSO), Mercury Body Fixed (MBF), and Radial-Tangential-Normal (RTN). These coordinate systems are defined as follows. Position data in each system is included in the CDR products for J2000, MSO, MBF, and RTN coordinates. 3.1 Sensor and Spacecraft Coordinates Sensor and spacecraft coordinates are defined as shown in Figure 1. In the spacecraft coordinate system, the Y-axis is parallel to the magnetometer boom axis with +Y directed from the spacecraft toward the MAG sensor; the X axis is parallel to the solar array rotation axis; the Z axis is orthogonal to X and Y and +Z points outward from the spacecraft adapter ring, and the +X direction completes the right handed system. The sensor axes are oriented nearly parallel to the spacecraft axes. The transformation between the two coordinate systems is reported in the magnetometer instrument paper [Anderson et al., 2007]. CDRs are provided in both sensor and spacecraft coordinates. The CDR products also include the magnetometer range and sample rate. 3.2 J2000 Coordinates In this coordinate system, the +X-axis points toward the mean vernal equinox, +Z points along the mean rotation axis of the Earth on 1 Jan 2000 at 12:00:00.00 Barycentric Dynamical Time (TDB), which corresponds to JD 2451545.0 TDB, and Y completes the right-handed system. 3.3 Mercury Solar Orbital (MSO) Coordinates In this coordinate system, the +X-axis points from Mercury center toward the Sun, +Z points northward perpendicular to Mercury's orbit plane, and Y completes the right hand system nominally directed opposite Mercury's orbital velocity around the Sun. SPICE constructs the MSO coordinate system in the following manner: it computes the position of the Sun as viewed from Mercury and labels this as the +X-axis. Then it computes the projection of the velocity of Mercury as viewed from the Sun into the plane normal to the already defined X-axis and forces this to be the -Y-axis of the MSO frame. The Z-axis is defined by completing the right-handed axes triple (i.e. the cross product of X with Y). The Venus-centered Venus solar orbital (VSO) coordinate system is similarly defined. 3.4 Mercury Body Fixed (MBF) Coordinates The MBF coordinate system is defined by the planetocentric position, Cartesian X, Y, Z coordinates related to the planetocentric distance, r, the latitude, ?, measured positive northward from the equator, and the longitude, ?, measured positive eastward from the prime meridian. The cartesian X, Y, Z coordinates are: xMBF = r*cos(?)*cos(?), yMBF = r*sin(?)*cos(?), zMBF = r*sin(?). The unit eMBF components, exMBF, eyMBF and ezMBF are defined simply as: exMBF = XMBF/r, eyMBF = YMBF/r, ezMBF = ZMBF/r. 3.5 Radial-Tangential-Normal (RTN) Coordinates In RTN coordinates, R points from Sun center to the spacecraft. T is formed by the cross product of the solar rotation axis and R and lies in the solar equatorial plane. N is formed by the cross product of R and T and is the projection of the solar rotational axis on the plane of the sky. 4 SPICE Kernels The MESSENGER project has adopted the SPICE information system to assist science and engineering planning and analysis. SPICE is developed by the Navigation and Ancillary Information Facility (NAIF) under the directions of NASA's Science Directorate. The SPICE toolkit is available in FORTRAN and C at the NAIF web site (http://naif.jpl.nasa.gov). Interfaces to higher-level data analysis software in the Interactive Data Language (IDL) and Matlab are also provided. The MESSENGER MAG CDR processing routines are written exclusively in IDL using the toolkit provided by NAIF. The primary SPICE data sets are kernels. SPICE kernels are composed of navigation and other ancillary information structured and formatted for easy access. SPICE kernels are generated by the most knowledgeable technical contacts for each element of information. Definitions for kernels include or are accompanied by metadata, consistent with flight project data system standards, which provide pedigree and other descriptive information needed by prospective users. The following SPICE kernel files will be used to compute the UTC time and geometric quantities for the MESSENGER MAG instrument: 1. MESSENGER spacecraft ephemeris file, also known as the planetary spacecraft ephemeris kernel (SPK) file. The entire mission trajectory of reconstructed and predicted positions is contained in msgr_20040803_20120401_od###sc.bsp, where ### is the version number of the kernel. 2. MESSENGER spacecraft orientation file, also known as the attitude c-kernel (CK) file. There is one c-kernel for each day contained in the files named msgryyyyddd.bc, where yyyy is the 4-digit year, and ddd is the 3-digit doy. 3. MESSENGER reference frame file, also known as the frame kernel. The kernel msgr_v###.tf, where ### is the 3-digit version number, contains the MESSENGER spacecraft, science instrument, and communication antennae frame definitions. The coordinate system required for scientific analysis MSO and MBF are defined as MSGR_MSO and MSGR_MBF in the kernel msgr_dyn_v###.tf, where ### is the 3-digit version number. The VSO coordinate system is defined as MSGR_VSO. 4. MESSENGER instrument kernel (I-kernel). The kernel msgr_mag_v###.ti, where ### is the 3-digit version number, contains references to mounting alignment, operating modes, and timing as well as internal and field of view geometry for the MESSENGER Magnetometer. 5. MESSENGER spacecraft clock coefficients file, also known as the spacecraft clock kernel (SCLK) file. The clock kernels are named messenger_###.tsc, where ### is the 3-digit version number. 6. Planetary constants file (*.tpc), also known as the planetary constants kernel (pck) file. The current planetary constants kernel is pck00008.tpc. 7. NAIF leap seconds kernel (LSK) file. This kernel is used in conjunction with the SCLK kernel to convert between Universal Time Coordinated (UTC) and MESSENGER Mission Elapsed Time (MET). The current leap seconds kernel is naif0008.tls. Those SPICE kernel files that reflect the spacecraft trajectory, attitude or variable instrument states will be generated throughout the mission with a file-naming convention specified by the MESSENGER project. The variable kernels are updated frequently, and to obtain the most current information for time conversion, coordinate transformation, and the spacecraft position, the most current kernels are loaded prior to processing the EDR files. An automated procedure is used to identify the most current kernel set from information in the kernel file names. This kernel set is listed in the release notes for the produced CDR. 5 Time Latency Correction As described in Anderson et al. [2007], the time stamps in the EDR records are delayed with respect to the actual time of the magnetic field observations due to onboard filtering of the data and intrinsic delay in the instrument feedback response. The net time lag depends on the sample rate and is given in Table 1 from Anderson et al. [2007]. These values listed in the "net lag" column are subtracted from the MET associated with the vector sample in the EDR. 6 Heater Correction A contamination signal associated with the magnetometer heater operation is superimposed on the magnetometer data. An extensive discussion of the origin of this contamination signal is beyond the scope of this document and will be covered in the instrument in-flight calibration paper. The contamination is manifested as an offset shift with the periodicity of the 100-s heater control period. The magnitude and waveform of the offset variations is different for each of the three axes and additionally depends on the heater duty cycle. At the date of this document, the heater correction has been characterized only for the nominal heater duty cycle with the sensor in darkness behind the spacecraft relative to the Sun. During cruise the sensor is in darkness and the heater typically operates at the duty cycle of 40%, i.e., the heater operates at full power for a 40-s period, which is followed by a 60-s interval with the heater turned off. To allow correction of the heater contamination, the heater state (on/off) is transmitted in the MAG Science Header Data (SHD) EDRs at a time resolution of one second corresponding to the one-second command iteration at which this state can be changed. Using these heater state data, the waveform of the contamination signal in all three axes for this particular duty cycle has been determined using superposed epoch analysis and is subtracted from the count rates in the Science EDRs. The correction waveforms are provided in the file sc_htr_fits.txt. Time in these files is given by xhtr which ranges from -1 to 1, corresponding to the time between consecutive heater state transition from off to on. The correction waveforms are applied with a temporal offset to account for a delay between the MAG flight software requesting a change in the heater state and execution of the request by the spacecraft. The magnitude of the timing offset is 10 s plus the latency associated with the current sampling rate (see Section 5). For final calibration of the data, a detailed study of the contamination signal as function of duty cycle will be carried out during cruise. 7 Absolute Calibration and Relative Alignment The conversion from counts to physical units of nano-Tesla is described by Anderson et al. [2007]. Denoting the readings (counts) in the X, Y, and Z axes by cx, cy, and cz and the fixed offsets as cx0, cy0, and cz0, the magnetic field may be expressed in sensor coordinates as where kx, ky, and kz are the gain coefficients for each axis and ?, ?, and ? measure the contributions of X in the Y axis, X in the Z axis, and Y in the Z axis, respectively. The parameters from the ground calibration are shown in Table 2 [Anderson et al., 2007]. The instrument offsets are expected to vary over the course of the mission. For this reason, the fine range offsets are regularly assessed in-flight. The offset evaluations and respective METs are listed in Table 3. The time-dependent offsets are captured in a look-up table for CDR processing. Presently the offsets change abruptly at the METs given in Table 3. In the future it is planned to let the offset vary continuously to avoid discontinuities in the data set. Table 3: MAG fine range offsets. MET Offset (cx0, cy0, cz0) [nT] 000000000.0 3.5, 0.3, 424.2 131133844.0 0.7, -22.3, 422.9 8 UTC Conversion The UTC conversion from MET to UTC is handled by the SPICE toolkit using the following IDL commands: cspice_scs2e, sc_id, met_str, et cspice_timout, et, 'YYYY DOY HR MN SC.###', 21, time_str The routine cspice_scs2e converts the MET into ephemeris time et native to SPICE, whereby the spacecraft ID for MESSENGER is -236. The routine cspice_timout then convert the ephemeris time et to a UTC time string which is associated with the observation. 9 Spacecraft Position Determination 9.1 Cartesian Coordinates The spacecraft position for each MET is returned by the SPICE toolkit using the following IDL commands: cspice_scs2e, sc_id, met_str, et cspice_spkpos, target, et, frame, correction, observer, position, ltime The routine cspice_scs2e converts the MET into ephemeris time native to SPICE using the MESSENGER spacecraft ID which is -236. The routine cspice_spkpos then acquires the position of the spacecraft for the ephemeris time et given the target, frame, light-time correction, and observer. Since we are interested in the UTC at the spacecraft, the position of MESSENGER with respect to the Sun in J2000 coordinates is obtained without light-time correction using: cspice_spkpos, 'MESSENGER', et, 'J2000', 'NONE', 'SUN', position, ltime The position of MESSENGER in the Mercury-centric MSO coordinate system without light-time correction can be obtained using: cspice_spkpos, 'MESSENGER', et, 'MSGR_MSO', 'NONE', 'MERCURY', position, ltime The position of MESSENGER in Mercury body-fixed coordinates without light- time correction can be obtained using: cspice_spkpos, 'MESSENGER', et, 'IAU_MERCURY', 'NONE', 'MERCURY', position, ltime 9.2 Spherical Coordinates When transforming the magnetic field samples to Radial-Tangential-Normal (RTN) coordinates, the spacecraft coordinates are more appropriately represented in the following spherical coordinates: (1) radial distance of the MESSENGER spacecraft from the Sun in units of km; (2) northward latitude of the MESSENGER spacecraft above instantaneous ecliptic plane in units of degrees; (3) Azimuth angle of the MESSENGER spacecraft in the instantaneous ecliptic plane with respect to the Earth-Sun line in units of degrees, positive in direction of the Earth's orbital motion. The components are computed as follows: Radial component: cspice_spkpos,'MESSENGER',et,pframe,'NONE',observer,m_pos,ltime pos_r=cspice_vnorm(m_pos) Northward Latitude: cspice_spkezr,'EARTH',et,pframe,'NONE',observer,state,ltime cspice_vcrss,state[0:2],state[3:5],es_norm pos_lat=90-cspice_vsep(es_norm,m_pos)/!dtor Azimuth: cspice_vperp,state[3:5],state[0:2],ve_espl_proj cspice_psv2pl,state[0:2],state[0:2],state[3:5],es_plane cspice_vprjp,m_pos,es_plane,m_espl_proj sign=sgn(cspice_vdot(ve_espl_proj,m_espl_proj)) pos_az=sign*cspice_vsep(state[0:2],m_espl_proj)/!dtor 10 Coordinate System Transformation The coordinate transformation from MESSENGER MAG sensor coordinates to J2000, MSO, and MBF coordinates is handled by the SPICE toolkit using the following IDL commands: cspice_scs2e, sc_id, met_str, et cspice_pxform, frame1, frame2, et, xform cspice_mxv, xform, b_sensor, b_rot The routine cspice_scs2e converts the MET into ephemeris time native to SPICE, using the spacecraft ID for MESSENGER, -236. The routine cspice_pxform gives the transformation matrix between the coordinate system of origin, frame1, and the target coordinate system, frame2, at a given ephemeris time, et. The coordinate system of origin for MAG after boom deployment is MSGR_MAG. The coordinate system of MAG prior to boom deployment is accessed using MSGR_MAG_STOWED. The target coordinate systems for the CDRs are J2000, MSGR_MSO, IAU_MERCURY, and MSGR_RTN for transformations into J2000, MSO, MBF, and RTN coordinates, respectively. Finally, the cspice_pxform routine performs the actual coordinate system transformation by multiplying the transformation matrix with the observations in the coordinate system of origin. For example, the transformation from the MAG sensor coordinate system into MSO coordinates is executed using: cspice_pxform, 'MSGR_MAG', 'MSGR_MSO', et, xform cspice_mxv, xform, b_sensor, b_mso 11 Data Quality The final step in the conversion of experimental to calibrated data records is the assignment of the data quality flag to the observations. The MAG data quality flag is a three digit code, denoted as SHC, which is defined in Table 4. S indicates the configuration of the sensor. H indicates the sensor survival heater control mode being used. C indicates the presence of contamination in the data and whether contamination, if present, is judged to be correctable to meet the science requirement of 1 nT. For example, a data quality flag of '100' indicates: that the boom was deployed with the sensor facing the sun, that the heater operated in hardware regulation, and that no contamination signals are known to be present. The data quality flag will be assigned via a lookup table, which is maintained during validation of the data set. Table 4: MAG data quality flag definitions. S: Sensor Configuration Definition 0 Sensor stowed - prior to boom deployment 1 Boom deployed - SC +Y axis to Sun - sensor in sunlight 2 Boom deployed - SC -Y axis to Sun - sensor in shadow H: Heater Mode Definition 0 Hardware regulation (MAG FSW V8) 1 Software regulation version 1 (MAG FSW V9) 2 Software regulation version 2 (MAG FSW V10) C: Contamination Definition 0 No contamination signals known to be present 1 Uncorrectable contamination signals present 2 Contamination signals present but correctable 12 Version History The conversion from the EDR to the CDR level is evolutionary. CDR files will be reprocessed if (1) the MAG calibration changes, (2) the MAG team finds it necessary or desirable to change the file format, or (3) when bugs in the processing software are identified. The reprocessed CDR files and the MAG EDR2CDR processing software are both given new version number reflecting the changes. Version numbers for CDRs and processing software may differ from each other. For this reason the version number of the processing software is captured in the CDR label. Below is the summary of the version history of the MAG EDR2CDR processing software. v1.0: * Initial Release v1.1: * Increased precision of position angles for RTN files from F6.1 to F12.7. v1.2: * BUG FIX: The drift between MAG and SC clocks resulted in falsely identified sample rate changes and assigned latencies. * Modified format of MAGTable_Offsets.dat and associated read routine. * Added file names of SCI, SHD, and LAC EDRs to release notes file. * Added MAG offset determination from M2 MAG rolls. v1.3: * Updated msgr_kernel_getcurrent.pro to deal work with 3 and 4-digit version numbers. * Fixed heater correction to include time lag between heater-on request and actual heater turn-on. Affected routines are: msgr_mag_edr2cdr_sci.pro, msgr_mag_correct_latency.pro, and msgr_mag_correct_heater100s.pro. v1.4: * Added processing of burst and AC channel data. * Added handshake with SOC via semaphore file. v1.5: * Added handling of subversioned C-kernels. * Added attitude rate change information to release notes. v1.6: * Added mechanism to automatically reprocess CDR files on arrival of updated C-kernels. 13 References Anderson, B. J. et al., The Magnetometer instrument on MESSENGER, Space Sci. Rev., 131, 417-450, 2007. - 14 -