<?xml version="1.0"?>
<cd:ProductDefinition id="GOM_LIM_1P_v0" format="binary" last-modified="2008-07-01" xmlns:cd="http://www.stcorp.nl/coda/definition/2008/07">
  <cd:Record format="binary">
    <cd:Field name="mph">
      <cd:NamedType id="MPH"/>
    </cd:Field>
    <cd:Field name="sph">
      <cd:NamedType id="GOM_TRA_LIM_1P_SPH"/>
    </cd:Field>
    <cd:Field name="dsd">
      <cd:Array format="ascii">
        <cd:Dimension><![CDATA[$num_dsd]]></cd:Dimension>
        <cd:NamedType id="DSD"/>
      </cd:Array>
    </cd:Field>
    <cd:Field name="lim_summary_quality">
      <cd:Array>
        <cd:Description>Summary Quality GADS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[0]]]></cd:Dimension>
        <cd:NamedType id="GOM_TRA_LIM_1P_GADS_summary_quality_v0"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[0] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[0]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="lim_occultation_data">
      <cd:Array>
        <cd:Description>Occultation GADS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[1]]]></cd:Dimension>
        <cd:NamedType id="GOM_LIM_1P_GADS_occultation_data_v0"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[1] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[1]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="lim_nom_wav_assignment">
      <cd:Array>
        <cd:Description>Nominal wavelength GADS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[2]]]></cd:Dimension>
        <cd:NamedType id="GOM_TRA_LIM_1P_GADS_nominal_wavelength_assignment"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[2] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[2]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="lim_mds">
      <cd:Array>
        <cd:Description>Limb MDS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[3]]]></cd:Dimension>
        <cd:NamedType id="GOM_LIM_1P_MDSR_limb_v0"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[3] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[3]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="lim_ads">
      <cd:Array>
        <cd:Description>Limb ADS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[4]]]></cd:Dimension>
        <cd:NamedType id="GOM_LIM_1P_ADSR_limb_v0"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[4] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[4]]]></cd:BitOffset>
    </cd:Field>
  </cd:Record>
  <cd:ProductVariable name="num_dsd">
    <cd:Init><![CDATA[$num_dsd = int(/mph/num_dsd)]]></cd:Init>
  </cd:ProductVariable>
  <cd:ProductVariable name="num_ds">
    <cd:Init><![CDATA[$num_ds = 5]]></cd:Init>
  </cd:ProductVariable>
  <cd:ProductVariable name="ds_to_dsd_index">
    <cd:Dimension><![CDATA[$num_ds]]></cd:Dimension>
    <cd:Init><![CDATA[$ds_to_dsd_index[0] = index(/dsd, str(./ds_name) == "LIM_SUMMARY_QUALITY         "); $ds_to_dsd_index[1] = index(/dsd, str(./ds_name) == "LIM_OCCULTATION_DATA        "); $ds_to_dsd_index[2] = index(/dsd, str(./ds_name) == "LIM_NOM_WAV_ASSIGNMENT      "); $ds_to_dsd_index[3] = index(/dsd, str(./ds_name) == "LIM_MDS                     "); $ds_to_dsd_index[4] = index(/dsd, str(./ds_name) == "LIM_ADS                     ")]]></cd:Init>
  </cd:ProductVariable>
  <cd:ProductVariable name="ds_available">
    <cd:Dimension><![CDATA[$num_ds]]></cd:Dimension>
    <cd:Init><![CDATA[for i = 0 to $num_ds - 1 do $ds_available[i] = if($ds_to_dsd_index[i] != -1 && !(bytes(/dsd[$ds_to_dsd_index[i]]/filename, 8) == "NOT USED"), 1, 0)]]></cd:Init>
  </cd:ProductVariable>
  <cd:ProductVariable name="ds_offset">
    <cd:Dimension><![CDATA[$num_ds]]></cd:Dimension>
    <cd:Init><![CDATA[for i = 0 to $num_ds - 1 do $ds_offset[i] = 8 * int(/dsd[$ds_to_dsd_index[i]]/ds_offset)]]></cd:Init>
  </cd:ProductVariable>
  <cd:ProductVariable name="num_dsr">
    <cd:Dimension><![CDATA[$num_ds]]></cd:Dimension>
    <cd:Init><![CDATA[for i = 0 to $num_ds - 1 do $num_dsr[i] = int(/dsd[$ds_to_dsd_index[i]]/num_dsr)]]></cd:Init>
  </cd:ProductVariable>
</cd:ProductDefinition>
