Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/io/nc4_data_input.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/io/nc4_data_input.cpp	(revision 1882)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/io/nc4_data_input.cpp	(revision 1930)
@@ -43,5 +43,5 @@
   CATCH
 
-  void CNc4DataInput::readFieldData_(CField* field, CArray<double,1>& dataOut)
+  void CNc4DataInput::readFieldData_(CField* field, int record, CArray<double,1>& dataOut)
   TRY
   {
@@ -50,16 +50,12 @@
     CGrid* grid = field->getGrid();
 
-    if (!grid->doGridHaveDataToWrite())
-      if (SuperClass::type==MULTI_FILE || !isCollective) return;
+    if (!grid->doGridHaveDataToWrite())  if (SuperClass::type==MULTI_FILE || !isCollective) return;
 
     StdString fieldId = field->getFieldOutputName();
 
-    CArray<double,1> fieldData(grid->getWrittenDataSize());
-    if (!field->default_value.isEmpty()) fieldData = field->default_value;
-
     switch (SuperClass::type)
     {
       case MULTI_FILE:
-        SuperClassWriter::getData(fieldData, fieldId, isCollective, (field->getNStep() - 1)%field->nstepMax );
+        SuperClassWriter::getData(dataOut, fieldId, isCollective, record );
         break;
       case ONE_FILE:
@@ -108,17 +104,7 @@
         }
 
-        SuperClassWriter::getData(fieldData, fieldId, isCollective, (field->getNStep() - 1)%field->nstepMax, &start, &count);
+        SuperClassWriter::getData(dataOut, fieldId, isCollective, record, &start, &count);
         break;
       }
-    }
-
-    field->inputField(fieldData, dataOut);
-
-    if (!field->scale_factor.isEmpty() || !field->add_offset.isEmpty())
-    {
-      double scaleFactor = 1.0, addOffset = 0.0;
-      if (!field->scale_factor.isEmpty()) scaleFactor = field->scale_factor;
-      if (!field->add_offset.isEmpty()) addOffset = field->add_offset;
-      field->invertScaleFactorAddOffset(dataOut,scaleFactor, addOffset);
     }
   }
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/io/nc4_data_input.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/io/nc4_data_input.hpp	(revision 1882)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/io/nc4_data_input.hpp	(revision 1930)
@@ -37,5 +37,5 @@
     // Read methods
     virtual StdSize getFieldNbRecords_(CField* field);
-    virtual void readFieldData_(CField* field, CArray<double,1>& data);
+    virtual void readFieldData_(CField* field, int record, CArray<double,1>& data);
     virtual void readFieldAttributes_(CField* field, bool readAttributeValues);
     virtual void closeFile_(void);
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 1882)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/io/nc4_data_output.cpp	(revision 1930)
@@ -58,5 +58,5 @@
         StdString lonName,latName ;
          
-        domain->computeWrittenIndex();
+        //domain->computeWrittenIndex();
         domain->computeWrittenCompressedIndex(comm_file);
 
@@ -319,11 +319,11 @@
                    {
                      case CDomain::type_attr::curvilinear :                       
-                       SuperClassWriter::writeData(writtenLat, latid, isCollective, 0);
-                       SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0);
+                       SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0);
+                       SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0);
                        break;
                      case CDomain::type_attr::rectilinear :
-                       CArray<double,1> lat = writtenLat(Range(fromStart,toEnd,domain->ni)) ;
+                       CArray<double,1> lat = domain->latvalue(Range(fromStart,toEnd,domain->ni)) ;
                        SuperClassWriter::writeData(CArray<double,1>(lat.copy()), latid, isCollective, 0);
-                       CArray<double,1> lon = writtenLon(Range(0,domain->ni-1)) ;
+                       CArray<double,1> lon = domain->lonvalue(Range(0,domain->ni-1)) ;
                        SuperClassWriter::writeData(CArray<double,1>(lon.copy()), lonid, isCollective, 0);
                        break;
