Index: XIOS/dev/dev_olga/src/io/nc4_data_output.cpp
===================================================================
--- XIOS/dev/dev_olga/src/io/nc4_data_output.cpp	(revision 1054)
+++ XIOS/dev/dev_olga/src/io/nc4_data_output.cpp	(revision 1099)
@@ -74,8 +74,8 @@
          else setWrittenDomain(domid);
 
-        const std::vector<int>& local_size_write  = domain->getLocalWriteSize();
-        const std::vector<int>& global_size_write = domain->getGlobalWriteSize();
-        const std::vector<int>& start_write = domain->getStartWriteIndex();
-        const std::vector<int>& count_write = domain->getCountWriteIndex();
+        // const std::vector<int>& local_size_write  = domain->getLocalWriteSize();
+        // const std::vector<int>& global_size_write = domain->getGlobalWriteSize();
+        // const std::vector<int>& start_write = domain->getStartWriteIndex();
+        // const std::vector<int>& count_write = domain->getCountWriteIndex();
         int nvertex = (domain->nvertex.isEmpty()) ? 0 : domain->nvertex;
 
@@ -140,6 +140,6 @@
                  bounds_latid = StdString("bounds_lat").append(appendDomid);
 
-                 SuperClassWriter::addDimension(dimXid, local_size_write[0]);
-                 SuperClassWriter::addDimension(dimYid, local_size_write[1]);
+                 SuperClassWriter::addDimension(dimXid, domain->zoom_ni);
+                 SuperClassWriter::addDimension(dimYid, domain->zoom_nj);
 
                  if (domain->hasBounds)
