Index: /XIOS/trunk/bld.cfg
===================================================================
--- /XIOS/trunk/bld.cfg	(revision 1117)
+++ /XIOS/trunk/bld.cfg	(revision 1118)
@@ -31,5 +31,5 @@
 bld::lib xios
 bld::target libxios.a 
-bld::target generate_fortran_interface.exe 
+#bld::target generate_fortran_interface.exe 
 bld::target xios_server.exe 
 #bld::target test_remap.exe
@@ -39,4 +39,5 @@
 bld::target test_client.exe test_complete.exe test_xios2_cmip6.exe
 #bld::target test_connectivity_expand.exe
+#bld::target toy_cmip6.exe
 bld::exe_dep
 
Index: /XIOS/trunk/inputs/TOY/arpege_fields.xml
===================================================================
--- /XIOS/trunk/inputs/TOY/arpege_fields.xml	(revision 1118)
+++ /XIOS/trunk/inputs/TOY/arpege_fields.xml	(revision 1118)
@@ -0,0 +1,121 @@
+
+<field_definition level="1" prec="8" operation="instant"  freq_op="1ts" default_value="1.e+20">
+
+  <field_group grid_ref="grid_atm_2D" >
+    <field_group id="arpege_instant_2d" >
+      <field id="psl"     field_ref="field_atm_2D" long_name="air_pressure_at_sea_level" unit="Pa"/>
+      <field id="ps"      field_ref="field_atm_2D" long_name="surface_air_pressure" unit="Pa"/>
+      <!-- Next field is an example of a field sent by actqsat -->
+      <field id="thetaws" field_ref="field_atm_2D" long_name="lowest_level_pseudo_adiabatic_wet_bulb_temperature" unit="K"/>
+    </field_group>
+
+    <field_group id="arpege_fluxes" operation="average" freq_op="1ts">
+      <!-- These fields should undergo HF sampling and time averaging -->
+      <field id="clt"     field_ref="field_atm_2D" long_name="cloud_area_fraction" unit="1"/>
+      <field id="clt100"  field_ref="field_atm_2D" long_name="cloud_area_fraction" unit="%" > clt * 100 </field>
+      <field id="cltc"    field_ref="field_atm_2D" long_name="convective_cloud_area_fraction" unit="1"/>
+      <field id="cltc100" field_ref="field_atm_2D" long_name="convective_cloud_area_fraction" unit="%" > cltc * 100  </field>
+      <field id="clth"    field_ref="field_atm_2D" long_name="cloud_area_fraction_in_atmosphere_layer_high" unit="1"/>
+      <field id="clth100" field_ref="field_atm_2D" long_name="cloud_area_fraction_in_atmosphere_layer_high" unit="%" > clth * 100 </field>
+      <field id="cltm"    field_ref="field_atm_2D" long_name="cloud_area_fraction_in_atmosphere_layer_middle" unit="1"/>
+      <field id="cltm100" field_ref="field_atm_2D" long_name="cloud_area_fraction_in_atmosphere_layer_middle" unit="%" > cltm * 100 </field>
+      <field id="cltl"    field_ref="field_atm_2D" long_name="cloud_area_fraction_in_atmosphere_layer_low" unit="1"/>
+      <field id="cltl100" field_ref="field_atm_2D" long_name="cloud_area_fraction_in_atmosphere_layer_low" unit="%" > cltl * 100 </field>
+      <field id="clwc"    field_ref="field_atm_2D" long_name="atmosphere_mass_content_of_cloud_liquid_water" unit="kg m-2"/>
+      <field id="clivi"   field_ref="field_atm_2D" long_name="atmosphere_mass_content_of_cloud_ice_water" unit="kg m-2"/>
+      <field id="prw"     field_ref="field_atm_2D" long_name="precipitable_water" unit="kg m-2"/>
+      <field id="ozont"   field_ref="field_atm_2D" long_name="ozone total" unit="Dbs" name="ozont" />
+      <field id="prlic"   field_ref="field_atm_2D" long_name="convective liquid precipitation" unit="kg m-2 s-1"/>
+      <field id="prsnc"   field_ref="field_atm_2D" long_name="convective solid precipitation" unit="kg m-2 s-1"/>
+      <field id="prlils"  field_ref="field_atm_2D" long_name="large scale liquid precipitation" unit="kg m-2 s-1"/>
+      <field id="prsnls"  field_ref="field_atm_2D" long_name="large scale solid precipitation" unit="kg m-2 s-1"/>
+      <field id="rst"     field_ref="field_atm_2D" long_name="Radiation Shortwave Top" unit="W m-2"/>
+      <field id="rlut" 	  field_ref="field_atm_2D" long_name="Radiation Longwave Up Top" unit="W m-2"/>
+      <field id="rsdt" 	  field_ref="field_atm_2D" long_name="Radiation Shortwave Down Top" unit="W m-2"/>
+      <field id="rstcs"   field_ref="field_atm_2D" long_name="Radiation Shortwave Top Clear Sky" unit="W m-2"/>
+      <field id="rlutcs"  field_ref="field_atm_2D" long_name="Radiation Longwave Up Top Clear Sky" unit="W m-2"/>
+      <field id="rlscs"   field_ref="field_atm_2D" long_name="Radiation Longwave Surface Clear Sky" unit="W m-2"/>
+      <field id="rsscs"   field_ref="field_atm_2D" long_name="Radiation Shortwave Surface Clear Sky" unit="W m-2"/>
+      <field id="rsdscs"  field_ref="field_atm_2D" long_name="Radiation Shortwave Downward Surface Clear Sky" unit="W m-2"/>
+      <field id="rldscs"  field_ref="field_atm_2D" long_name="Radiation Longwave Surface Clear Sky" unit="W m-2"/>
+      <field id="FSU_ZBUDSO" field_ref="field_atm_2D" long_name="Shortwave radiation budget correction" unit="W m-2"/>
+      <field id="FSU_ZBUDTH" field_ref="field_atm_2D" long_name="Longwave radiation budget correction" unit="W m-2"/>
+      <field id="rlscln"    field_ref="field_atm_2D" long_name="Clean Radiation Longwave Surface" unit="W m-2"/>
+      <field id="rsscln"    field_ref="field_atm_2D" long_name="Clean Radiation Shortwave Surface" unit="W m-2"/>
+      <field id="rstcln"    field_ref="field_atm_2D" long_name="Clean Radiation Shortwave Top" unit="W m-2"/>
+      <field id="rlutcln"   field_ref="field_atm_2D" long_name="Clean Radiation Longwave Up Top" unit="W m-2"/>
+      <field id="rstcscln"  field_ref="field_atm_2D" long_name="Clean Radiation Shortwave Top Clear Sky" unit="W m-2"/>
+      <field id="rlutcscln" field_ref="field_atm_2D" long_name="Clean Radiation Longwave Up Top Clear Sky" unit="W m-2"/>
+      <field id="rlscscln"  field_ref="field_atm_2D" long_name="Clean Radiation Longwave Surface Clear Sky" unit="W m-2"/>
+      <field id="rsscscln"  field_ref="field_atm_2D" long_name="Clean Radiation Shortwave Surface Clear Sky" unit="W m-2"/>
+      <field id="rlsbis"    field_ref="field_atm_2D" long_name="Radiation Longwave Surface for second aerosol climatology" unit="W m-2"/>
+      <field id="rssbis"    field_ref="field_atm_2D" long_name="Radiation Shortwave Surface for second aerosol climatology" unit="W m-2"/>
+      <field id="rstbis"    field_ref="field_atm_2D" long_name="Radiation Shortwave Top for second aerosol climatology" unit="W m-2"/>
+      <field id="rlutbis"   field_ref="field_atm_2D" long_name="Radiation Longwave Up Top for second aerosol climatology" unit="W m-2"/>
+      <field id="rstcsbis"  field_ref="field_atm_2D" long_name="Radiation Shortwave Top Clear Sky for second aerosol climatology" unit="W m-2"/>
+      <field id="rlutcsbis" field_ref="field_atm_2D" long_name="Radiation Longwave Up Top Clear Sky for second aerosol climatology" unit="W m-2"/>
+      <field id="rlscsbis"  field_ref="field_atm_2D" long_name="Radiation Longwave Surface Clear Sky for second aerosol climatology" unit="W m-2"/>
+      <field id="rsscsbis"  field_ref="field_atm_2D" long_name="Radiation Shortwave Surface Clear Sky for second aerosol climatology" unit="W m-2"/>
+    </field_group>
+    
+    <field_group id="arpege_instant_3d" freq_op="6h" grid_ref="grid_atm_3D" >
+      <field id="pa"   field_ref="pressure" name="pa_m"       long_name="pressure" unit="Pa"/>
+      <field id="zg"   field_ref="field_atm_3D" name="zg_m"   long_name="geopotential height" unit="m">this/$gravit </field>
+      <field id="ta"   field_ref="field_atm_3D" name="ta_m"   long_name="air_temperature" unit="K"/>
+      <field id="ua"   field_ref="field_atm_3D" name="ua_m"   long_name="eastward_wind" unit="m s-1"/>
+      <field id="va"   field_ref="field_atm_3D" name="va_m"   long_name="northward" unit="m s-1"/>
+      <field id="hus"  field_ref="field_atm_3D" name="hus_m"  long_name="specific_humidity" unit="1"/>
+      <field id="hur"  field_ref="field_atm_3D" name="hur_m"  long_name="relative_humidity" unit="%"/>
+      <field id="wap"  field_ref="field_atm_3D" name="wap_m"  long_name="lagrangian_tendency_of_air_pressure" unit="Pa s-1"/>
+      <field id="tro3" field_ref="field_atm_3D" name="ozo_m"  long_name="mole_fraction_of_ozone_in_air" unit="1"/>
+    </field_group>
+
+    <field_group id="arpege_instant_3d_dm" freq_op="6h" detect_missing_value="true" grid_ref="grid_atm_3D" >
+      <!-- due to an Xios weakness, must declare these fields with
+	   detect_missing=true, for input to vertical interpolation -->
+      <field id="pa_dm"  field_ref="pa"   />
+      <field id="zg_dm"  field_ref="zg"   />
+      <field id="ta_dm"  field_ref="ta"   />
+      <field id="ua_dm"  field_ref="ua"   />
+      <field id="va_dm"  field_ref="va"   />
+      <field id="hus_dm" field_ref="hus"  />
+      <field id="hur_dm" field_ref="hur"  />
+      <field id="wap_dm" field_ref="wap"  />
+      <field id="ozo_dm" field_ref="tro3" />
+    </field_group>
+
+    <field_group id="arpege_3dp" grid_ref="grid_3D_p" freq_op="6h" detect_missing_value="true" >
+      <field id="pa_p"  field_ref="pa_dm"   name="pa"  />
+      <field id="zg_p"  field_ref="zg_dm"   name="zg"  />
+      <field id="ta_p"  field_ref="ta_dm"   name="ta"  />
+      <field id="ua_p"  field_ref="ua_dm"   name="ua"  />
+      <field id="va_p"  field_ref="va_dm"   name="va"  />
+      <field id="hus_p" field_ref="hus_dm"  name="hus" />
+      <field id="hur_p" field_ref="hur_dm"  name="hur" />
+      <field id="wap_p" field_ref="wap_dm"  name="wap" />
+      <field id="ozo_p" field_ref="tro3_dm" name="ozo" />
+    </field_group>
+
+    <field_group id="arpege_derived" freq_op="1ts" operation="average">
+      <field id="prli"   name="prli"   field_ref="prlic"  long_name="liquid precipitation" 
+	     unit="kg m-2 s-1" > prlic + prlils </field>
+      <field id="prsn"   name="prsn"   field_ref="prsnc"  long_name="solid precipitation" 
+	     unit="kg m-2 s-1" > prsnc + prsnls </field>
+      <field id="prc"    name="prc"    field_ref="prlic"  long_name="convective precipitation" 
+	     unit="kg m-2 s-1" > prlic + prsnc  </field>
+      <field id="prls"   name="prls"   field_ref="prlils" long_name="large scale precipitation" 
+	     unit="kg m-2 s-1" > prlils + prsnls </field>
+      <field id="pr"     name="pr"     field_ref="prc"    long_name="total precipitation" 
+	     unit="kg m-2 s-1" > prc + prls </field>
+      <field id="clwvi"  name="clwvi"  field_ref="clivi"  long_name="TBD" unit="kg m-2"     > clivi + clwc    </field>
+
+      <field id="rsut"   name="rsut"   field_ref="rsdt"   long_name="TBD" unit="W m-2"      > rsdt - rst      </field>
+      <field id="rsutcs" name="rsutcs" field_ref="rsdt"   long_name="TBD" unit="W m-2"      > rsdt - rstcs    </field>
+      <field id="rsuscs" name="rsuscs" field_ref="rsdscs" long_name="TBD" unit="W m-2"      > rsdscs + rsscs  </field>
+      <field id="rluscs" name="rluscs" field_ref="rldscs" long_name="TBD" unit="W m-2"      > rldscs + rlscs </field>
+      <field id="rtmt"   name="rtmt"   field_ref="rst"    long_name="TBD" unit="W m-2"      > rst - rlut      </field>
+    </field_group>
+
+  </field_group >
+
+</field_definition>
Index: /XIOS/trunk/inputs/TOY/arpsfx_files.xml
===================================================================
--- /XIOS/trunk/inputs/TOY/arpsfx_files.xml	(revision 1118)
+++ /XIOS/trunk/inputs/TOY/arpsfx_files.xml	(revision 1118)
@@ -0,0 +1,24 @@
+
+<file_definition  type="one_file">
+
+ <file_group timeseries="exclusive" append="true" time_units="days">
+
+
+  <file ts_prefix="./%file_name%" name="x1107_arpsfx_ts"
+	output_freq="1ts" split_freq="1d" enabled="true" >
+
+    <field_group  operation="average" expr="@this" 
+		 default_value="1.e+20" ts_split_freq="1mo" ts_enabled="true" >
+
+      <!-- Surfex fields -->
+      <field field_ref="tas" grid_ref="grid_complete" />
+      <!-- Arpege fields -->
+      <field field_ref="pa_p" grid_ref="grid_complete_3D_p" name="pa_p_complete"/>
+      <field field_ref="pa_p"                               name="pa_p_native"/>
+      <field field_ref="pa"                                 name="pa_native"/>
+      </field_group >
+  </file>
+
+ </file_group>
+
+</file_definition>
Index: /XIOS/trunk/inputs/TOY/context_arpsf.xml
===================================================================
--- /XIOS/trunk/inputs/TOY/context_arpsf.xml	(revision 1118)
+++ /XIOS/trunk/inputs/TOY/context_arpsf.xml	(revision 1118)
@@ -0,0 +1,82 @@
+<!-- -->
+<context id="arpsfx">
+  
+ <!-- <calendar type="Gregorian" start_date="1979-01-01 00:00:00 + 1199mo" time_origin="1850-01-01 00:00:00" /> -->
+
+  <variable_definition>
+    <!-- A few variables used for unit conversion -->
+    <variable id="coeffl"  type="float">2.5008E+6</variable> 
+    <variable id="coefflf" type="float">2.8345E+6</variable> 
+    <variable id="gravit" type="float">9.81</variable> 
+  </variable_definition> 
+
+  <scalar_definition>
+   <scalar id="scalar_atm" /> 
+   <scalar id="avg_scalar" > <reduce_domain operation="average"  /> </scalar>
+ </scalar_definition>
+
+ <axis_definition>
+    <axis id="axis_atm"/>
+    <axis id="presnivs" axis_ref="axis_atm"  standard_name="Vertical levels" unit="Pa"/>
+    <axis id="axis_srf"/>
+    <axis id="zonal_avg_axis" n_glo="10"> <reduce_domain operation="average" direction="iDir" /> </axis>
+    <axis id="pstd" positive="down" n_glo="9" value="(0,8)[100000. 85000. 70000. 50000. 20000. 10000. 5000. 2000. 1000.]">
+       <interpolate_axis type="polynomial" order="1" coordinate="pressure"/>
+    </axis>
+  </axis_definition>
+
+  <grid_definition>
+    <grid id="grid_atm_scalar"> <scalar scalar_ref="scalar_atm" /> </grid>
+    <grid id="grid_atm_1D"> <axis   axis_ref="axis_atm" /> </grid>    
+    <grid id="grid_atm_2D"> <domain domain_ref="domain_atm" /> </grid>    
+    <grid id="grid_atm_3D"> <domain domain_ref="domain_atm" /> <axis axis_ref="axis_atm" /> </grid>
+    <grid id="grid_atm"> <domain id="domain_atm" /> <axis id="axis_atm"/> </grid>
+    <grid id="grid_3D_p"> <domain id="domain_atm" /> <axis id="pstd"/> </grid>
+    <grid id="zonal_avg_grid"> <axis id="fiou" axis_ref="zonal_avg_axis" /> </grid>
+    <grid id="avg_grid"> <scalar id="scal" scalar_ref="avg_scalar" /> </grid>
+    <grid id="avg_profile"> <scalar scalar_ref="avg_scalar" /> <axis id="axis_atm"/> </grid>
+    <grid id="avg_profile_p"> <scalar scalar_ref="avg_scalar" /> <axis id="pstd"/> </grid>
+    <grid id="grid_complete"> <domain domain_ref="complete" /> </grid>
+    <grid id="grid_complete_3D"> <domain domain_ref="complete" /> <axis axis_ref="axis_atm" /> </grid>
+    <grid id="grid_complete_3D_p"> <domain domain_ref="complete" /> <axis axis_ref="pstd" /> </grid>
+  </grid_definition>
+  
+  <domain_definition>
+    <domain id="domain_atm" />
+    <domain id="domain_srf" />
+    <domain id="complete" ni_glo="256" nj_glo="128" type="rectilinear">
+      <generate_rectilinear_domain/>
+      <interpolate_domain order="1" renormalize="true"/><!-- write_weight="true" mode="read_or_compute" /-->
+    </domain>
+  </domain_definition>
+  
+  <field_definition level="1" prec="4" operation="average" freq_op="1ts" enabled=".true." default_value="1.e+20" >
+    <field id="field_atm_scalar" grid_ref="grid_atm_scalar" />
+    <field id="field_atm_1D" grid_ref="grid_atm_1D" />
+    <field id="field_atm_2D" grid_ref="grid_atm_2D" />
+    <field id="field_atm_3D" grid_ref="grid_atm_3D" />
+    <field id="field_sub"    grid_ref="grid_atm_2D" freq_op="2ts" operation="instant"/>
+    <field id="field_miss"   grid_ref="grid_atm_2D" detect_missing_value="true"/>
+
+    <!--field id="field_atm_3D" domain_ref="domain_atm" axis_ref="presnivs" detect_missing_value="true"/-->
+    <field id="pressure"     grid_ref="grid_atm_3D" detect_missing_value="true"/>
+    <field id="height"       grid_ref="grid_atm_3D"  />
+    <field id="field_3D_p"   grid_ref="grid_3D_p" field_ref="field_atm_3D"/>
+    <field id="field_3D_p_grid" grid_ref="grid_3D_p" field_ref="field_grid"/>
+
+    <field id="field_grid" grid_ref="grid_atm" detect_missing_value="true"/>   
+    <field id="hmv5"  field_ref="field_atm_2D" />
+
+    <field id="field_srf_2D" domain_ref="domain_srf" />
+    <field id="field_srf_3D" domain_ref="domain_srf" axis_ref="axis_srf" />
+    
+  </field_definition >
+
+  <field_definition src="./arpege_fields.xml"/>
+  <field_definition src="./surfex_fields.xml"/>
+
+  <file_definition src="./arpsfx_files.xml"/>
+
+  
+</context>
+
Index: /XIOS/trunk/inputs/TOY/context_nem.xml
===================================================================
--- /XIOS/trunk/inputs/TOY/context_nem.xml	(revision 1118)
+++ /XIOS/trunk/inputs/TOY/context_nem.xml	(revision 1118)
@@ -0,0 +1,21 @@
+<context id="nemo">
+
+  <!-- <calendar type="Gregorian" start_date="1979-01-01 00:00:00 + 1199mo" time_origin="1950-01-01 00:00:00" /> -->
+  
+  <axis_definition> <axis id="axis_oce"/> </axis_definition>
+
+  <domain_definition> <domain id="domain_oce" /> </domain_definition>
+
+  <grid_definition>    
+    <grid id="grid_oce_scalar"> <scalar id="scalar_oce" /> </grid>
+    <grid id="grid_2D" > <domain id="domain_oce" /> </grid>
+    <grid id="grid_3D" > <domain id="domain_oce" /> <axis id="axis_oce"  /> </grid>
+  </grid_definition>    
+
+  <field_definition level="1" prec="4" operation="average" enabled=".TRUE." default_value="1.e20" > 
+        <field id="field_oce_scalar" grid_ref="grid_oce_scalar" />
+        <field id="field_oce_grid_2D" grid_ref="grid_2D" />
+        <field id="field_oce_grid_3D" grid_ref="grid_3D" />
+   </field_definition >
+
+</context>
Index: /XIOS/trunk/inputs/TOY/iodef.xml
===================================================================
--- /XIOS/trunk/inputs/TOY/iodef.xml	(revision 1118)
+++ /XIOS/trunk/inputs/TOY/iodef.xml	(revision 1118)
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<simulation>
+
+  <context id="nemo"
+	   src="./context_nem.xml"/>
+  <context id="arpsfx"
+	   src="./context_arpsf.xml"/>
+  
+  <context id="xios">
+    <variable_definition>
+      <variable_group id="buffer">
+        <variable id="optimal_buffer_size" type="string">performance</variable>
+      </variable_group>
+      
+      <variable_group id="parameters" >
+        <variable id="info_level" type="int">100</variable>
+        <variable id="print_file" type="bool">true</variable>
+      </variable_group>
+    </variable_definition>
+  </context>
+
+</simulation>
Index: /XIOS/trunk/inputs/TOY/param.def
===================================================================
--- /XIOS/trunk/inputs/TOY/param.def	(revision 1118)
+++ /XIOS/trunk/inputs/TOY/param.def	(revision 1118)
@@ -0,0 +1,11 @@
+&param_toy
+ni_glo=256
+nj_glo=128
+llm=10
+timestep=1d
+sypd=1000000
+start_year=1850
+start_month=01
+start_day=01
+duration=1d
+/
Index: /XIOS/trunk/inputs/TOY/surfex_fields.xml
===================================================================
--- /XIOS/trunk/inputs/TOY/surfex_fields.xml	(revision 1118)
+++ /XIOS/trunk/inputs/TOY/surfex_fields.xml	(revision 1118)
@@ -0,0 +1,171 @@
+<field_definition  prec="8">
+
+  <field id="tsl" field_ref="field_atm_3D"/>
+
+  <field id="orog" field_ref="field_atm_2D"/>
+  <field id="sftlf" field_ref="field_atm_2D"/>
+  <field id="sftsf" field_ref="field_atm_2D"/>
+  <field id="sftlaf" field_ref="field_atm_2D"/>
+  <field id="ts" field_ref="field_atm_2D"/>
+  <field id="rlds" field_ref="field_atm_2D"/>
+  <field id="rlus" field_ref="field_atm_2D"/>
+  <field id="rsus" field_ref="field_atm_2D"/>
+  <field id="rsds" field_ref="field_atm_2D"/>
+  <field id="albsrfc" field_ref="field_atm_2D"/>
+  <field id="evspsbl" field_ref="field_atm_2D"/>
+  <field id="hfls" field_ref="field_atm_2D"/>
+  <field id="hfss" field_ref="field_atm_2D"/>
+  <field id="tas" field_ref="field_atm_2D"/>
+  <field id="uas" field_ref="field_atm_2D"/>
+  <field id="vas" field_ref="field_atm_2D"/>
+  <field id="sfcWind" field_ref="field_atm_2D"/>
+  <field id="hurs" field_ref="field_atm_2D"/>
+  <field id="huss" field_ref="field_atm_2D"/>
+  <field id="tauu" field_ref="field_atm_2D"/>
+  <field id="tauv" field_ref="field_atm_2D"/>
+  <field id="et" field_ref="field_atm_2D"/>
+  <field id="mrros" field_ref="field_atm_2D"/>
+  <field id="mrro" field_ref="field_atm_2D"/>
+  <field id="iceberg" field_ref="field_atm_2D"/>
+  <field id="snmsl" field_ref="field_atm_2D"/>
+  <field id="mrsos" field_ref="field_atm_2D"/>
+  <field id="rzwc" field_ref="field_atm_2D"/>
+  <field id="mrso" field_ref="field_atm_2D"/>
+  <field id="mrfso" field_ref="field_atm_2D"/>
+  <field id="tws" field_ref="field_atm_2D"/>
+  <field id="mrsow" field_ref="field_atm_2D"/>
+  <field id="vegstress" field_ref="field_atm_2D"/>
+  <field id="fldplainfrac" field_ref="field_atm_2D"/>
+  <field id="wtd_isba" field_ref="field_atm_2D"/>
+  <field id="wtdf_isba" field_ref="field_atm_2D"/>
+  <field id="dmlt" field_ref="field_atm_2D"/>
+  <field id="dfr" field_ref="field_atm_2D"/>
+  <field id="snd" field_ref="field_atm_2D"/>
+  <field id="snc" field_ref="field_atm_2D"/>
+  <field id="snct" field_ref="field_atm_2D"/>
+  <field id="agesno" field_ref="field_atm_2D"/>
+  <field id="ts_land" field_ref="field_atm_2D"/>
+  <field id="albsrfc_land" field_ref="field_atm_2D"/>
+  <field id="tsns" field_ref="field_atm_2D"/>
+  <field id="tsn" field_ref="field_atm_2D"/>
+  <field id="gpp" field_ref="field_atm_2D"/>
+  <field id="npp" field_ref="field_atm_2D"/>
+  <field id="watbud_isba" field_ref="field_atm_2D"/>
+  <field id="nrjbuds_isba" field_ref="field_atm_2D"/>
+  <field id="nrjbud_isba" field_ref="field_atm_2D"/>
+  <field id="ts_sea" field_ref="field_atm_2D"/>
+  <field id="albsrfc_sea" field_ref="field_atm_2D"/>
+  <field id="evspsbl_sea" field_ref="field_atm_2D"/>
+  <field id="sitemptop" field_ref="field_atm_2D"/>
+  <field id="sialb" field_ref="field_atm_2D"/>
+  <field id="sic" field_ref="field_atm_2D"/>
+  <field id="sithick" field_ref="field_atm_2D"/>
+  <field id="tsLa" field_ref="field_atm_2D"/>
+  <field id="albsrfcLa" field_ref="field_atm_2D"/>
+  <field id="evspsblLa" field_ref="field_atm_2D"/>
+
+
+  
+
+
+  <field id="tas_min"     field_ref="tas"     operation="minimum"/>
+  <field id="tas_max"     field_ref="tas"     operation="maximum"/> 
+  <field id="sfcWind_max" field_ref="sfcWind" operation="maximum"/>
+
+  <field_group detect_missing_value="true" >
+    <field id="tsnl"/>
+    <field id="lwsnl"/>
+    <field id="snct"/>
+    <field id="agesno"/>
+    <field id="albsrfc_land"/>
+    <field id="albsrfc_sea"/>
+    <field id="sialb"/>
+    <field id="albsrfc"/>
+    <field id="albsn"/>
+    <field id="wtd_isba"/>
+    <field id="sisnthick"/>
+    <field id="sithick"/>
+    <field id="sialb"/>
+    <field id="sitemptop"/>
+  </field_group>
+
+  <field_group id="sfx_fix" >
+      <field field_ref="orog"/>
+      <field field_ref="sftlf"/>
+      <field field_ref="sftsf"/>
+      <field field_ref="sftlaf"/>
+  </field_group>
+  <field_group id="sfx_global" >
+      <field field_ref="ts"/>
+      <field field_ref="rlds"/>
+      <field field_ref="rlus"/>
+      <field field_ref="rsus"/>
+      <field field_ref="rsds"/>
+      <field field_ref="albsrfc"/>
+      <field field_ref="evspsbl"/>
+      <field field_ref="hfls"/>
+      <field field_ref="hfss"/>
+      <field field_ref="tas"/>
+      <field field_ref="tas" name="tasmin" freq_op="1d" operation="average"> @tas_min </field>
+      <field field_ref="tas" name="tasmax" freq_op="1d" operation="average"> @tas_max </field>
+      <field field_ref="uas"/>
+      <field field_ref="vas"/>
+      <field field_ref="sfcWind"/>
+      <field field_ref="sfcWind" name="sfcWindmax" freq_op="1d" operation="average"> @sfcWind_max </field>
+      <field field_ref="hurs"/>
+      <field field_ref="huss"/>
+      <field field_ref="tauu"/>
+      <field field_ref="tauv"/>
+  </field_group>
+  <field_group id="sfx_land_3d" >
+      <field field_ref="tsl"/>
+  </field_group>
+  <field_group id="sfx_land" >
+      <field field_ref="et"/>
+      <field field_ref="mrros"/>
+      <field field_ref="mrro"/>
+      <field field_ref="iceberg"/>
+      <field field_ref="snmsl"/>
+      <field field_ref="mrsos"/>
+      <field field_ref="rzwc"/>
+      <field field_ref="mrso"/>
+      <field field_ref="mrfso"/>
+      <field field_ref="tws"/>
+      <field field_ref="mrsow"/>
+      <field field_ref="vegstress"/>
+      <field field_ref="fldplainfrac"/>
+      <field field_ref="wtd_isba"/>
+      <field field_ref="wtdf_isba"/>
+      <field field_ref="dmlt"/>
+      <field field_ref="dfr"/>
+      <field field_ref="snd"/>
+      <field field_ref="snc"/>
+      <field field_ref="snct"/>
+      <field field_ref="agesno"/>
+      <field field_ref="ts_land"/>
+      <field field_ref="albsrfc_land"/>
+      <field field_ref="tsns"/>
+      <field field_ref="tsn"/>
+      <field field_ref="gpp"/>
+      <field field_ref="npp"/>
+      <field field_ref="watbud_isba"/>
+      <field field_ref="nrjbuds_isba"/>
+      <field field_ref="nrjbud_isba"/>
+  </field_group>
+  <field_group id="sfx_sea" >
+      <field field_ref="ts_sea"/>
+      <field field_ref="albsrfc_sea"/>
+      <field field_ref="evspsbl_sea"/>
+  </field_group>
+  <field_group id="sfx_seaice" >
+      <field field_ref="sitemptop"/>
+      <field field_ref="sialb"/>
+      <field field_ref="sic"/>
+      <field field_ref="sithick"/>
+  </field_group>
+  <field_group id="sfx_lake" >
+      <field field_ref="tsLa"/>
+      <field field_ref="albsrfcLa"/>
+      <field field_ref="evspsblLa"/>
+  </field_group>
+</field_definition>
Index: /XIOS/trunk/inputs/TOYSTEPHANE/.fuse_hidden0000270f00000001
===================================================================
--- /XIOS/trunk/inputs/TOYSTEPHANE/.fuse_hidden0000270f00000001	(revision 1118)
+++ /XIOS/trunk/inputs/TOYSTEPHANE/.fuse_hidden0000270f00000001	(revision 1118)
@@ -0,0 +1,24 @@
+
+<file_definition  type="one_file">
+
+  <file ts_prefix="@IOXDIR@/%file_name%" name="@EXPID@_arpsfx_daily"
+	output_freq="1d" split_freq="1y" timeseries="exclusive"
+	append="true" time_units="days" enabled="false" >
+
+    <field_group  operation="average" 
+		  expr="@this" default_value="1.e+20"
+		  ts_split_freq="1y" ts_enabled="true" > 
+
+      <field field_ref="pa_p" grid_ref="grid_complete_3D_p_id" name="pa_id"/>
+    </field_group>
+  </file>
+
+  <file name="output" output_freq="1d" >
+    <field field_ref="pa_p" grid_ref="grid_complete_3D_p" name="pa_complete_ref" default_value="1.e+20" />
+    <field field_ref="pressure" grid_ref="grid_3D_p" name="pa_p_ref" />
+    <field field_ref="pa_p" name="pa_p" />
+    <field field_ref="pa_clone" name="pa_clone" />
+    <field field_ref="pa_p_clone" name="pa_p_clone" />
+  </file>
+
+</file_definition>
Index: /XIOS/trunk/src/test/toy_cmip6.f90
===================================================================
--- /XIOS/trunk/src/test/toy_cmip6.f90	(revision 1118)
+++ /XIOS/trunk/src/test/toy_cmip6.f90	(revision 1118)
@@ -0,0 +1,343 @@
+PROGRAM toy_cmip6 
+
+  USE xios
+  USE mod_wait
+  IMPLICIT NONE
+  INCLUDE "mpif.h"
+
+  INTEGER,PARAMETER :: il_unit=10
+  INTEGER :: comm, rank, size_loc, ierr
+  INTEGER :: ni,ibegin,iend,nj,jbegin,jend
+  INTEGER :: i,j,l,ts,n, nb_pt, il_run
+  DOUBLE PRECISION :: sypd, timestep_in_seconds, simulated_seconds_per_seconds, elapsed_per_timestep
+  CHARACTER(len=*),PARAMETER :: id="client"
+  CHARACTER(1000):: duration, timestep
+  INTEGER :: start_year,start_month,start_day
+  TYPE(xios_date) :: cdate, edate
+  TYPE(xios_duration)  :: dtime
+  TYPE(xios_context) :: ctx_hdl
+  REAL :: ilon,jlat
+  DOUBLE PRECISION,ALLOCATABLE :: lon_glo(:,:),lat_glo(:,:),lval(:)
+  DOUBLE PRECISION,ALLOCATABLE :: field_A_glo (:,:,:), pressure_glo (:,:,:), height_glo (:,:,:)
+  DOUBLE PRECISION,ALLOCATABLE :: bounds_lon_glo(:,:,:),bounds_lat_glo(:,:,:)
+  DOUBLE PRECISION,ALLOCATABLE :: pressure (:,:,:), height (:,:,:)
+  DOUBLE PRECISION,ALLOCATABLE :: lon(:,:),lat(:,:),lonvalue(:,:)
+  DOUBLE PRECISION,ALLOCATABLE :: bounds_lon(:,:,:),bounds_lat(:,:,:) 
+  DOUBLE PRECISION,ALLOCATABLE :: field_atm_2D(:,:),field_atm_3D(:,:,:),field_srf_2D(:),field_srf_3D(:,:)
+  DOUBLE PRECISION,ALLOCATABLE :: field_atm_2D_miss(:,:)
+  DOUBLE PRECISION,ALLOCATABLE :: field_oce_2D(:,:),field_oce_3D(:,:,:)
+  INTEGER, ALLOCATABLE :: kindex(:)
+
+  INTEGER :: ni_glo, nj_glo,llm
+
+  NAMELIST /param_toy/ ni_glo, nj_glo,llm,timestep,duration,sypd,start_year,start_month,start_day
+
+!!! MPI Initialization
+
+  CALL MPI_INIT(ierr)
+
+  CALL init_wait
+
+!!! Lecture des parametres du run
+
+  OPEN(unit=il_unit, file='param.def',status='old',iostat=ierr)
+  READ (il_unit, nml=param_toy)
+  !PRINT *, ni_glo, nj_glo,llm,duration
+
+!!! XIOS Initialization (get the local communicator)
+
+  CALL xios_initialize(id,return_comm=comm)
+
+  CALL MPI_COMM_RANK(comm,rank,ierr)
+  CALL MPI_COMM_SIZE(comm,size_loc,ierr)
+
+
+!!! Initialisation et allocation des coordonnÃ©es globales et locales pour la grille rÃ©guliÃšre
+
+  ALLOCATE (lon_glo(ni_glo,nj_glo),lat_glo(ni_glo,nj_glo))
+  ALLOCATE(bounds_lon_glo(4,ni_glo,nj_glo))
+  ALLOCATE(bounds_lat_glo(4,ni_glo,nj_glo))
+  ALLOCATE (field_A_glo(ni_glo,nj_glo,llm))
+  ALLOCATE (pressure_glo(ni_glo,nj_glo,llm))
+  ALLOCATE (height_glo(ni_glo,nj_glo,llm))
+  ALLOCATE (lval(llm))
+
+  DO j=1,nj_glo
+    DO i=1,ni_glo
+
+      ilon=i-0.5
+      jlat=j-0.5
+
+      lat_glo(i,j)= 90-(jlat*180./nj_glo)
+      lon_glo(i,j)= (ilon*360./ni_glo)
+      !print*, 'i/lon=',i,'lon=',lon_glo(i,j), 'j/lat=',j,'lat=',lat_glo(i,j)
+
+      bounds_lat_glo(1,i,j)= 90-((jlat-0.5)*180./nj_glo)
+      bounds_lon_glo(1,i,j)=((ilon-0.5)*360./ni_glo)
+
+      bounds_lat_glo(2,i,j)= 90-((jlat-0.5)*180./nj_glo)
+      bounds_lon_glo(2,i,j)=((ilon+0.5)*360./ni_glo)
+
+      bounds_lat_glo(3,i,j)= 90-((jlat+0.5)*180./nj_glo)
+      bounds_lon_glo(3,i,j)=((ilon+0.5)*360./ni_glo)
+
+      bounds_lat_glo(4,i,j)= 90-((jlat+0.5)*180./nj_glo)
+      bounds_lon_glo(4,i,j)=((ilon-0.5)*360./ni_glo)
+
+      WHERE (abs(bounds_lat_glo(:,i,j) - 90) < 0.000000001) bounds_lat_glo(:,i,j) = 90
+      WHERE (abs(bounds_lat_glo(:,i,j) + 90) < 0.000000001) bounds_lat_glo(:,i,j) = -90
+
+      DO l=1,llm
+         field_A_glo(i,j,l)=(i-1)+(j-1)*ni_glo+10000*l
+         ! pressure at half levels. First index value is high altitude, low pressure
+         pressure_glo(i,j,l)=((l-0.)/llm)*100000 + (jlat -nj_glo/2.)/nj_glo * 10000
+         height_glo(i,j,l)=(llm-l+0.5)/llm * 15000 + jlat * 100
+      ENDDO
+    ENDDO
+  ENDDO
+  ni=ni_glo ; ibegin=0
+
+  jbegin=0
+  DO n=0,size_loc-1
+    nj=nj_glo/size_loc
+    IF (n<MOD(nj_glo,size_loc)) nj=nj+1
+    IF (n==rank) exit
+    jbegin=jbegin+nj
+  ENDDO
+
+  iend=ibegin+ni-1 ; jend=jbegin+nj-1
+
+  ALLOCATE(lon(ni,nj),lat(ni,nj),lonvalue(ni,nj))
+  ALLOCATE(bounds_lon(4,ni,nj))
+  ALLOCATE(bounds_lat(4,ni,nj))
+  lon(:,:)=lon_glo(ibegin+1:iend+1,jbegin+1:jend+1)
+  lat(:,:)=lat_glo(ibegin+1:iend+1,jbegin+1:jend+1)
+  bounds_lon(:,:,:)=bounds_lon_glo(:,ibegin+1:iend+1,jbegin+1:jend+1)
+  bounds_lat(:,:,:)=bounds_lat_glo(:,ibegin+1:iend+1,jbegin+1:jend+1)
+
+
+  DO i=1,llm
+    lval(i)=i
+ ENDDO
+ 
+
+  
+!###########################################################################
+! Contexte ATM
+!###########################################################################
+ ALLOCATE(field_atm_2D(0:ni+1,-1:nj+2),field_atm_3D(0:ni+1,-1:nj+2,llm))
+ ALLOCATE(field_atm_2D_miss(0:ni+1,-1:nj+2))
+ ALLOCATE(pressure(0:ni+1,-1:nj+2,llm))
+ ALLOCATE(height(0:ni+1,-1:nj+2,llm))
+  field_atm_2D(1:ni,1:nj)=field_A_glo(ibegin+1:iend+1,jbegin+1:jend+1,1)
+  field_atm_2D_miss(1:ni,1:nj)=field_A_glo(ibegin+1:iend+1,jbegin+1:jend+1,1)
+  field_atm_3D(1:ni,1:nj,:)=field_A_glo(ibegin+1:iend+1,jbegin+1:jend+1,:)
+  pressure(1:ni,1:nj,:)=pressure_glo(ibegin+1:iend+1,jbegin+1:jend+1,:)
+  height(1:ni,1:nj,:)=height_glo(ibegin+1:iend+1,jbegin+1:jend+1,:)
+
+  CALL xios_context_initialize("arpsfx",comm)
+  CALL xios_define_calendar("Gregorian", &
+     start_date=xios_date(start_year,start_month,start_day,0,0,0), &
+     time_origin=xios_date(1850,1,1,0,0,0))
+
+  !write(0,*) 'atm context initialized' ; call flush(0)
+  CALL xios_get_handle("arpsfx",ctx_hdl)
+  CALL xios_set_current_context(ctx_hdl)
+
+  CALL xios_set_axis_attr("axis_atm",n_glo=llm ,value=lval) ;
+
+  CALL xios_set_domain_attr("domain_atm",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, &
+       ni=ni,jbegin=jbegin,nj=nj, type='rectilinear')
+  CALL xios_set_domain_attr("domain_atm",data_dim=2, data_ibegin=-1, &
+       data_ni=ni+2, data_jbegin=-2, data_nj=nj+4)
+  CALL xios_set_domain_attr("domain_atm",lonvalue_2D=lon,latvalue_2D=lat)
+  CALL xios_set_domain_attr("domain_atm", nvertex=4, bounds_lon_2d=bounds_lon, bounds_lat_2d=bounds_lat)
+  print *,'latmax/min=',minval(lat),maxval(lat)
+  print *,'latmax/min bounds=',minval(bounds_lat),maxval(bounds_lat)
+  print *,'lonmax/min=',minval(lon),maxval(lon)
+  print *,'lonmax/min bounds=',minval(bounds_lon),maxval(bounds_lon)
+
+
+!!! Definition du timestep
+
+  CALL xios_get_start_date(cdate)
+  edate=cdate+xios_duration_convert_from_string(duration)
+  dtime=xios_duration_convert_from_string(timestep)
+  CALL xios_set_timestep(timestep=dtime)
+
+!!! Fin de la definition du contexte
+
+  !CALL xios_close_context_definition()
+
+!!! Calcul de temps elaps par seconde pour respecter le SYPD (hyp : pas de dÃ©lai d'I/O)
+  
+  timestep_in_seconds=xios_date_convert_to_seconds(cdate+dtime) - xios_date_convert_to_seconds(cdate)
+  simulated_seconds_per_seconds=sypd * 365 
+  elapsed_per_timestep=timestep_in_seconds/simulated_seconds_per_seconds ! in seconds
+
+!###########################################################################
+! Contexte SRF
+!###########################################################################
+
+!!! Initialisation des coordonnÃ©es globales et locales pour la grille indexee (1 point sur 2)
+
+    nb_pt=ni*nj/2
+    ALLOCATE(kindex(nb_pt),field_srf_2D(nb_pt),field_srf_3D(nb_pt,llm))
+    DO i=1,nb_pt
+      kindex(i)=2*i-1
+    ENDDO
+    field_srf_2D(1:nb_pt)=RESHAPE(field_A_glo(ibegin+1:iend+1:2,jbegin+1:jend+1,1),(/ nb_pt /))
+    field_srf_3D(1:nb_pt,:)=RESHAPE(field_A_glo(ibegin+1:iend+1:2,jbegin+1:jend+1,:),(/ nb_pt,llm /))
+
+  !CALL xios_context_initialize("surface",comm)
+  !CALL xios_get_handle("surface",ctx_hdl)
+  !CALL xios_set_current_context(ctx_hdl)
+
+  CALL xios_set_axis_attr("axis_srf",n_glo=llm ,value=lval)
+  CALL xios_set_domain_attr("domain_srf",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj, type='rectilinear')
+  CALL xios_set_domain_attr("domain_srf",data_dim=1, data_ibegin=0, data_ni=nb_pt)
+  CALL xios_set_domain_attr("domain_srf",data_i_index=kindex)
+  CALL xios_set_domain_attr("domain_srf",lonvalue_2D=lon,latvalue_2D=lat)
+  CALL xios_set_domain_attr("domain_srf", nvertex=4, bounds_lon_2d=bounds_lon, bounds_lat_2d=bounds_lat)
+
+!!! Definition du timestep
+
+  !dtime%second=timestep
+  !dtime=xios_duration_convert_from_string(timestep)
+  !CALL xios_set_timestep(timestep=dtime)
+
+!!! Fin de la definition du contexte SRF
+
+  CALL xios_close_context_definition()
+  !write(0,*) 'srf context def closed' ; call flush(0)
+
+!###########################################################################
+! Contexte OCE
+!###########################################################################
+  ALLOCATE(field_oce_2D(0:ni+1,-1:nj+2),field_oce_3D(0:ni+1,-1:nj+2,llm))
+  field_oce_2D(1:ni,1:nj)=field_A_glo(ibegin+1:iend+1,jbegin+1:jend+1,1)
+  field_oce_3D(1:ni,1:nj,:)=field_A_glo(ibegin+1:iend+1,jbegin+1:jend+1,:)
+
+  CALL xios_context_initialize("nemo",comm)
+  CALL xios_define_calendar("Gregorian", &
+     start_date=xios_date(start_year,start_month,start_day,0,0,0), &
+     time_origin=xios_date(1850,1,1,0,0,0))
+  CALL xios_get_handle("nemo",ctx_hdl)
+  CALL xios_set_current_context(ctx_hdl)
+
+  CALL xios_set_axis_attr("axis_oce",n_glo=llm ,value=lval) ;
+
+  CALL xios_set_domain_attr("domain_oce",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj, type='curvilinear')
+  CALL xios_set_domain_attr("domain_oce",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4)
+  CALL xios_set_domain_attr("domain_oce",lonvalue_2D=lon,latvalue_2D=lat)
+
+
+!!! Definition du timestep
+
+  dtime=xios_duration_convert_from_string(timestep)
+  CALL xios_set_timestep(timestep=dtime)
+
+  CALL xios_close_context_definition()
+
+!####################################################################################
+!!! Boucle temporelle
+!####################################################################################
+  ts=1
+  cdate=cdate+dtime
+  DO while ( cdate <= edate )
+
+      CALL xios_get_handle("arpsfx",ctx_hdl)
+      CALL xios_set_current_context(ctx_hdl)
+
+!!! Mise a jour du pas de temps
+
+      CALL xios_update_calendar(ts)
+
+!!! On donne la valeur du champ atm
+
+      !print *,'sending field_atm_2d at timestep',ts
+      CALL xios_send_field("field_atm_scalar",field_atm_2D(1,1)+ts)
+      CALL xios_send_field("field_atm_1D",field_atm_3D(1,1,:)+ts)
+      CALL xios_send_field("field_atm_2D",field_atm_2D+ts)
+      CALL xios_send_field("field_atm_3D",field_atm_3D+ts)
+      CALL xios_send_field("pressure" ,pressure)
+      CALL xios_send_field("height"   ,height)
+      if (mod(ts,2)==0) then
+         CALL xios_send_field("field_sub",field_atm_2D+ts)
+      endif
+      !! On crÃ©e un champ avec des missings qui bougent
+      !! dans le temps : un bande verticale de 1 Ã  ni-3
+      field_atm_2D_miss(:,:)= field_atm_2D(:,:)+ts
+      field_atm_2D_miss(mod(ts,ni-3)+1,:)=1.e+20
+      CALL xios_send_field("field_miss",field_atm_2D_miss)
+      
+!!! On change de contexte
+
+      !CALL xios_get_handle("surface",ctx_hdl)
+      !CALL xios_set_current_context(ctx_hdl)
+
+!!! Mise a jour du pas de temps
+
+      !CALL xios_update_calendar(ts)
+
+!!! On donne la valeur du champ srf
+
+      CALL xios_send_field("field_srf_2D",field_srf_2D)
+      CALL xios_send_field("field_srf_3D",field_srf_3D)
+
+!!! On change de contexte
+
+      CALL xios_get_handle("nemo",ctx_hdl)
+      CALL xios_set_current_context(ctx_hdl)
+
+!!! Mise a jour du pas de temps
+
+      CALL xios_update_calendar(ts)
+
+!!! On donne la valeur du champ oce
+
+      CALL xios_send_field("field_oce_scalar",field_oce_2D(1,1)+ts)
+      CALL xios_send_field("field_oce_grid_2D",field_oce_2D)
+      CALL xios_send_field("field_oce_grid_3D",field_oce_3D)
+
+      CALL wait_us(int(elapsed_per_timestep*1.e6))   ! micro-secondes
+      cdate=cdate+dtime
+      ts=ts+1
+
+   ENDDO
+
+!####################################################################################
+!!! Finalisation
+!####################################################################################
+
+!!! Fin des contextes
+
+    CALL xios_context_finalize()
+    CALL xios_get_handle("arpsfx",ctx_hdl)
+    CALL xios_set_current_context(ctx_hdl)
+    CALL xios_context_finalize()
+    !CALL xios_get_handle("surface",ctx_hdl)
+    !CALL xios_set_current_context(ctx_hdl)
+    !CALL xios_context_finalize()
+
+    DEALLOCATE(lon, lat, lonvalue, field_atm_2D, field_atm_3D)
+    DEALLOCATE(pressure,height,pressure_glo,height_glo)
+    DEALLOCATE(kindex, field_srf_2D, field_srf_3D)
+    DEALLOCATE(field_oce_2D, field_oce_3D)
+    DEALLOCATE(lon_glo,lat_glo,field_A_glo,lval)
+
+!!! Fin de XIOS
+
+    CALL MPI_COMM_FREE(comm, ierr)
+      
+    CALL xios_finalize()
+
+  CALL MPI_FINALIZE(ierr)
+
+END PROGRAM toy_cmip6 
+
+
+
+
+
+