@@ -332,6 +332,6 @@
                    if (domain->hasBounds)
                    {
-                     SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0);
-                     SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0);
+                     SuperClassWriter::writeData(domain->bounds_lonvalue, bounds_lonid, isCollective, 0);
+                     SuperClassWriter::writeData(domain->bounds_latvalue, bounds_latid, isCollective, 0);
                    }
                  }
@@ -339,5 +339,5 @@
                  if (domain->hasArea)
                  {
-                   SuperClassWriter::writeData(writtenArea, areaId, isCollective, 0);                   
+                   SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0);                   
                  }
 
@@ -432,6 +432,9 @@
                      if (domain->hasLonLat)
                      {
-                       SuperClassWriter::writeData(writtenLat, latid, isCollective, 0,&start,&count);
-                       SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0,&start,&count);
+//                       SuperClassWriter::writeData(writtenLat, latid, isCollective, 0,&start,&count);
+//                       SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0,&start,&count);
+                       SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0,&start,&count);
+                       SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0,&start,&count);
+
                      }
                      break;
@@ -443,23 +446,14 @@
                        std::vector<StdSize> start(1) ;
                        std::vector<StdSize> count(1) ;
-                       if (domain->isEmpty())
-                       {
-                         start[0]=0 ;
-                         count[0]=0 ;
-                         SuperClassWriter::writeData(writtenLat, latid, isCollective, 0,&start,&count);
-                         SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0,&start,&count);
-                       }
-                       else
-                       { 
-                         start[0]=domain->jbegin;
-                         count[0]=domain->nj;
-                         CArray<double,1> lat = writtenLat(Range(fromStart,toEnd,domain->ni));
-                         SuperClassWriter::writeData(CArray<double,1>(lat.copy()), latid, isCollective, 0,&start,&count);
-
-                         start[0]=domain->ibegin;
-                         count[0]=domain->ni;
-                         CArray<double,1> lon = writtenLon(Range(0,domain->ni-1));
-                         SuperClassWriter::writeData(CArray<double,1>(lon.copy()), lonid, isCollective, 0,&start,&count);
-                       }
+                       
+                       start[0]=domain->jbegin;
+                       count[0]=domain->nj;
+                       CArray<double,1> lat = domain->latvalue(Range(fromStart,toEnd,domain->ni));
+                       SuperClassWriter::writeData(CArray<double,1>(lat.copy()), latid, isCollective, 0,&start,&count);
+
+                       start[0]=domain->ibegin;
+                       count[0]=domain->ni;
+                       CArray<double,1> lon = domain->lonvalue(Range(0,domain->ni-1));
+                       SuperClassWriter::writeData(CArray<double,1>(lon.copy()), lonid, isCollective, 0,&start,&count);
                      }
                      break;
@@ -486,6 +480,8 @@
                    }
                  
-                   SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0, &start, &count);
-                   SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0, &start, &count);
+//                   SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0, &start, &count);
+//                   SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0, &start, &count);
+                   SuperClassWriter::writeData(domain->bounds_lonvalue, bounds_lonid, isCollective, 0, &start, &count); // will probably not working for rectilinear
+                   SuperClassWriter::writeData(domain->bounds_latvalue, bounds_latid, isCollective, 0, &start, &count);
                  }
 
@@ -495,18 +491,10 @@
                    std::vector<StdSize> count(2);
 
-                   if (domain->isEmpty())
-                   {
-                     start[0] = 0; start[1] = 0;
-                     count[0] = 0; count[1] = 0;
-                   }
-                   else
-                   {
-                     start[1] = domain->ibegin;
-                     start[0] = domain->jbegin;
-                     count[1] = domain->ni;
-                     count[0] = domain->nj;
-                   }
+                   start[1] = domain->ibegin;
+                   start[0] = domain->jbegin;
+                   count[1] = domain->ni;
+                   count[0] = domain->nj;
                    
-                   SuperClassWriter::writeData(writtenArea, areaId, isCollective, 0, &start, &count);
+                   SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0, &start, &count);
                  }
 
