Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/io/nc4_data_output.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/io/nc4_data_output.cpp	(revision 1959)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/io/nc4_data_output.cpp	(revision 1961)
@@ -1713,16 +1713,8 @@
         }
 
-        if (compressedOutput && grid->isCompressible())
+        while (!dimIdList.empty())
         {
-          dims.push_back(grid->getId() + "_points");
-          field->setUseCompressedOutput();
-        }
-        else
-        {
-          while (!dimIdList.empty())
-          {
-            dims.push_back(dimIdList.back());
-            dimIdList.pop_back();
-          }
+          dims.push_back(dimIdList.back());
+          dimIdList.pop_back();
         }
 
@@ -2070,13 +2062,13 @@
       //---------------------------------------------------------------
 
-      void CNc4DataOutput::writeFieldData_ (CField*  field, const CArray<double,1>& data)
+      int CNc4DataOutput::writeFieldData_ (CField*  field, const CArray<double,1>& data, const CDate& lastWrite,
+                                           const CDate& currentWrite, int nstep)
       {
         CContext* context = CContext::getCurrent();
         CGrid* grid = field->getGrid();
-        CArray<double,1> dataIn(data.copy()) ;
-
-        if (field->getNStep()<1) 
+       
+        if (nstep<1) 
         {
-          return;
+          return nstep;
         }
         
@@ -2084,5 +2076,5 @@
           if (SuperClass::type == MULTI_FILE || !isCollective)
           {
-            return;
+            return nstep;
           }
 
@@ -2109,5 +2101,5 @@
             factorUnit=context->getCalendar()->getDayLengthInSeconds() ;
             else factorUnit=1 ;
-            field->resetNStep(getRecordFromTime(field->last_Write_srv,factorUnit) + 1);
+            nstep = getRecordFromTime(field->last_Write_srv,factorUnit) + 1;
           }
 
@@ -2128,12 +2120,9 @@
         if (wtime)
         {
-          Time lastWrite = field->last_Write_srv;
-          Time lastLastWrite = field->lastlast_Write_srv;
-
           
           if (field->hasTimeInstant)
           {
-            time_data(0) = time_data_bound(1) = lastWrite;
-            time_data_bound(0) = time_data_bound(1) = lastWrite;
+            time_data(0) = time_data_bound(1) = (Time) lastWrite;
+            time_data_bound(0) = time_data_bound(1) = (Time) currentWrite;
             if (timeCounterType==instant)
             {
@@ -2147,7 +2136,7 @@
           else if (field->hasTimeCentered)
           {
-            time_data(0) = (lastWrite + lastLastWrite) / 2;
-            time_data_bound(0) = lastLastWrite;
-            time_data_bound(1) = lastWrite;
+            time_data(0) = ((Time)currentWrite + (Time)lastWrite) / 2;
+            time_data_bound(0) = (Time)lastWrite;
+            time_data_bound(1) = (Time)currentWrite;
             if (timeCounterType==centered)
             {
@@ -2162,6 +2151,6 @@
           if (timeCounterType==record)
           {
-            time_counter(0) = field->getNStep() - 1;
-            time_counter_bound(0) = time_counter_bound(1) = field->getNStep() - 1;
+            time_counter(0) = nstep - 1;
+            time_counter_bound(0) = time_counter_bound(1) = nstep - 1;
             wtimeCounter=true ;
           }
@@ -2179,35 +2168,6 @@
          bool isRoot = (context->intraCommRank_ == 0);
 
-         if (!field->scale_factor.isEmpty() || !field->add_offset.isEmpty())
-         {
-           double scaleFactor = 1.0;
-           double addOffset = 0.0;
-           if (!field->scale_factor.isEmpty()) scaleFactor = field->scale_factor;
-           if (!field->add_offset.isEmpty()) addOffset = field->add_offset;
-           field->scaleFactorAddOffset(dataIn, scaleFactor, addOffset);
-         }
-
          try
          {
-           size_t writtenSize;
-           if (field->getUseCompressedOutput())
-             writtenSize = grid->getNumberWrittenIndexes();
-           else
-             writtenSize = grid->getWrittenDataSize();
-
-           CArray<double,1> fieldData(writtenSize);
-           if (!field->default_value.isEmpty()) fieldData = field->default_value;
-
-           if (field->getUseCompressedOutput()) fieldData.reference(dataIn) ;
-             // field->outputCompressedField(dataIn, fieldData);
-           else
-           {
-             //field->outputField(dataIn, fieldData);
-             if (!field->default_value.isEmpty()) field->getGrid()->getWorkflowToFullConnector()->transfer(dataIn, fieldData, (double)field->default_value ) ;
-             else field->getGrid()->getWorkflowToFullConnector()->transfer(dataIn, fieldData ) ;
-           }
-
-           if (!field->prec.isEmpty() && field->prec == 2) fieldData = round(fieldData);
-
            switch (SuperClass::type)
            {
@@ -2215,5 +2175,5 @@
               {
                  CTimer::get("Files : writing data").resume();
-                 SuperClassWriter::writeData(fieldData, fieldid, isCollective, field->getNStep() - 1);
+                 SuperClassWriter::writeData(data, fieldid, isCollective, nstep - 1);
                  CTimer::get("Files : writing data").suspend();
                  if (wtime)
@@ -2222,11 +2182,11 @@
                    if ( wtimeData)
                    {
-                       SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, field->getNStep() - 1, isRoot);
-                       SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1, isRoot);
+                       SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, nstep - 1, isRoot);
+                       SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, nstep - 1, isRoot);
                   }
                    if (wtimeCounter)
                    {
-                     SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1,isRoot);
-                     if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1, isRoot);
+                     SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, nstep - 1,isRoot);
+                     if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, nstep - 1, isRoot);
                    }
                    CTimer::get("Files : writing time axis").suspend();
@@ -2316,5 +2276,5 @@
                     }
                   }
-              }
+                }
                 else
                 {
@@ -2368,5 +2328,5 @@
 
                 CTimer::get("Files : writing data").resume();
-                SuperClassWriter::writeData(fieldData, fieldid, isCollective, field->getNStep() - 1, &start, &count);
+                SuperClassWriter::writeData(data, fieldid, isCollective, nstep - 1, &start, &count);
                 CTimer::get("Files : writing data").suspend();
 
@@ -2376,11 +2336,11 @@
                    if ( wtimeData)
                    {
-                     SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, field->getNStep() - 1, isRoot);
-                     SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, field->getNStep() - 1, isRoot);
+                     SuperClassWriter::writeTimeAxisData(time_data, timeAxisId, isCollective, nstep - 1, isRoot);
+                     SuperClassWriter::writeTimeAxisDataBounds(time_data_bound, timeAxisBoundId, isCollective, nstep - 1, isRoot);
                    }
                    if (wtimeCounter)
                    {
-                     SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1,isRoot);
-                     if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1, isRoot);
+                     SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, nstep - 1,isRoot);
+                     if (timeCounterType!=record) SuperClassWriter::writeTimeAxisDataBounds(time_counter_bound, timeBoundId, isCollective, nstep - 1, isRoot);
 
                    }
@@ -2391,4 +2351,5 @@
               }
             }
+            return nstep ;
          }
          catch (CNetCdfException& e)
