Mars Reconnaissance Orbiter Software Interface Specification Context Camera (CTX) Standard Data Product M. Caplinger Malin Space Science Systems, Inc. Approved by: _________________________ M. Malin, President _________________________ L. Gaddis, PDS Imaging Node Manager _________________________ E. Grayzeck, PDS Program Manager April 2007 (formatted April 20, 2007) 1. Introduction 1.1. Purpose This document describes the format of the Mars Reconnais- sance Orbiter Context Camera (CTX) Standard Data Product. 1.2. Scope The format and content specifications in this SIS apply to all phases of the project for which this product is avail- able. 1.3. Applicable Documents Mars Exploration Program Data Management Plan, R.E. Arvid- son, S. Slavney, and S. Nelson, Rev. 3.0, March 20, 2002. Mars Reconnaissance Orbiter Project Data Archive Generation, Validation, and Transfer Plan, MRO 31-468, JPL D-22246, Ver- sion 1.1, January 26, 2006. Planetary Data System Standards Reference, Version 3.6, JPL D-7669, Part 2, August 1, 2003. Planetary Science Data Dictionary Document, JPL D-7116, Rev. E, August 28, 2002. 1.4. Functional Description 1.4.1. Data Content Summary Each CTX Standard Data Product is a single image in the raw image format as produced by the instrument. The data have been depacketized, decompressed, and reformatted with stan- dard labels, but are otherwise unprocessed. In that sense these products are most closely analogous to the Experiment Data Record (EDR) products of previous missions. The pro- cessing level of this dataset is CODMAC level 2 (NASA level 0). 1.4.2. Source and Transfer Method CTX products are produced at the CTX Mission Operations Facility (MOF) by the `makepds05' program from the format internally used at the MOF. This program reads a raw CTX image file (in the internal "DDD" format), extracts some information from its headers, formats and attaches the PDS labels, and appends the image data. CTX products are validated at the MOF through visual inspec- tion of the images as well as automated verification of various elements of the image header (e.g., April 2007 1 SPACECRAFT_CLOCK_START_COUNT, LINE_EXPOSURE_DURATION). It is expected that there will be two ways to receive CTX products: by electronic file transfer from the Planetary Data System, and on some archival medium such as CD-ROM or DVD. CTX is expected to return approximately 3.5 Tb over the course of a 26 Tb primary mission (see the MRO Project Data Archive Generation, Validation, and Transfer Plan). Volume returned varies as a function of the available data rate; see the Archive Policy and Data Management Plan for more details. 1.4.3. Recipients and Utilization These products will be available to CTX team members, the MRO science community, the planetary science community, and other interested parties. Descriptions of data rights and proprietary periods are beyond the scope of this document, and are discussed in the Project Archive Policy and Data Transfer Plan, and in unique Operational Interface Agree- ments between the CTX Science Team and other parties. These products will be used for engineering support, direct science analysis, or the construction of other science pro- ducts. 1.5. Assumptions and Constraints Note that this file contains decompressed image data. It is a raw image that is not corrected for instrument signature, effects of spacecraft motion, or the effects of imaging geometry. Although there is enough information in the header to do some processing, for more sophisticated pro- cessing ancillary files will be required. These ancillary files are not described in this document. Every effort will be made to insure that this ancillary information will be conveniently accessible to users of CTX products (for exam- ple, it may be included on the same CDROM volumes as the data products themselves.) Examples of ancillary files are calibration files, viewing geometry files (e.g., SPICE ker- nels), image index tables, etc. 2. Environment 2.1. Instrument Overview CTX is a linescan camera with a 5000-element linear CCD (Kodak KLI-5001G) with 7x7 micron pixels. The CTX telescope is a 350 mm f/3.25 catadioptric with two front and two rear correcting elements. Its field of view is about 5.7 April 2007 2 degrees, covering a 30-km swath from 300 km altitude at a resolution of 6 meters/pixel. Its mechanical structure is a composite configuration in which the metering structure is graphite/cyanate-ester (GR/CE), the primary mirror is Zero- dur, and the elements are mounted in Invar and titanium cells. The dual CCD outputs are amplified about 4x and then digi- tized by two Analog Devices AD1672 analog-to-digital con- verters. All control logic is implemented in a single Actel RT54SX32-SU Field-Programmable Gate Array (FPGA). The instrument uses synchronous DRAMs for image storage. The CTX configuration uses eight devices of 32Mx8 organization, for a total capacity of 256 MB (268,435,456 bytes.) A small SRAM is used to perform 12-to-8 bit companding in the FPGA. The instrument design has been optimized to take a single image, up to the size of the buffer, and transfer it to the spacecraft solid-state recorder memory via the serial inter- face. At 10 Mbit/s effective throughput, this process takes about 4 minutes. The system has an adjustable black level digital-to-analog converter (DAC) and the exposure time per line can vary between 1.27 msec and 132.3 msec in increments of 32.0 usec. Optional 2x2 summing can be commanded. Both lossless and lossy image data compression can be applied by software run- ning in the spacecraft computer. 2.2. Failure Protection, Detection, and Recovery Instrument data from the Raw Science Data Server (RSDS) will be safed temporarily by the PDS Imaging Node until the end of the mission. These archives and depacketized compressed image data will be archived at the CTX MOF. 2.3. End-of-File Conventions End-of-file labeling shall comply with SFDU standards; specifically, fixed-size records are used, the header expli- citly contains the record offset of each subelement of the dataset, and the size of each subelement can be computed from information in the header. 3. Access 3.1. Access Tools Existing PDS image display programs (e.g., NASAView) can display these files. April 2007 3 3.2. Input/Output Protocols None identified. 3.3. Timing and Sequencing Characteristics None. 4. Detailed Interface Specifications 4.1. Labeling and Identification The dataset ID is MRO-M-CTX-2-EDR-L0-V1.0. Each product will have a file name of the form ".IMG", where the ID is not to exceed 27 characters, will start with an alphabetic character, and will consist only of alphanumeric characters. The file name will be unique across all CTX data product files. For mapping-phase images, the ID will be of the form PPP_NNNNNN_TTTT_"X"X_AAHBBB"W", where PPP is a mission phase descriptor, NNNNNN is the orbit number, TTTT is a represen- tation of center latitude (in units of 0.1 degree), X is the command mode ("I" for ITL- or "N" for NIFL-commanded images), AA is the planned center latitude of the image, H is "N" for north or "S" for south, and BBB is the planned center (west) longitude of the image. Case is not signifi- cant; under the Unix operating system, the names will be considered to be in all lower-case. TTTT is measured from the descending equator crossing of orbit NNNNNN: 0 degrees is the descending equator crossing; 90 is the south pole; 180 is ascending equator crossing; and 270 is the north pole. 4.2. Structure and Organization Overview All CTX images must be a multiple of 16 pixels in both width and height. Images are broken up into subimages (also called fragments), and each fragment is transmitted separately. Raw and predictively compressed images are reconstructed by concatenating all of their image fragments and then processing; transform compressed images are pro- cessed a fragment at a time. A CTX data product consists of one image with decompression applied. In the event of data loss caused by packets dropped in the space-to-earth link or in the ground segment of the DSN, a standard first-order correction algorithm has been applied. Selected CTX images may have had additional corrections applied; this archive represents the best avail- able reconstruction at the time of archive production. April 2007 4 PDS_VERSION_ID PDS3 FILE_NAME "filename" RECORD_TYPE FIXED_LENGTH RECORD_BYTES nnnn FILE_RECORDS nn LABEL_RECORDS nn ^IMAGE nn SPACECRAFT_NAME MARS_RECONNAISSANCE_ORBITER INSTRUMENT_NAME "CONTEXT CAMERA" INSTRUMENT_HOST_NAME "MARS RECONNAISSANCE ORBITER" MISSION_PHASE_NAME PSP TARGET_NAME MARS INSTRUMENT_ID CTX PRODUCER_ID MRO_CTX_TEAM DATA_SET_ID "MRO-M-CTX-2-EDR-L0-V1.0" PRODUCT_CREATION_TIME yyyy-mm-ddThh:mm:ss.fff SOFTWARE_NAME "id-string" UPLOAD_ID "version-id" ORIGINAL_PRODUCT_ID "original-product-id" PRODUCT_ID "product-id" START_TIME yyyy-mm-ddThh:mm:ss.fff STOP_TIME yyyy-mm-ddThh:mm:ss.fff SPACECRAFT_CLOCK_START_COUNT "sclk-string" SPACECRAFT_CLOCK_STOP_COUNT "N/A" FOCAL_PLANE_TEMPERATURE ff.fff SAMPLE_BIT_MODE_ID "mode-id" OFFSET_MODE_ID "offset-id" LINE_EXPOSURE_DURATION ff.ffffff SAMPLING_FACTOR ff.f SAMPLE_FIRST_PIXEL nnnn RATIONALE_DESC string DATA_QUALITY_DESC "OK" or "ERROR" ORBIT_NUMBER nnnnn OBJECT IMAGE LINES nnn LINE_SAMPLES nnn LINE_PREFIX_BYTES 0 LINE_SUFFIX_BYTES 0 SAMPLE_TYPE UNSIGNED_INTEGER SAMPLE_BITS 8 SAMPLE_BIT_MASK 2#11111111# CHECKSUM 16#xxxx# END_OBJECT IMAGE END 4.3. Substructure Definition and Format PDS_VERSION_ID The PDS version number for the header format; e.g., PDS3. April 2007 5 FILE_NAME The file name for these products; see above. RECORD_TYPE The record type; always FIXED_LENGTH for these pro- ducts. RECORD_BYTES The number of bytes per record. FILE_RECORDS The total number of records in this file. The last record will be padded with zeros if necessary. LABEL_RECORDS The number of records used for header data. For these products, the same as the LINE_SAMPLES field of the IMAGE object. ^IMAGE A pointer to the starting record of the image object in the file. SPACECRAFT_NAME Always MARS_RECONNAISSANCE_ORBITER. INSTRUMENT_NAME Always "CONTEXT CAMERA". INSTRUMENT_HOST_NAME Always "MARS RECONNAISSANCE ORBITER". MISSION_PHASE_NAME Name of the mission phase; e.g., PSP. TARGET_NAME The name of the target body; typically MARS. INSTRUMENT_ID Always CTX. PRODUCER_ID Always MRO_CTX_TEAM. DATA_SET_ID MRO-M-CTX-2-EDR-L0-V1.0. PRODUCT_CREATION_TIME Time and date of this file's creation. Note that this time is the time of this file's creation in this for- mat, and does not reflect the acquisition time or the time of any other processing that may be associated with this product. April 2007 6 SOFTWARE_NAME Identifier of the version of the CTX Ground Data System software that created this product. UPLOAD_ID Identifier of the command file used to acquire this image. ORIGINAL_PRODUCT_ID Product ID of this image received from the spacecraft. For example, "4A_04_1009013100". PRODUCT_ID This uniquely identifies this CTX product among all CTX products. The CTX product ID format is PPP_NNNNNN_TTTT_"X"X_AAHBBB"W", where PPP is a string describing the mission subphase, NNNNNN is the orbit number, TTTT is a representation of center latitude (in units of 0.1 degree), X is the command mode ("I" for ITL or "N" for NIFL), AA is the planned center latitude of the image, H is "N" for north or "S" for south, and BBB is the planned center (west) longitude of the image; e.g., "P01_001330_1221_XN_57S223W". There are two ways to command CTX images: by the Interactive Tar- get List (ITL) mechanism, and by Non-Interactive File Load (NIFL). The image numbers between ITL images and NIFL images may be disjoint, and the mission subphase used for ITLs will be the same as the corresponding mission subphase for NIFLs. For cruise phase (CRU) images, NNNNNN is a sequential image number. START_TIME SCET (UTC) time at start of image acquisition, as com- manded. STOP_TIME SCET (UTC) time at end of image acquisition, as com- manded. SPACECRAFT_CLOCK_START_COUNT Value of spacecraft clock at the actual start of image acquisition. There may be small inconsistencies with START_TIME due to varying correlation between UTC and the spacecraft clock. For purposes of data analysis the spacecraft clock value should be used. The format of this field is compatible with the NAIF Toolkit software (e.g., "00610499:32") The corresponding STOP_COUNT is not applicable because the timing of a CTX image, once started, is independent of the space- craft clock. The following information can be used, along with calibra- tion files to be included on the volume, to calibrate each April 2007 7 image. This information is in some sense redundant with that in the E-kernel. FOCAL_PLANE_TEMPERATURE Temperature of focal plane of optical system associated with this image, in degrees Kelvin, at the start of image acquisition. SAMPLE_BIT_MODE_ID CTX digitizes pixels to 12 bits and then uses a lookup table to map pixels to 8 bits. This field identifies the table in use. Valid values are SQROOT, LIN1-LIN16, and LIN1CYC-LIN16CYC. The contents of the SQROOT table are given in Appendix A. OFFSET_MODE_ID The CTX offset setting in the form coarse-offset/fine- offset-chan1/fine-offset-chan2 (e.g., "200/58/67") LINE_EXPOSURE_DURATION Per-line exposure duration in units of milliseconds. The time at which a given line was acquired can be determined by multiplying the line exposure time by the number of previous lines and adding it to the image start time. Note that CTX implements downtrack summing by increasing the line time; for example, a 2X2 summed image has an actual line time twice that given by this field. SAMPLING_FACTOR CTX can do pixel averaging in the instrument before transmission. For CTX, this value must be 1 (no sum- ming) or 2 (2x summing). SAMPLE_FIRST_PIXEL This is the first pixel of the CCD recorded in the image, and thus implicitly specifies the off-nadir look angle. A value of 0 refers to the first pixel in the array. RATIONALE_DESC A text description of the scientific purpose for the acquisition of this image; e.g., "Monthly monitoring of aeolian features on summit of Pavonis Mons". For some specific images, this string will contain a description of the image as actually received; for routine mapping operations, it will more likely be the goal of the image as targeted (which may not be met if the image missed its target significantly, the atmosphere was cloudy, image parameters were set inappropriately, etc.) April 2007 8 DATA_QUALITY_DESC This field will be set to "OK" if all fragments of the image were received without detected checksum or sequence errors, and "ERROR" otherwise. ORBIT_NUMBER The orbit number from the start of the mapping phase as defined by the MRO Project. The following describe keywords found internal to the IMAGE object. LINES Number of lines in the image. LINE_SAMPLES Number of samples per line in the image. (Each line in the file must have the same number of samples.) LINE_PREFIX_BYTES Number of bytes of prefix information per line. This field is always 0 for CTX products. LINE_SUFFIX_BYTES Number of bytes of suffix information per line. This field is always 0 for CTX products. SAMPLE_TYPE Type of each sample; for CTX, always UNSIGNED_INTEGER. SAMPLE_BITS Number of bits for each sample; for CTX, always 8. SAMPLE_BIT_MASK Bit mask description for each sample; for CTX, always 2#11111111#. CHECKSUM This is a checksum for the entire data part of this image, to be used for data validation. 4.3.1. Header/Trailer Description Details See above. No trailers are present. 4.3.2. Data Description Details 4.3.2.1. Geometry Note that CTX images are acquired and compressed in row- major order by increasing time. The arrangement of the CCD and optics in the CTX somewhat complicates the mapping of pixel to surface feature. Suppose an image acquired while April 2007 9 the spacecraft was moving north to south was displayed in left-to-right, top-to-bottom order on a monitor. The CTX image would then have east at the left. It is suggested that ancillary products be used to systemat- ically display images in north-up, west-left form. These products have not been transformed in this manner. 4.3.3. Data loss considerations MRO can use a version of the CFDP protocol to retransmit portions of data products that are dropped during initial transmission. This capability may not be employed at all times, however, and so it is possible that some CTX images will be affected by data loss. A typical data loss is that of one or two packets, due to uncorrectable bit errors caused by noise in the space-to- Earth communications path (rare), momentary loss of receiver lock caused by a transition between the one-way and two-way tracking modes, or loss in the Earth segment of the Deep Space Network. For compressed images, a packet loss leads to loss of 'line sync' in the image. We expect the majority of CTX images to be acquired using the lossless predictive compression mode of CTX. When a packet is lost from this compressed data stream, the decompression algorithm aligns itself to the next line by searching for the line counter and applying statistical testing to distinguish a valid line counter from a data pattern that coincidentally resembles a line counter. The effect of decompressing the data between the site of packet loss and the next valid line is the loss of one or more partial lines of data, which are zero-filled by the decompression software. A second type of loss is that of tens or hundreds of packets caused by bad weather, hardware failure, or operator error at the DSN stations, or miscommanding of the telemetry play- back on the spacecraft. For these errors in a compressed data stream, many lines of the image are lost, making it impossible to recover even the original downtrack size of the image. The CTX ground software that produces the archival data may perform some limited correction of these errors. Correct and complete reconstruction should only be expected if there are no detected checksum errors or sequence gaps in the data; i.e., if the DATA_QUALITY_DESC field is "OK". April 2007 10 5. Appendix -- CTX square root companding table 8-bit sqroot value 11-bit linear value ________________________________________ 0 1 1 3 2 5 3 7 4 9 5 11 6 13 7 15 8 17 9 20 10 22 11 24 12 27 13 29 14 32 15 35 16 38 17 41 18 44 19 47 20 50 21 54 22 58 23 61 24 65 25 69 26 73 27 77 28 82 29 86 30 91 31 95 32 100 33 105 34 110 35 115 36 121 37 126 38 131 39 137 40 143 41 149 42 155 43 161 44 167 45 173 46 179 47 186 April 2007 11 48 193 49 199 50 206 51 213 52 220 53 228 54 235 55 243 56 250 57 258 58 266 59 274 60 282 61 290 62 298 63 306 64 315 65 324 66 332 67 341 68 350 69 359 70 369 71 378 72 387 73 397 74 407 75 416 76 426 77 436 78 446 79 457 80 467 81 478 82 488 83 499 84 510 85 521 86 532 87 543 88 554 89 566 90 577 91 589 92 601 93 613 94 625 95 637 96 649 97 662 98 674 99 687 100 699 April 2007 12 101 712 102 725 103 738 104 751 105 765 106 778 107 792 108 805 109 819 110 833 111 847 112 861 113 875 114 890 115 904 116 919 117 933 118 948 119 963 120 978 121 993 122 1009 123 1024 124 1039 125 1055 126 1071 127 1087 128 1103 129 1119 130 1135 131 1151 132 1168 133 1184 134 1201 135 1218 136 1235 137 1252 138 1269 139 1286 140 1304 141 1321 142 1339 143 1356 144 1374 145 1392 146 1410 147 1429 148 1447 149 1465 150 1484 151 1502 152 1521 153 1540 April 2007 13 154 1559 155 1578 156 1598 157 1617 158 1636 159 1656 160 1676 161 1696 162 1715 163 1736 164 1756 165 1776 166 1796 167 1817 168 1838 169 1858 170 1879 171 1900 172 1921 173 1943 174 1964 175 1985 176 2007 177 2029 178 2050 179 2072 180 2094 181 2117 182 2139 183 2161 184 2184 185 2206 186 2229 187 2252 188 2275 189 2298 190 2321 191 2345 192 2368 193 2392 194 2415 195 2439 196 2463 197 2487 198 2511 199 2535 200 2560 201 2584 202 2609 203 2634 204 2658 205 2683 206 2709 April 2007 14 207 2734 208 2759 209 2784 210 2810 211 2836 212 2861 213 2887 214 2913 215 2939 216 2966 217 2992 218 3019 219 3045 220 3072 221 3099 222 3126 223 3153 224 3180 225 3207 226 3235 227 3262 228 3290 229 3317 230 3345 231 3373 232 3401 233 3430 234 3458 235 3486 236 3515 237 3544 238 3573 239 3601 240 3630 241 3660 242 3689 243 3718 244 3748 245 3777 246 3807 247 3837 248 3867 249 3897 250 3927 251 3958 252 3988 253 4019 254 4049 255 4080 April 2007 15 Contents 1. Introduction ...................................... 1 1.1. Purpose ........................................ 1 1.2. Scope .......................................... 1 1.3. Applicable Documents ........................... 1 1.4. Functional Description ......................... 1 1.4.1. Data Content Summary ........................ 1 1.4.2. Source and Transfer Method .................. 1 1.4.3. Recipients and Utilization .................. 2 1.5. Assumptions and Constraints .................... 2 2. Environment ....................................... 2 2.1. Instrument Overview ............................ 2 2.2. Failure Protection, Detection, and Recovery .... 3 2.3. End-of-File Conventions ........................ 3 3. Access ............................................ 3 3.1. Access Tools ................................... 3 3.2. Input/Output Protocols ......................... 4 3.3. Timing and Sequencing Characteristics .......... 4 4. Detailed Interface Specifications ................. 4 4.1. Labeling and Identification .................... 4 4.2. Structure and Organization Overview ............ 4 4.3. Substructure Definition and Format ............. 5 4.3.1. Header/Trailer Description Details .......... 9 4.3.2. Data Description Details .................... 9 4.3.3. Data loss considerations .................... 10 5. Appendix -- CTX square root companding table ...... 11 April 2007 iii