<?xml version="1.0"?>
<cd:ProductDefinition id="MIP_NL__1P_v1" 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="MIP_NL__1P_SPH_v0"/>
    </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="summary_quality_ads">
      <cd:Array>
        <cd:Description>Summary Quality ADS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[0]]]></cd:Dimension>
        <cd:NamedType id="MIP_NL__1P_ADSR_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="geolocation_ads">
      <cd:Array>
        <cd:Description>Geolocation ADS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[1]]]></cd:Dimension>
        <cd:NamedType id="MIP_NL__1P_ADSR_geolocation"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[1] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[1]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="structure_ads">
      <cd:Array>
        <cd:Description>Structure ADS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[2]]]></cd:Dimension>
        <cd:NamedType id="MIP_NL__1P_ADSR_structure"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[2] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[2]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="mipas_level_1b_mds">
      <cd:Array>
        <cd:Description>Calibrated Spectra MDS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[3]]]></cd:Dimension>
        <cd:NamedType id="MIP_NL__1P_MDSR_v1"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[3] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[3]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="scan_information_ads">
      <cd:Array>
        <cd:Description>Scan Information ADS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[4]]]></cd:Dimension>
        <cd:NamedType id="MIP_NL__1P_ADSR_info_v1"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[4] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[4]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="offset_calibration_ads">
      <cd:Array>
        <cd:Description>Offset Calibration ADS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[5]]]></cd:Dimension>
        <cd:NamedType id="MIP_NL__1P_ADSR_off"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[5] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[5]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="gain_calibration_ads_1">
      <cd:Array>
        <cd:Description>Gain Calibration ADS #1</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[6]]]></cd:Dimension>
        <cd:NamedType id="MIP_NL__1P_ADSR_gain1"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[6] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[6]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="gain_calibration_ads_2">
      <cd:Array>
        <cd:Description>Gain Calibration ADS #2</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[7]]]></cd:Dimension>
        <cd:NamedType id="MIP_NL__1P_ADSR_gain2"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[7] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[7]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="ils_spectral_cal_gads">
      <cd:Array>
        <cd:Description>Instrument Line Shape (ILS) / Spectral Calibration Data (1 MDSR)</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[8]]]></cd:Dimension>
        <cd:NamedType id="MIP_CS1_AX_MDSR_v1"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[8] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[8]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="los_calibration_gads">
      <cd:Array>
        <cd:Description>Line-Of-Sight Calibration Data (1 MDSR)</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[9]]]></cd:Dimension>
        <cd:NamedType id="MIP_CL1_AX_MDSR"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[9] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[9]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="process_parameters_gads">
      <cd:Array>
        <cd:Description>Processing Parameters GADS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[10]]]></cd:Dimension>
        <cd:NamedType id="MIP_PS1_AX_MDSR_v1"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[10] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[10]]]></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 = 11]]></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) == "SUMMARY QUALITY ADS         "); $ds_to_dsd_index[1] = index(/dsd, str(./ds_name) == "GEOLOCATION ADS             "); $ds_to_dsd_index[2] = index(/dsd, str(./ds_name) == "STRUCTURE ADS               "); $ds_to_dsd_index[3] = index(/dsd, str(./ds_name) == "MIPAS LEVEL-1B MDS          "); $ds_to_dsd_index[4] = index(/dsd, str(./ds_name) == "SCAN INFORMATION ADS        "); $ds_to_dsd_index[5] = index(/dsd, str(./ds_name) == "OFFSET CALIBRATION ADS      "); $ds_to_dsd_index[6] = index(/dsd, str(./ds_name) == "GAIN CALIBRATION ADS#1      "); $ds_to_dsd_index[7] = index(/dsd, str(./ds_name) == "GAIN CALIBRATION ADS#2      "); $ds_to_dsd_index[8] = index(/dsd, str(./ds_name) == "ILS/SPECTRAL CAL GADS       "); $ds_to_dsd_index[9] = index(/dsd, str(./ds_name) == "LOS CALIBRATION GADS        "); $ds_to_dsd_index[10] = index(/dsd, str(./ds_name) == "PROCESS PARAMETERS GADS     ")]]></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" || bytes(/dsd[$ds_to_dsd_index[i]]/filename, 7) == "MISSING"), 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>