@@ -148,12 +148,16 @@
                  if (server->intraCommSize > 1)
                  {
-                   this->writeLocalAttributes(0, count_write[0],
-                                              0, count_write[1],
+                   this->writeLocalAttributes(domain->zoom_ibegin,
+                                              domain->zoom_ni,
+                                              domain->zoom_jbegin,
+                                              domain->zoom_nj,
                                               appendDomid);
 
                    if (singleDomain)
                     this->writeLocalAttributes_IOIPSL(dimXid, dimYid,
-                                                      0, count_write[0],
-                                                      0, count_write[1],
+                                                      domain->zoom_ibegin,
+                                                      domain->zoom_ni,
+                                                      domain->zoom_jbegin,
+                                                      domain->zoom_nj,
                                                       domain->ni_glo,domain->nj_glo,
                                                       server->intraCommRank,server->intraCommSize);
@@ -228,7 +232,7 @@
                        break;
                      case CDomain::type_attr::rectilinear :
-                       CArray<double,1> lat = domain->latvalue(Range(fromStart,toEnd,local_size_write[0])) ;
+                       CArray<double,1> lat = domain->latvalue(Range(fromStart,toEnd,domain->zoom_ni)) ;
                        SuperClassWriter::writeData(CArray<double,1>(lat.copy()), latid, isCollective, 0);
-                       CArray<double,1> lon = domain->lonvalue(Range(0,local_size_write[1])) ;
+                       CArray<double,1> lon = domain->lonvalue(Range(0,domain->zoom_ni-1)) ;
 //                       CArray<double,1> lon = domain->lonvalue(Range(0,local_size_write[1]-1)) ;
                        SuperClassWriter::writeData(CArray<double,1>(lon.copy()), lonid, isCollective, 0);
@@ -252,6 +256,6 @@
               case (ONE_FILE) :
               {
-                 SuperClassWriter::addDimension(dimXid, global_size_write[0]);
-                 SuperClassWriter::addDimension(dimYid, global_size_write[1]);
+                 SuperClassWriter::addDimension(dimXid, domain->global_zoom_ni);
+                 SuperClassWriter::addDimension(dimYid, domain->global_zoom_nj);
 
                  if (domain->hasBounds)
@@ -327,11 +331,11 @@
                      else
                      {
-                       // start[1]=domain->zoom_ibegin_srv-domain->global_zoom_ibegin;
-                       // start[0]=domain->zoom_jbegin_srv-domain->global_zoom_jbegin;
-                       // count[1]=domain->zoom_ni_srv ; count[0]=domain->zoom_nj_srv ;
-                       start[1]= start_write[0];
-                       start[0]= start_write[1];
-                       count[1]= count_write[0];
-                       count[0]= count_write[1];
+                       start[1]=domain->zoom_ibegin-domain->global_zoom_ibegin;
+                       start[0]=domain->zoom_jbegin-domain->global_zoom_jbegin;
+                       count[1]=domain->zoom_ni ; count[0]=domain->zoom_nj ;
+                       // start[1]= start_write[0];
+                       // start[0]= start_write[1];
+                       // count[1]= count_write[0];
+                       // count[0]= count_write[1];
                      }
 
@@ -359,12 +363,16 @@
                        else
                        {
-                         start[0]= start_write[1];
-                         count[0]= count_write[1];
-                         CArray<double,1> lat = domain->latvalue(Range(fromStart,toEnd,count_write[0])) ;
+                         // start[0]= start_write[1];
+                         // count[0]= count_write[1];
+                         start[0]=domain->zoom_jbegin-domain->global_zoom_jbegin;
+                         count[0]=domain->zoom_nj;
+                         CArray<double,1> lat = domain->latvalue(Range(fromStart,toEnd,domain->zoom_ni)) ;
                          SuperClassWriter::writeData(CArray<double,1>(lat.copy()), latid, isCollective, 0,&start,&count);
 
-                         start[0]= start_write[0];
-                         count[0]= count_write[0];
-                         CArray<double,1> lon=domain->lonvalue(Range(0,count_write[1])) ;
+                         // start[0]= start_write[0];
+                         // count[0]= count_write[0];
+                         start[0]=domain->zoom_ibegin-domain->global_zoom_ibegin;
+                         count[0]=domain->zoom_ni;
+                         CArray<double,1> lon=domain->lonvalue(Range(0,domain->zoom_ni-1)) ;
                          SuperClassWriter::writeData(CArray<double,1>(lon.copy()), lonid, isCollective, 0,&start,&count);
                        }
@@ -386,9 +394,9 @@
                    {
                      start[2] = 0;
-                     start[1] = start_write[0];
-                     start[0] = start_write[1];
-                     count[2] = nvertex;
-                     count[1] = count_write[0];
-                     count[0] = count_write[1];
+                     start[1] = domain->zoom_ibegin - domain->global_zoom_ibegin;
+                     start[0] = domain->zoom_jbegin - domain->global_zoom_jbegin;
+                     count[2] = domain->nvertex;
+                     count[1] = domain->zoom_ni;
+                     count[0] = domain->zoom_nj;
                    }
 
@@ -409,13 +417,13 @@
                    else
                    {
-                     // start[1] = domain->zoom_ibegin_srv - domain->global_zoom_ibegin;
-                     // start[0] = domain->zoom_jbegin_srv - domain->global_zoom_jbegin;
-                     // count[1] = domain->zoom_ni_srv;
-                     // count[0] = domain->zoom_nj_srv;
-
-                     start[1]= start_write[0];
-                     start[0]= start_write[1];
-                     count[1]= count_write[0];
-                     count[0]= count_write[1];
+                     start[1] = domain->zoom_ibegin - domain->global_zoom_ibegin;
+                     start[0] = domain->zoom_jbegin - domain->global_zoom_jbegin;
+                     count[1] = domain->zoom_ni;
+                     count[0] = domain->zoom_nj;
+
+                     // start[1]= start_write[0];
+                     // start[0]= start_write[1];
+                     // count[1]= count_write[0];
+                     // count[0]= count_write[1];
                    }
 
@@ -1048,10 +1056,18 @@
         axis->checkAttributes();
 
-        int local_size_write  = axis->getLocalWriteSize();
-        int global_size_write = axis->getGlobalWriteSize();
-        int start_write = axis->getStartWriteIndex();
-        int count_write = axis->getCountWriteIndex();
-
-        if ((0 == local_size_write) && (MULTI_FILE == SuperClass::type)) return;
+        // int local_size_write  = axis->getLocalWriteSize();
+        // int global_size_write = axis->getGlobalWriteSize();
+        // int start_write = axis->getStartWriteIndex();
+        // int count_write = axis->getCountWriteIndex();
+
+
+        // if ((0 == local_size_write) && (MULTI_FILE == SuperClass::type)) return;
+
+        int zoom_size  = (MULTI_FILE == SuperClass::type) ? axis->zoom_n
+                                                          : axis->global_zoom_n;
+        int zoom_begin = (MULTI_FILE == SuperClass::type) ? axis->zoom_begin
+                                                          : axis->global_zoom_begin;
+
+        if ((0 == axis->zoom_n) && (MULTI_FILE == SuperClass::type)) return;
 
         std::vector<StdString> dims;
@@ -1062,5 +1078,5 @@
         try
         {
-          SuperClassWriter::addDimension(axisid, global_size_write);
+          SuperClassWriter::addDimension(axisid, zoom_size);
           if (axis->hasValue)
           {
@@ -1102,6 +1118,6 @@
               case MULTI_FILE:
               {
-                CArray<double,1> axis_value(local_size_write);
-                for (int i = 0; i < local_size_write; i++) axis_value(i) = axis->value(i);
+                CArray<double,1> axis_value(axis->zoom_n);
+                for (int i = 0; i < axis->zoom_n; i++) axis_value(i) = axis->value(i);
                 SuperClassWriter::writeData(axis_value, axisid, isCollective, 0);
 
@@ -1115,11 +1131,10 @@
               case ONE_FILE:
               {
-                CArray<double,1> axis_value(count_write);
+                CArray<double,1> axis_value(axis->zoom_n);
                 axis_value = axis->value;
-
                 std::vector<StdSize> start(1), startBounds(2) ;
                 std::vector<StdSize> count(1), countBounds(2) ;
-                start[0] = startBounds[0] = start_write;
-                count[0] = countBounds[0] = count_write;
+                start[0] = startBounds[0] = zoom_begin - axis->global_zoom_begin;
+                count[0] = countBounds[0] = zoom_size;
                 startBounds[1] = 0;
                 countBounds[1] = 2;
@@ -2295,12 +2310,16 @@
                         // start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);
                         // count.push_back(nZoomSizeServer[idx]);
-                        start.push_back((domain->getStartWriteIndex())[idx]);
-                        count.push_back((domain->getCountWriteIndex())[idx]);
+                        // start.push_back((domain->getStartWriteIndex())[idx]);
+                        // count.push_back((domain->getCountWriteIndex())[idx]);
+                        start.push_back(domain->zoom_jbegin - domain->global_zoom_jbegin);
+                        count.push_back(domain->zoom_nj);
                       }
                       --idx ;
                       // start.push_back(nZoomBeginServer[idx] - nZoomBeginGlobal[idx]);
                       // count.push_back(nZoomSizeServer[idx]);
-                      start.push_back((domain->getStartWriteIndex())[idx]);
-                      count.push_back((domain->getCountWriteIndex())[idx]);
+                      // start.push_back((domain->getStartWriteIndex())[idx]);
+                      // count.push_back((domain->getCountWriteIndex())[idx]);
+                        start.push_back(domain->zoom_ibegin - domain->global_zoom_ibegin);
+                        count.push_back(domain->zoom_ni);
                       --idx ;
                       --idxDomain;
@@ -2309,6 +2328,8 @@
                     {
                       CAxis* axis = CAxis::get(axisList[idxAxis]);
-                      start.push_back(axis->getStartWriteIndex());
-                      count.push_back(axis->getCountWriteIndex());
+                      // start.push_back(axis->getStartWriteIndex());
+                      // count.push_back(axis->getCountWriteIndex());
+                        start.push_back(axis->zoom_begin - axis->global_zoom_begin);
+                        count.push_back(axis->zoom_n);
                       --idx;
                       --idxAxis;