@@ -1044,15 +1032,20 @@
                  if (domain->hasLonLat)
                  {
-                   SuperClassWriter::writeData(writtenLat, latid, isCollective, 0);
-                   SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0);
+//                   SuperClassWriter::writeData(writtenLat, latid, isCollective, 0);
+//                   SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0);
+                   SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0);
+                   SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0);
                    if (domain->hasBounds)
                    {
-                     SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0);
-                     SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0);
+//                     SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0);
+//                     SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0);
+                     SuperClassWriter::writeData(domain->bounds_lonvalue, bounds_lonid, isCollective, 0);
+                     SuperClassWriter::writeData(domain->bounds_latvalue, bounds_latid, isCollective, 0);
                    }
                  }
 
                  if (domain->hasArea)
-                   SuperClassWriter::writeData(writtenArea, areaId, isCollective, 0);
+//                   SuperClassWriter::writeData(writtenArea, areaId, isCollective, 0);
+                   SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0);
 
                  SuperClassWriter::definition_start();
@@ -1126,15 +1119,15 @@
                  if (domain->hasLonLat)
                  {
-                   SuperClassWriter::writeData(writtenLat, latid, isCollective, 0,&start,&count);
-                   SuperClassWriter::writeData(writtenLon, lonid, isCollective, 0,&start,&count);
+                   SuperClassWriter::writeData(domain->latvalue, latid, isCollective, 0,&start,&count);
+                   SuperClassWriter::writeData(domain->lonvalue, lonid, isCollective, 0,&start,&count);
                    if (domain->hasBounds)
                    {
-                     SuperClassWriter::writeData(writtenBndsLon, bounds_lonid, isCollective, 0,&startBounds,&countBounds);
-                     SuperClassWriter::writeData(writtenBndsLat, bounds_latid, isCollective, 0,&startBounds,&countBounds);
+                     SuperClassWriter::writeData(domain->bounds_lonvalue, bounds_lonid, isCollective, 0,&startBounds,&countBounds);
+                     SuperClassWriter::writeData(domain->bounds_latvalue, bounds_latid, isCollective, 0,&startBounds,&countBounds);
                    }
                  }
 
                  if (domain->hasArea)
-                   SuperClassWriter::writeData(writtenArea, areaId, isCollective, 0, &start, &count);
+                   SuperClassWriter::writeData(domain->areavalue, areaId, isCollective, 0, &start, &count);
 
                  SuperClassWriter::definition_start();
@@ -1166,5 +1159,5 @@
         axis->checkAttributes();
 
-        axis->computeWrittenIndex();
+//        axis->computeWrittenIndex();
         axis->computeWrittenCompressedIndex(comm_file);
        
@@ -1303,5 +1296,5 @@
               {
                 if (!axis->value.isEmpty())
-                  SuperClassWriter::writeData(axis_value, axisid, isCollective, 0);
+                  SuperClassWriter::writeData(axis->value, axisid, isCollective, 0);
 
                 if (!axis->bounds.isEmpty())
@@ -1321,5 +1314,5 @@
                     }
                   }
-                  SuperClassWriter::writeData(axis_bounds, axisBoundsId, isCollective, 0);
+                  SuperClassWriter::writeData(axis->bounds, axisBoundsId, isCollective, 0);
                 }
               }
@@ -1342,5 +1335,5 @@
               {
                 if (!axis->value.isEmpty())
-                  SuperClassWriter::writeData(axis_value, axisid, isCollective, 0, &start, &count);
+                  SuperClassWriter::writeData(axis->value, axisid, isCollective, 0, &start, &count);
 
                 if (!axis->bounds.isEmpty())
@@ -1360,5 +1353,5 @@
                     }
                   }
-                  SuperClassWriter::writeData(axis_bounds, axisBoundsId, isCollective, 0, &startBounds, &countBounds);
+                  SuperClassWriter::writeData(axis->bounds, axisBoundsId, isCollective, 0, &startBounds, &countBounds);
                 }
               }
@@ -2475,5 +2468,9 @@
              field->outputCompressedField(dataIn, fieldData);
            else
-             field->outputField(dataIn, fieldData);
+           {
+             //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);
