<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://starbase.jpl.nasa.gov/pds4/1400/dph_example_products/xml_schema/PDS4_PDS_1400.sch"
  schematypens="http://purl.oclc.org/dsdl/schematron"?>

<Product_Observational xmlns="http://pds.nasa.gov/pds4/pds/v1"
    xmlns:pds="http://pds.nasa.gov/pds4/pds/v1"
    xmlns:dph="http://pds.nasa.gov/pds4/dph/v01"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pds.nasa.gov/pds4/pds/v1  https://starbase.jpl.nasa.gov/pds4/1400/dph_example_products/xml_schema/PDS4_PDS_1400.xsd
                        http://pds.nasa.gov/pds4/dph/v01 https://starbase.jpl.nasa.gov/pds4/1400/dph_example_products/xml_schema/dph_example_dict_1400.xsd"> 
    
    <Identification_Area>
        <logical_identifier>urn:nasa:pds:example.dph.sampleproducts:exampleproducts:tablebinpacked.vg1-j_s_ss-pws-1-edr-wfrm-60ms-v1.0</logical_identifier>
        <version_id>1.0</version_id>
        <title>VOYAGER 1 EARTH-JUPITER CRUISE Experiment</title>
        <information_model_version>1.4.0.0</information_model_version>
        <product_class>Product_Observational</product_class>
        <Modification_History>
            <Modification_Detail>
                <modification_date>2012-01-12</modification_date>
                <version_id>1.0</version_id>
                <description>
                    extracted metadata from PDS3 catalog and
                    modified to comply with PDS4 Information Model
                </description>
            </Modification_Detail>
        </Modification_History>
    </Identification_Area>
    <Observation_Area>
        <comment>Observational Intent</comment>
        <Time_Coordinates>
            <start_date_time>1978-11-23T05:41:36.300Z</start_date_time>
            <stop_date_time>1978-11-23T05:42:24.300Z</stop_date_time>
            <local_mean_solar_time>not applicable</local_mean_solar_time>
            <local_true_solar_time>not applicable</local_true_solar_time>
        </Time_Coordinates>
        <Primary_Result_Summary>
            <!-- deprecated
            <type>Image</type>
            -->
            <purpose>Science</purpose>
            <!-- deprecated
            <data_regime>Visible</data_regime>
            -->
            <processing_level>Raw</processing_level>
            <description>
                This is where a generic description of the product goes            
            </description>
        </Primary_Result_Summary>        
        <Investigation_Area>
            <name>VOYAGER</name>
            <type>Mission</type>
            <Internal_Reference>
                <lidvid_reference>urn:nasa:pds:context:investigation:mission.voyager::1.0</lidvid_reference>
                <reference_type>data_to_investigation</reference_type>
            </Internal_Reference>
        </Investigation_Area>
        <Observing_System>
            <name>Observing System for VG+PWS</name>
            <Observing_System_Component>
                <name>VG</name>
                <type>Spacecraft</type>
                <description>instrument_host VG1</description>
                <Internal_Reference>
                    <lid_reference>urn:nasa:pds:context:instrument_host:instrument_host.vg1</lid_reference>
                    <reference_type>is_instrument_host</reference_type>
                </Internal_Reference>
            </Observing_System_Component>
            <Observing_System_Component>
                <name>Observing System for VG+PWS</name>
                <type>Instrument</type>
                <description>instrument PWS</description>
                <Internal_Reference>
                    <lid_reference>urn:nasa:pds:context:instrument:instrument.pws__vg1</lid_reference>
                    <reference_type>is_instrument</reference_type>
                </Internal_Reference>
            </Observing_System_Component>
        </Observing_System>
        <Target_Identification>
            <name>SOLAR SYSTEM</name>
            <type>Planet</type>
            <description>description of SOLAR SYSTEM goes here</description>
            <Internal_Reference>
                <lidvid_reference>urn:nasa:pds:context:target:target.solar_system::1.0</lidvid_reference>
                <reference_type>data_to_target</reference_type>
            </Internal_Reference>
        </Target_Identification>
        <!-- ============================================================ -->
        <!-- Reference the attributes that were imported from the         -->
        <!-- local dictionary (using the local namespace (dph)            -->
        <!-- ============================================================ -->
        <Mission_Area>
            <dph:spacecraft_clock_start_count>02/10501.25.001</dph:spacecraft_clock_start_count>
            <dph:spacecraft_clock_stop_count>02/10501.26.001</dph:spacecraft_clock_stop_count>
        </Mission_Area>
        <Discipline_Area>
        </Discipline_Area>
    </Observation_Area>

    <Reference_List>
        <Internal_Reference>
            <lidvid_reference>urn:nasa:pds:context:investigation:mission.phoenix::1.0</lidvid_reference>
            <reference_type>data_to_document</reference_type>
        </Internal_Reference>
        <Internal_Reference>
            <lid_reference>urn:nasa:pds:context:instrument_host:instrument_host.phx</lid_reference>
            <reference_type>data_to_document</reference_type>
        </Internal_Reference>
        <Internal_Reference>
            <lid_reference>urn:nasa:pds:context:instrument:instrument.tt__phx</lid_reference>
            <reference_type>data_to_document</reference_type>
        </Internal_Reference>
        <Internal_Reference>
            <lid_reference>urn:nasa:pds:context:target:target.mars</lid_reference>
            <reference_type>data_to_document</reference_type>
        </Internal_Reference>
        <Internal_Reference>
            <lid_reference>urn:nasa:pds:context:node:node.atmos</lid_reference>
            <reference_type>data_to_document</reference_type>
        </Internal_Reference>
    </Reference_List>
    <File_Area_Observational>
        <File>
            <file_name>C1050125.DAT</file_name>
            <local_identifier>TABLE_BINARY_ID</local_identifier>
            <creation_date_time>2000-11-21</creation_date_time>
            <file_size unit="byte">366592</file_size>
            <records>358</records>
            <md5_checksum>d41d8cd98f00b204e9800998ecf8427e</md5_checksum>
        </File> 
 
        <!-- ================================ -->
        <!-- TABLE #1: Engineering Table      -->
        <!-- ================================ -->
        <!-- ======================================================= -->
        <!-- In the original PDS3 label, there are 94 top level      -->
        <!--   fields defined:                                       -->
        <!--   - 19 fields have bit fields; there are 40 bit fields  -->
        <!--   - the last field is a field of 724 SPARE bytes        -->
        <!--                                                         -->
        <!--   - Total <Field_Binary> = 94                           -->
        <!--   - Total <Field_Bit>    = 40                           -->        
        <!--                                                         -->
        <!--  This table was not fully migrated.                     -->
        <!--   - only the 1st and last field were migrated.  The     -->
        <!--     2nd field is a 'placeholder' for the 2nd thru 93rd  -->
        <!--     fields in the original PDS3 label.                  -->
        <!-- ======================================================= -->
       <Table_Binary>
            <local_identifier>ENGINEERING_TABLE</local_identifier>
            <offset unit="byte">0</offset>
            <records>1</records>
            <Record_Binary>
                <fields>2</fields>
                <groups>1</groups>
                <record_length unit="byte">1024</record_length>
                
                <Field_Binary>
                    <name>RECORD ID</name>
                    <field_number>1</field_number>
                    <field_location unit="byte">1</field_location>
                    <data_type>UnsignedByte</data_type>
                    <field_length unit="byte">1</field_length>
                    <description>
                        Record identifier, always set to zero 
                        for the engineering table/record.
                    </description>
                </Field_Binary>

                <!-- ======================================= -->
                <!-- Placeholder for fields 2 thru 93        -->
                <!--  - for specifics see: "WFENGHDR.FMT"    -->
                <!-- ======================================= -->
                <Field_Binary>
                    <name>Char_Field</name>
                    <field_number>2</field_number>
                    <field_location unit="byte">2</field_location>
                    <data_type>ASCII_String</data_type>
                    <field_length unit="byte">299</field_length>
                    <description>
                        Single character field where there were originally 
                        92 binary fields
                        
                        For specifics, see: "WFENGHDR.FMT" 
                    </description>
                </Field_Binary>

                <!-- ======================================= -->
                <!-- Field 94 contains SPARE bytes           -->
                <!-- no reason to break into separate fields -->
                <!-- ======================================= -->
                <Group_Field_Binary>
                    <repetitions>724</repetitions>
                    <fields>1</fields>
                    <groups>0</groups>
                    <group_location unit="byte">301</group_location>
                    <group_length unit="byte">724</group_length>
                    
                    <Field_Binary>
                        <name>SPARE</name>
                        <field_location unit="byte">1</field_location>
                        <data_type>UnsignedByte</data_type>
                        <field_length unit="byte">1</field_length>
                       <description>
                            Binary zero-filled spare.
                        </description>
                    </Field_Binary>
                </Group_Field_Binary>

            </Record_Binary>
        </Table_Binary>

        <!-- ==================================================================== -->
        <!-- TABLE #2: Combination of WF_ROW_PREFIX_TABLE and TIME_SERIES tables  -->
        <!--            - the above tables were originally interleaved (which is  -->
        <!--              not permissible under PDS4)                             -->
        <!-- ==================================================================== -->
        <Table_Binary>
            <local_identifier>ENGINEERING_TABLE</local_identifier>
            <offset unit="byte">1024</offset>
            <records>357</records>
            <description>
                Binary table with records having 220 byte headers, 1600 4-byte samples, and 4 bytes of suffix.
            </description>
            <Record_Binary>
                <!-- ==================================== -->
                <!-- Only count <Field_Binary> instances  -->
                <!-- ==================================== -->
                <fields>8</fields>
                <groups>1</groups>
                <record_length unit="byte">1024</record_length>
                
                <!-- =============================================================== -->
                <!-- There are 45 top level fields defined in each record header     -->
                <!--   8 of these have bit fields; there are 17 bit fields           -->
                <!-- The header is followed by 800 repetitions of 2 4-bit samples    -->
                <!-- The final 4 bytes are not defined                               -->
                <!-- There are also undefined gaps within the record header          -->
                <!-- =============================================================== -->
                <Field_Binary>
                    <name>MTIS File Number</name>
                    <field_number>1</field_number>
                    <field_location unit="byte">1</field_location>
                    <data_type>UnsignedByte</data_type>
                    <field_length unit="byte">1</field_length>
                    <description>
                        Mission and Test Imaging System tape file number.
                    </description>
                </Field_Binary>
                
                <Field_Binary>
                    <name>MTIS Record ID</name>
                    <field_number>2</field_number>
                    <field_location unit="byte">2</field_location>
                    <data_type>UnsignedMSB2</data_type>
                    <field_length unit="byte">1</field_length>
                    <description>
                        Mission and Test Imaging System record ID. 
                    </description>
                </Field_Binary>
                
                <Field_Binary>
                    <name>Physical Sequence Number</name>
                    <field_number>3</field_number>
                    <field_location unit="byte">3</field_location>
                    <data_type>UnsignedMSB2</data_type>
                    <field_length unit="byte">2</field_length>
                    <description>
                        Physical sequence number on Experiment Data Record tape. 
                    </description>
                </Field_Binary>
                
                <Field_Binary>
                    <name>Logical Sequence Number</name>
                    <field_number>4</field_number>
                    <field_location unit="byte">5</field_location>
                    <data_type>UnsignedMSB2</data_type>
                    <field_length unit="byte">2</field_length>
                    <description>
                        Logical sequence number on Experiment Data Record tape.
                    </description>
                </Field_Binary>
                
                <Field_Binary>
                    <name>First ERT</name>
                    <field_number>5</field_number>
                    <field_location unit="byte">7</field_location>
                    <data_type>UnsignedMSB4</data_type>
                    <field_length unit="byte">4</field_length>
                    <description>
                        Earth Received Time year and day value.
                        Time of first line/record in the file containing valid data.
                    </description>
                    
                    <!-- ====================================================================================================== -->
                    <!-- data_type is the data type into which the bits should be expanded. Bit is not an appropriate data type -->
                    <!--  for a multi-bit field.                                                                                -->
                    <!-- ====================================================================================================== -->
                    <Packed_Data_Fields>
                        <bit_fields>3</bit_fields>
                        
                        <Field_Bit>
                            <name>First ERT Year</name>
                            <start_bit>1</start_bit>
                            <stop_bit>7</stop_bit>
                            <data_type>UnsignedBitString</data_type>
                            <description>
                                Earth Received Time year of the century (1900).
                                Time of first line/record in the file containing valid data.
                            </description>
                        </Field_Bit>
                        
                        <Field_Bit>
                            <name>First ERT Year</name>
                            <start_bit>8</start_bit>
                            <stop_bit>16</stop_bit>
                            <data_type>UnsignedBitString</data_type>
                            <description>
                                Earth Received Time day of the year.
                            </description>
                        </Field_Bit>
                        
                        <Field_Bit>
                            <name>First ERT Minute</name>
                            <start_bit>22</start_bit>
                            <stop_bit>11</stop_bit>
                            <data_type>UnsignedBitString</data_type>
                            <description>
                                Earth Received Time minute of the day.
                            </description>
                        </Field_Bit>
                    </Packed_Data_Fields>
                </Field_Binary>

                <!-- =================================================== -->
                <!-- Placeholder for fields 6 thru 53                    -->
                <!--  - for specifics see: "WFROWPFX.FMT"                -->
                <!-- =================================================== -->
                <Field_Binary>
                    <name>Char_Field</name>
                    <field_number>6</field_number>
                    <field_location unit="byte">11</field_location>
                    <data_type>ASCII_String</data_type>
                    <field_length unit="byte">299</field_length>
                    <description>
                        Single character field where there were originally 
                        39 binary fields
                        
                        For specifics, see: "WFENGHDR.FMT" 
                    </description>
                </Field_Binary>

                <!-- =================================================== -->
                <!-- END definition of: WF_ROW_PREFIX_TABLE table        -->
                <!-- =================================================== -->
                <!-- BEGIN definition of: TIME_SERIES table              -->
                <!-- =================================================== -->
                <Group_Field_Binary>
                    <repetitions>800</repetitions>
                    <fields>1</fields>
                    <groups>0</groups>
                    <group_location unit="byte">221</group_location>
                    <group_length unit="byte">800</group_length>

                    <!-- ========================================== -->
                    <!-- Add Field to define Byte column            -->
                    <!-- ========================================== -->
                    <Field_Binary>
                        <name>WAVEFORM_BYTE</name>
                        <field_number>7</field_number>
                        <field_location unit="byte">1</field_location>
                        <data_type>UnsignedByte</data_type>
                        <field_length unit="byte">1</field_length>
                        <field_format>I1</field_format>
                        <description>
                            An 8-bit column where the data is packed
                            into two 4-bit columns
                        </description>

                        <!-- ========================================== -->
                        <!-- Define two packed 4-bit columns            -->
                        <!-- ========================================== -->
                        <Packed_Data_Fields>
                            <bit_fields>2</bit_fields>
                            <description>
                                The 4-bit waveform samples constitute           
                                an array of waveform measurements which are encoded into            
                                binary values from 0 to 15 and may be re-mapped to reduce           
                                the artificial zero-frequency component.  For example,              
                                stored values can be mapped to the following floating point         
                                values:                                                             
                                
                                0 = -7.5    1 = -6.5    2 = -5.5    3 = -4.5                       
                                4 = -3.5    5 = -2.5    6 = -1.5    7 = -0.5                       
                                8 =  0.5    9 =  1.5   10 =  2.5   11 =  3.5                       
                                12 =  4.5   13 =  5.5   14 =  6.5   15 =  7.5
                            </description>
                            
                            <Field_Bit>
                                <name>WAVEFORM_SAMPLES; Item #1</name>
                                <start_bit>1</start_bit>
                                <stop_bit>4</stop_bit>
                                <data_type>UnsignedBitString</data_type>
                                <field_format>B4</field_format>
                                <description>
                                    1st 4-bit bit-column 
                                </description>
                            </Field_Bit>

                            <Field_Bit>
                                <name>WAVEFORM_SAMPLES; Item # 2</name>
                                <start_bit>5</start_bit>
                                <stop_bit>4</stop_bit>
                                <data_type>UnsignedBitString</data_type>
                                <field_format>B4</field_format>
                                <description>
                                    2nd 4-bit bit-column 
                                </description>
                            </Field_Bit>
                         </Packed_Data_Fields>                       
                    </Field_Binary>
                </Group_Field_Binary>
                        
                <!-- ========================================== -->
                <!-- Add Field to equivalence ROW_SUFFIX_BYTES  -->
                <!-- ========================================== -->
                <Field_Binary>
                    <name>Suffix_Bytes_Field</name>
                    <field_number>8</field_number>
                    <field_location unit="byte">1020</field_location>
                    <data_type>ASCII_String</data_type>
                    <field_length unit="byte">2</field_length>
                    <field_format>A2</field_format>
                    <description>
                        Single character field where there was originally 
                        no column; but used a PDS3 suffix byte construct
                        of 2 bytes (as pad for the next field)
                    </description>
                </Field_Binary>

                <!-- =================================================== -->
                <!-- END definition of: TIME_SERIES table                -->
                <!-- =================================================== -->
                <!-- BEGIN definition of: WF_ROW_PREFIX_TABLE table      -->
                <!-- =================================================== -->
                <!-- Field 54 (last column of prefix table)              -->
                <!-- =================================================== -->
                <Field_Binary>
                    <name>Last Valid Pixel</name>
                    <field_number>9</field_number>
                    <field_location unit="byte">1022</field_location>
                    <data_type>SignedMSB2</data_type>
                    <field_length unit="byte">2</field_length>
                    <description>
                        Last valid pixel in line.
                    </description>
                </Field_Binary>

                <!-- =================================================== -->
                <!-- END definition of: WF_ROW_PREFIX_TABLE table        -->
                <!-- =================================================== -->

             </Record_Binary>
        </Table_Binary>
        
    </File_Area_Observational>
</Product_Observational>
