<?xml version="1.0"?>
<cd:ProductDefinition id="MIP_FM2_AX_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="Auxiliary_Data_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="initial_guess_general_data">
      <cd:Array>
        <cd:Description>GADS General</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[0]]]></cd:Dimension>
        <cd:NamedType id="MIP_IG2_AX_GADS_general_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="pressure_profiles_mds">
      <cd:Array>
        <cd:Description>Pressure profile MDS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[1]]]></cd:Dimension>
        <cd:NamedType id="MIP_IG2_AX_MDSR_press"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[1] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[1]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="temperature_profiles_mds">
      <cd:Array>
        <cd:Description>Temperature profiles MDS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[2]]]></cd:Dimension>
        <cd:NamedType id="MIP_IG2_AX_MDSR_temp"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[2] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[2]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="vmr_profiles_mds">
      <cd:Array>
        <cd:Description>VMR profiles MDS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[3]]]></cd:Dimension>
        <cd:NamedType id="MIP_IG2_AX_MDSR_vmr_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="pt_mw_continuum_prof_mds">
      <cd:Array>
        <cd:Description>p,T Continuum profiles MDS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[4]]]></cd:Dimension>
        <cd:NamedType id="MIP_IG2_AX_MDSR_cont_prof"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[4] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[4]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="h2o_mw_continuum_prof_mds">
      <cd:Array>
        <cd:Description>H2O Continuum profiles MDS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[5]]]></cd:Dimension>
        <cd:NamedType id="MIP_IG2_AX_MDSR_cont_prof"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[5] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[5]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="n2o_mw_continuum_prof_mds">
      <cd:Array>
        <cd:Description>N2O Continuum profiles MDS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[6]]]></cd:Dimension>
        <cd:NamedType id="MIP_IG2_AX_MDSR_cont_prof"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[6] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[6]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="hno3_mw_continuum_prof_mds">
      <cd:Array>
        <cd:Description>HNO3 Continuum profiles MDS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[7]]]></cd:Dimension>
        <cd:NamedType id="MIP_IG2_AX_MDSR_cont_prof"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[7] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[7]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="ch4_mw_continuum_prof_mds">
      <cd:Array>
        <cd:Description>CH4 Continuum profiles MDS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[8]]]></cd:Dimension>
        <cd:NamedType id="MIP_IG2_AX_MDSR_cont_prof"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[8] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[8]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="o3_mw_continuum_prof_mds">
      <cd:Array>
        <cd:Description>O3 Continuum profiles MDS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[9]]]></cd:Dimension>
        <cd:NamedType id="MIP_IG2_AX_MDSR_cont_prof"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[9] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[9]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="no2_mw_continuum_prof_mds">
      <cd:Array>
        <cd:Description>NO2 Continuum profiles MDS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[10]]]></cd:Dimension>
        <cd:NamedType id="MIP_IG2_AX_MDSR_cont_prof"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[10] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[10]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="forward_model_general_data">
      <cd:Array>
        <cd:Description>General data</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[11]]]></cd:Dimension>
        <cd:NamedType id="MIP_FM2_AX_GADS_fc"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[11] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[11]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="mw_occupation_matrix_ads">
      <cd:Array>
        <cd:Description>Data depending on occupation matrix location ADS</cd:Description>
        <cd:Dimension><![CDATA[$num_dsr[12]]]></cd:Dimension>
        <cd:NamedType id="MIP_FM2_AX_ADSR_occupation"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[12] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[12]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="mw_grouping_ads">
      <cd:Array>
        <cd:Description>Microwindow grouping data ADS</cd:Description>
        <cd:Dimension><![CDATA[int(/initial_guess_general_data[0]/num_lat_bands)]]></cd:Dimension>
        <cd:NamedType id="MIP_FM2_AX_ADSR_cont"/>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[13] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[13]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="simulated_spectra_mds">
      <cd:Array>
        <cd:Description>Computed spectra MDS</cd:Description>
        <cd:Dimension><![CDATA[int(/initial_guess_general_data[0]/num_lat_bands)]]></cd:Dimension>
        <cd:Array>
          <cd:Dimension><![CDATA[int(/mw_occupation_matrix_ads[index(:)]/nsim)]]></cd:Dimension>
          <cd:Array>
            <cd:Dimension><![CDATA[int(/forward_model_general_data[0]/ngeo)]]></cd:Dimension>
            <cd:Array>
              <cd:Dimension><![CDATA[int(/mw_occupation_matrix_ads[index(:/../..)]/nmw)]]></cd:Dimension>
              <cd:Array>
                <cd:Dimension><![CDATA[int(/mw_occupation_matrix_ads[index(:/../../..)]/mw_occ[int(/mw_occupation_matrix_ads[index(:/../../..)]/nmw) * index(:/..) + index(:)])]]></cd:Dimension>
                <cd:NamedType id="MIP_FM2_AX_MDSR_spect"/>
              </cd:Array>
            </cd:Array>
          </cd:Array>
        </cd:Array>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[14] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[14]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="fitted_parameters_mds">
      <cd:Array>
        <cd:Description>Values of unknown parameters MDS</cd:Description>
        <cd:Dimension><![CDATA[int(/initial_guess_general_data[0]/num_lat_bands)]]></cd:Dimension>
        <cd:Array>
          <cd:Dimension><![CDATA[int(/mw_occupation_matrix_ads[index(:)]/nsim)]]></cd:Dimension>
          <cd:NamedType id="MIP_FM2_AX_MDSR_unk"/>
        </cd:Array>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[15] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[15]]]></cd:BitOffset>
    </cd:Field>
    <cd:Field name="jacobi_matrices_mds">
      <cd:Array>
        <cd:Description>Jacobian matrices MDS</cd:Description>
        <cd:Dimension><![CDATA[int(/initial_guess_general_data[0]/num_lat_bands)]]></cd:Dimension>
        <cd:Array>
          <cd:Dimension><![CDATA[int(/mw_occupation_matrix_ads[index(:)]/nsim)]]></cd:Dimension>
          <cd:Array>
            <cd:Dimension><![CDATA[int(/forward_model_general_data[0]/ngeo)]]></cd:Dimension>
            <cd:Array>
              <cd:Dimension><![CDATA[int(/mw_occupation_matrix_ads[index(:/../..)]/nmw)]]></cd:Dimension>
              <cd:Array>
                <cd:Dimension><![CDATA[int(/mw_occupation_matrix_ads[index(:/../../..)]/mw_occ[int(/mw_occupation_matrix_ads[index(:/../../..)]/nmw) * index(:/..) + index(:)])]]></cd:Dimension>
                <cd:NamedType id="MIP_FM2_AX_MDSR_jac"/>
              </cd:Array>
            </cd:Array>
          </cd:Array>
        </cd:Array>
      </cd:Array>
      <cd:Available><![CDATA[$ds_available[16] != 0]]></cd:Available>
      <cd:BitOffset><![CDATA[$ds_offset[16]]]></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 = 17]]></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) == "INITIAL GUESS GENERAL DATA  "); $ds_to_dsd_index[1] = index(/dsd, str(./ds_name) == "PRESSURE PROFILES MDS       "); $ds_to_dsd_index[2] = index(/dsd, str(./ds_name) == "TEMPERATURE PROFILES MDS    "); $ds_to_dsd_index[3] = index(/dsd, str(./ds_name) == "VMR PROFILES MDS            "); $ds_to_dsd_index[4] = index(/dsd, str(./ds_name) == "PT MW CONTINUUM PROF MDS    "); $ds_to_dsd_index[5] = index(/dsd, str(./ds_name) == "H2O MW CONTINUUM PROF MDS   "); $ds_to_dsd_index[6] = index(/dsd, str(./ds_name) == "N2O MW CONTINUUM PROF MDS   "); $ds_to_dsd_index[7] = index(/dsd, str(./ds_name) == "HNO3 MW CONTINUUM PROF MDS  "); $ds_to_dsd_index[8] = index(/dsd, str(./ds_name) == "CH4 MW CONTINUUM PROF MDS   "); $ds_to_dsd_index[9] = index(/dsd, str(./ds_name) == "O3 MW CONTINUUM PROF MDS    "); $ds_to_dsd_index[10] = index(/dsd, str(./ds_name) == "NO2 MW CONTINUUM PROF MDS   "); $ds_to_dsd_index[11] = index(/dsd, str(./ds_name) == "FORWARD MODEL GENERAL DATA  "); $ds_to_dsd_index[12] = index(/dsd, str(./ds_name) == "MW OCCUPATION MATRIX ADS    "); $ds_to_dsd_index[13] = index(/dsd, str(./ds_name) == "MW GROUPING ADS             "); $ds_to_dsd_index[14] = index(/dsd, str(./ds_name) == "SIMULATED SPECTRA MDS       "); $ds_to_dsd_index[15] = index(/dsd, str(./ds_name) == "FITTED PARAMETERS MDS       "); $ds_to_dsd_index[16] = index(/dsd, str(./ds_name) == "JACOBI MATRICES MDS         ")]]></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>
