Index: /XIOS/trunk/src/node/domain.cpp
===================================================================
--- /XIOS/trunk/src/node/domain.cpp	(revision 664)
+++ /XIOS/trunk/src/node/domain.cpp	(revision 665)
@@ -28,5 +28,5 @@
       , hasBounds(false), hasArea(false), isDistributed_(false), nGlobDomain_(), isUnstructed_(false)
       , global_zoom_ni(0), global_zoom_ibegin(0), global_zoom_nj(0), global_zoom_jbegin(0)
-      , isClientAfterTransformationChecked(false)
+      , isClientAfterTransformationChecked(false), hasLonLat(false)
       , lonvalue_client(), latvalue_client(), bounds_lon_client(), bounds_lat_client()
    { /* Ne rien faire de plus */ }
@@ -37,5 +37,5 @@
       , hasBounds(false), hasArea(false), isDistributed_(false), nGlobDomain_(), isUnstructed_(false)
       , global_zoom_ni(0), global_zoom_ibegin(0), global_zoom_nj(0), global_zoom_jbegin(0)
-      , isClientAfterTransformationChecked(false)
+      , isClientAfterTransformationChecked(false), hasLonLat(false)
       , lonvalue_client(), latvalue_client(), bounds_lon_client(), bounds_lat_client()
    { /* Ne rien faire de plus */ }
@@ -574,88 +574,12 @@
 
    //----------------------------------------------------------------
-
    void CDomain::completeLonLatClient(void)
    {
      completeLonClient();
      completeLatClient();
-//      int i,j,k ;
-//      CArray<double,1> lonvalue_temp(ni*nj) ;
-//      CArray<double,1> latvalue_temp(ni*nj) ;
-//      CArray<double,2> bounds_lon_temp(nvertex,ni*nj);
-//      CArray<double,2> bounds_lat_temp(nvertex,ni*nj);
-//
-//      if (type.isEmpty())
-//      {
-//        if ( lonvalue.numElements() == ni*nj && latvalue.numElements() == ni*nj )
-//        {
-//          type.setValue(type_attr::curvilinear) ;
-//          isCurvilinear=true ;
-//        }
-//        else if ( lonvalue.numElements() == ni && latvalue.numElements() == nj )
-//        {
-//          type.setValue(type_attr::regular) ;
-//          isCurvilinear=false ;
-//        }
-//        else ERROR("void CDomain::completeLonLatClient(void)",<<"the grid is nor curvilinear, nor cartesian, because the size of longitude and latitude array is not coherent with the domain size"<<endl
-//                                                              <<"lonvalue size = " << lonvalue.numElements() << "different of ni or ni*nj"<<endl
-//                                                              <<"latvalue size = " << latvalue.numElements() << "different of nj or ni*nj" ) ;
-//      }
-//      if (type==type_attr::curvilinear || type==type_attr::unstructured)
-//      {
-//        lonvalue_temp=lonvalue ;
-//        latvalue_temp=latvalue ;
-//        if (hasBounds) bounds_lon_temp=bounds_lon ;
-//        if (hasBounds) bounds_lat_temp=bounds_lat ;
-//      }checkBounds
-//      else
-//      {
-//        for(j=0;j<nj;j++)
-//          for(i=0;i<ni;i++)
-//          {
-//            k=j*ni+i ;
-//            lonvalue_temp(k)=lonvalue(i) ;
-//            latvalue_temp(k)=latvalue(j) ;
-//            if (hasBounds)
-//            {
-//              for(int n=0;n<nvertex;n++)
-//              {
-//                bounds_lon_temp(n,k)=bounds_lon(n,i) ;
-//                bounds_lat_temp(n,k)=bounds_lat(n,j) ;
-//              }
-//            }
-//          }
-//      }
-//
-//      StdSize dm = zoom_ni_client * zoom_nj_client;
-//
-//      // Make sure that this attribute is non-empty for every client.
-//      if (0 != dm)
-//      {
-//        lonvalue.resize(dm);
-//        latvalue.resize(dm);
-//      }
-//
-//
-//      for (int i = 0; i < zoom_ni_client; i++)
-//      {
-//        for (int j = 0; j < zoom_nj_client; j++)
-//        {
-//          lonvalue(i + j * zoom_ni_client) = lonvalue_temp( (i + zoom_ibegin_client-ibegin) + (j + zoom_jbegin_client -jbegin)*ni );
-//          latvalue(i + j * zoom_ni_client) = latvalue_temp( (i + zoom_ibegin_client - ibegin)+(j + zoom_jbegin_client - jbegin)*ni );
-//          if (hasBounds)
-//          {
-//            for(int n=0;n<nvertex;n++)
-//            {
-//              bounds_lon(n,i + j * zoom_ni_client) = bounds_lon_temp( n, (i + zoom_ibegin_client - ibegin) + (j + zoom_jbegin_client -jbegin)*ni );
-//              bounds_lat(n,i + j * zoom_ni_client) = bounds_lat_temp( n, (i + zoom_ibegin_client - ibegin)+(j + zoom_jbegin_client -jbegin)*ni );
-//            }
-//          }
-//        }
-//      }
-    }
+   }
 
 
    //----------------------------------------------------------------
-
    void CDomain::checkZoom(void)
    {
@@ -763,4 +687,10 @@
    }
 
+   void CDomain::checkLonLat()
+   {
+     hasLonLat = (!latvalue_1d.isEmpty() && !lonvalue_1d.isEmpty()) ||
+                 (!latvalue_2d.isEmpty() && !lonvalue_2d.isEmpty());
+   }
+
    void CDomain::checkAttributesOnClientAfterTransformation()
    {
@@ -772,6 +702,6 @@
      {
        this->checkMask();
-       this->computeConnectedServer();
-       this->completeLonLatClient();
+       if (hasLonLat || hasArea) this->computeConnectedServer();
+       if (hasLonLat) this->completeLonLatClient();
      }
 
@@ -790,4 +720,5 @@
       this->checkBounds();
       this->checkArea();
+      this->checkLonLat();
 
       if (context->hasClient)
@@ -815,6 +746,6 @@
      if (context->hasClient)
      {
-       sendServerAttribut() ;
-       sendLonLatArea() ;
+       sendServerAttribut();
+       if (hasLonLat || hasArea) sendLonLatArea();
      }
 
@@ -829,4 +760,5 @@
       this->checkDomain();
       this->checkZoom();
+      this->checkLonLat();
       this->checkBounds();
       this->checkArea();
@@ -1015,5 +947,5 @@
   }
 
-  void CDomain::sendLonLatArea(void)
+  void CDomain::sendIndex()
   {
     int ns, n, i, j, ind, nv, idx;
@@ -1021,15 +953,8 @@
     CContextClient* client=context->client;
 
-    // send lon lat for each connected server
     CEventClient eventIndex(getType(), EVENT_ID_INDEX);
-    CEventClient eventLon(getType(), EVENT_ID_LON);
-    CEventClient eventLat(getType(), EVENT_ID_LAT);
-    CEventClient eventArea(getType(), EVENT_ID_AREA);
-
-    list<CMessage> list_msgsIndex, list_msgsLon, list_msgsLat, list_msgsArea;
+
+    list<CMessage> list_msgsIndex;
     list<CArray<int,1> > list_indi, list_indj;
-    list<CArray<double,1> > list_lon, list_lat;
-    list<CArray<double,2> > list_boundslon, list_boundslat;
-    list<CArray<double,1> > list_area;
 
     std::map<int, std::vector<size_t> >::const_iterator it, iteMap;
@@ -1045,4 +970,95 @@
       list_indi.push_back(CArray<int,1>(nbData));
       list_indj.push_back(CArray<int,1>(nbData));
+
+      CArray<int,1>& indi = list_indi.back();
+      CArray<int,1>& indj = list_indj.back();
+      const std::vector<size_t>& temp = it->second;
+      for (n = 0; n < nbData; ++n)
+      {
+        idx = static_cast<int>(it->second[n]);
+        indi(n) = i_index(idx);
+        indj(n) = j_index(idx);
+      }
+
+      list_msgsIndex.push_back(CMessage());
+
+      list_msgsIndex.back() << this->getId() << (int)type; // enum ne fonctionne pour les message => ToFix
+      list_msgsIndex.back() << isCurvilinear;
+      list_msgsIndex.back() << list_indi.back() << list_indj.back();
+
+      eventIndex.push(rank, nbConnectedClients_[rank], list_msgsIndex.back());
+    }
+
+    client->sendEvent(eventIndex);
+  }
+
+  void CDomain::sendArea()
+  {
+    if (!hasArea) return;
+
+    int ns, n, i, j, ind, nv, idx;
+    CContext* context = CContext::getCurrent();
+    CContextClient* client=context->client;
+
+    // send area for each connected server
+    CEventClient eventArea(getType(), EVENT_ID_AREA);
+
+    list<CMessage> list_msgsArea;
+    list<CArray<double,1> > list_area;
+
+    std::map<int, std::vector<size_t> >::const_iterator it, iteMap;
+    iteMap = indSrv_.end();
+    for (int k = 0; k < connectedServerRank_.size(); ++k)
+    {
+      int nbData = 0;
+      int rank = connectedServerRank_[k];
+      it = indSrv_.find(rank);
+      if (iteMap != it)
+        nbData = it->second.size();
+      list_area.push_back(CArray<double,1>(nbData));
+
+      const std::vector<size_t>& temp = it->second;
+      for (n = 0; n < nbData; ++n)
+      {
+        idx = static_cast<int>(it->second[n]);
+        i = i_index(idx);
+        j = j_index(idx);
+        if (hasArea)
+          list_area.back()(n) = area(i - ibegin, j - jbegin);
+      }
+
+      list_msgsArea.push_back(CMessage());
+      list_msgsArea.back() << this->getId() << list_area.back();
+      eventArea.push(rank, nbConnectedClients_[rank], list_msgsArea.back());
+    }
+    client->sendEvent(eventArea);
+  }
+
+  void CDomain::sendLonLat()
+  {
+    if (!hasLonLat) return;
+
+    int ns, n, i, j, ind, nv, idx;
+    CContext* context = CContext::getCurrent();
+    CContextClient* client=context->client;
+
+    // send lon lat for each connected server
+    CEventClient eventLon(getType(), EVENT_ID_LON);
+    CEventClient eventLat(getType(), EVENT_ID_LAT);
+
+    list<CMessage> list_msgsLon, list_msgsLat;
+    list<CArray<double,1> > list_lon, list_lat;
+    list<CArray<double,2> > list_boundslon, list_boundslat;
+
+    std::map<int, std::vector<size_t> >::const_iterator it, iteMap;
+    iteMap = indSrv_.end();
+    for (int k = 0; k < connectedServerRank_.size(); ++k)
+    {
+      int nbData = 0;
+      int rank = connectedServerRank_[k];
+      it = indSrv_.find(rank);
+      if (iteMap != it)
+        nbData = it->second.size();
+
       list_lon.push_back(CArray<double,1>(nbData));
       list_lat.push_back(CArray<double,1>(nbData));
@@ -1053,9 +1069,5 @@
         list_boundslat.push_back(CArray<double,2>(nvertex, nbData));
       }
-      if (hasArea)
-        list_area.push_back(CArray<double,1>(nbData));
-
-      CArray<int,1>& indi = list_indi.back();
-      CArray<int,1>& indj = list_indj.back();
+
       CArray<double,1>& lon = list_lon.back();
       CArray<double,1>& lat = list_lat.back();
@@ -1082,17 +1094,5 @@
           }
         }
-
-        indi(n) = i;
-        indj(n) = j;
-
-        if (hasArea)
-          list_area.back()(n) = area(i - ibegin, j - jbegin);
-      }
-
-      list_msgsIndex.push_back(CMessage());
-
-      list_msgsIndex.back() << this->getId() << (int)type; // enum ne fonctionne pour les message => ToFix
-      list_msgsIndex.back() << isCurvilinear;
-      list_msgsIndex.back() << list_indi.back() << list_indj.back();
+      }
 
       list_msgsLon.push_back(CMessage());
@@ -1108,21 +1108,18 @@
       }
 
-      eventIndex.push(rank, nbConnectedClients_[rank], list_msgsIndex.back());
       eventLon.push(rank, nbConnectedClients_[rank], list_msgsLon.back());
       eventLat.push(rank, nbConnectedClients_[rank], list_msgsLat.back());
-
-      if (hasArea)
-      {
-        list_msgsArea.push_back(CMessage());
-        list_msgsArea.back() << this->getId() << list_area.back();
-        eventArea.push(rank, nbConnectedClients_[rank], list_msgsArea.back());
-      }
-    }
-
-    client->sendEvent(eventIndex);
+    }
+
     client->sendEvent(eventLon);
     client->sendEvent(eventLat);
-    if (hasArea)
-      client->sendEvent(eventArea);
+  }
+
+
+  void CDomain::sendLonLatArea(void)
+  {
+    sendIndex();
+    sendLonLat();
+    sendArea();
   }
 
Index: /XIOS/trunk/src/node/domain.hpp
===================================================================
--- /XIOS/trunk/src/node/domain.hpp	(revision 664)
+++ /XIOS/trunk/src/node/domain.hpp	(revision 665)
@@ -90,4 +90,5 @@
          void checkBounds(void);
          void checkArea(void);
+         void checkLonLat();
 
 
@@ -172,4 +173,5 @@
          bool hasBounds ;
          bool hasArea;
+         bool hasLonLat;
       private:
          void checkTransformations();
@@ -178,4 +180,8 @@
          void completeLonClient();
          void completeLatClient();
+
+         void sendIndex();
+         void sendArea();
+         void sendLonLat();
 
        private :
Index: /XIOS/trunk/src/output/nc4_data_output.cpp
===================================================================
--- /XIOS/trunk/src/output/nc4_data_output.cpp	(revision 664)
+++ /XIOS/trunk/src/output/nc4_data_output.cpp	(revision 665)
@@ -165,30 +165,33 @@
                  }
 
-                 switch (domain->type)
-                 {
-                   case CDomain::type_attr::curvilinear :
-                     SuperClassWriter::addVariable(latid, NC_FLOAT, dim0);
-                     SuperClassWriter::addVariable(lonid, NC_FLOAT, dim0);
-                     break ;
-                    case CDomain::type_attr::rectilinear :
-                      SuperClassWriter::addVariable(latid, NC_FLOAT, dim0);
-                      SuperClassWriter::addVariable(lonid, NC_FLOAT, dim1);
-                      break ;
-                 }
-
-                 this->writeAxisAttributes(lonid, isRegularDomain ? "X" : "", "longitude", "Longitude", "degrees_east", domid);
-                 this->writeAxisAttributes(latid, isRegularDomain ? "Y" : "", "latitude", "Latitude", "degrees_north", domid);
-
-                 if (domain->hasBounds)
-                 {
-                   SuperClassWriter::addAttribute("bounds", bounds_lonid, &lonid);
-                   SuperClassWriter::addAttribute("bounds", bounds_latid, &latid);
-
-                   dim0.clear();
-                   dim0.push_back(dimYid);
-                   dim0.push_back(dimXid);
-                   dim0.push_back(dimVertId);
-                   SuperClassWriter::addVariable(bounds_lonid, NC_FLOAT, dim0);
-                   SuperClassWriter::addVariable(bounds_latid, NC_FLOAT, dim0);
+                 if (domain->hasLonLat)
+                 {
+                   switch (domain->type)
+                   {
+                     case CDomain::type_attr::curvilinear :
+                       SuperClassWriter::addVariable(latid, NC_FLOAT, dim0);
+                       SuperClassWriter::addVariable(lonid, NC_FLOAT, dim0);
+                       break ;
+                      case CDomain::type_attr::rectilinear :
+                        SuperClassWriter::addVariable(latid, NC_FLOAT, dim0);
+                        SuperClassWriter::addVariable(lonid, NC_FLOAT, dim1);
+                        break ;
+                   }
+
+                   this->writeAxisAttributes(lonid, isRegularDomain ? "X" : "", "longitude", "Longitude", "degrees_east", domid);
+                   this->writeAxisAttributes(latid, isRegularDomain ? "Y" : "", "latitude", "Latitude", "degrees_north", domid);
+
+                   if (domain->hasBounds)
+                   {
+                     SuperClassWriter::addAttribute("bounds", bounds_lonid, &lonid);
+                     SuperClassWriter::addAttribute("bounds", bounds_latid, &latid);
+
+                     dim0.clear();
+                     dim0.push_back(dimYid);
+                     dim0.push_back(dimXid);
+                     dim0.push_back(dimVertId);
+                     SuperClassWriter::addVariable(bounds_lonid, NC_FLOAT, dim0);
+                     SuperClassWriter::addVariable(bounds_latid, NC_FLOAT, dim0);
+                   }
                  }
 
@@ -221,22 +224,25 @@
                  SuperClassWriter::definition_end();
 
-                 switch (domain->type)
-                 {
-                   case CDomain::type_attr::curvilinear :
-                     SuperClassWriter::writeData(domain->latvalue_srv, latid, isCollective, 0);
-                     SuperClassWriter::writeData(domain->lonvalue_srv, lonid, isCollective, 0);
-                     break;
-                   case CDomain::type_attr::rectilinear :
-                     CArray<double,1> lat = domain->latvalue_srv(Range(fromStart,toEnd,domain->zoom_ni_srv)) ;
-                     SuperClassWriter::writeData(CArray<double,1>(lat.copy()), latid, isCollective, 0);
-                     CArray<double,1> lon=domain->lonvalue_srv(Range(0,domain->zoom_ni_srv-1)) ;
-                     SuperClassWriter::writeData(CArray<double,1>(lon.copy()), lonid, isCollective, 0);
-                     break;
-                 }
-
-                 if (domain->hasBounds)
-                 {
-                   SuperClassWriter::writeData(domain->bounds_lon_srv, bounds_lonid, isCollective, 0);
-                   SuperClassWriter::writeData(domain->bounds_lat_srv, bounds_latid, isCollective, 0);
+                 if (domain->hasLonLat)
+                 {
+                   switch (domain->type)
+                   {
+                     case CDomain::type_attr::curvilinear :
+                       SuperClassWriter::writeData(domain->latvalue_srv, latid, isCollective, 0);
+                       SuperClassWriter::writeData(domain->lonvalue_srv, lonid, isCollective, 0);
+                       break;
+                     case CDomain::type_attr::rectilinear :
+                       CArray<double,1> lat = domain->latvalue_srv(Range(fromStart,toEnd,domain->zoom_ni_srv)) ;
+                       SuperClassWriter::writeData(CArray<double,1>(lat.copy()), latid, isCollective, 0);
+                       CArray<double,1> lon=domain->lonvalue_srv(Range(0,domain->zoom_ni_srv-1)) ;
+                       SuperClassWriter::writeData(CArray<double,1>(lon.copy()), lonid, isCollective, 0);
+                       break;
+                   }
+
+                   if (domain->hasBounds)
+                   {
+                     SuperClassWriter::writeData(domain->bounds_lon_srv, bounds_lonid, isCollective, 0);
+                     SuperClassWriter::writeData(domain->bounds_lat_srv, bounds_latid, isCollective, 0);
+                   }
                  }
 
@@ -256,26 +262,47 @@
                    SuperClassWriter::addDimension(dimVertId, domain->nvertex);
 
-                 switch (domain->type)
-                 {
-                   case CDomain::type_attr::curvilinear :
-                     dim0.push_back(dimYid); dim0.push_back(dimXid);
-                     lonid = StdString("nav_lon").append(appendDomid);
-                     latid = StdString("nav_lat").append(appendDomid);
-                     SuperClassWriter::addVariable(latid, NC_FLOAT, dim0);
-                     SuperClassWriter::addVariable(lonid, NC_FLOAT, dim0);
-                     break;
-
-                   case CDomain::type_attr::rectilinear :
+                 if (domain->hasLonLat)
+                 {
+                   switch (domain->type)
+                   {
+                     case CDomain::type_attr::curvilinear :
+                       dim0.push_back(dimYid); dim0.push_back(dimXid);
+                       lonid = StdString("nav_lon").append(appendDomid);
+                       latid = StdString("nav_lat").append(appendDomid);
+                       SuperClassWriter::addVariable(latid, NC_FLOAT, dim0);
+                       SuperClassWriter::addVariable(lonid, NC_FLOAT, dim0);
+                       break;
+
+                     case CDomain::type_attr::rectilinear :
+                       dim0.push_back(dimYid);
+                       dim1.push_back(dimXid);
+                       lonid = StdString("lon").append(appendDomid);
+                       latid = StdString("lat").append(appendDomid);
+                       SuperClassWriter::addVariable(latid, NC_FLOAT, dim0);
+                       SuperClassWriter::addVariable(lonid, NC_FLOAT, dim1);
+                       break;
+                   }
+
+                   bounds_lonid = StdString("bounds_lon").append(appendDomid);
+                   bounds_latid = StdString("bounds_lat").append(appendDomid);
+
+                   this->writeAxisAttributes
+                      (lonid, isRegularDomain ? "X" : "", "longitude", "Longitude", "degrees_east", domid);
+                   this->writeAxisAttributes
+                      (latid, isRegularDomain ? "Y" : "", "latitude", "Latitude", "degrees_north", domid);
+
+                   if (domain->hasBounds)
+                   {
+                     SuperClassWriter::addAttribute("bounds", bounds_lonid, &lonid);
+                     SuperClassWriter::addAttribute("bounds", bounds_latid, &latid);
+
+                     dim0.clear();
                      dim0.push_back(dimYid);
-                     dim1.push_back(dimXid);
-                     lonid = StdString("lon").append(appendDomid);
-                     latid = StdString("lat").append(appendDomid);
-                     SuperClassWriter::addVariable(latid, NC_FLOAT, dim0);
-                     SuperClassWriter::addVariable(lonid, NC_FLOAT, dim1);
-                     break;
-                 }
-
-                 bounds_lonid = StdString("bounds_lon").append(appendDomid);
-                 bounds_latid = StdString("bounds_lat").append(appendDomid);
+                     dim0.push_back(dimXid);
+                     dim0.push_back(dimVertId);
+                     SuperClassWriter::addVariable(bounds_lonid, NC_FLOAT, dim0);
+                     SuperClassWriter::addVariable(bounds_latid, NC_FLOAT, dim0);
+                   }
+                 }
 
                  if (domain->hasArea)
@@ -287,22 +314,4 @@
                    SuperClassWriter::addAttribute("units", StdString("m2"), &areaId);
                    dim0.clear();
-                 }
-
-                 this->writeAxisAttributes
-                    (lonid, isRegularDomain ? "X" : "", "longitude", "Longitude", "degrees_east", domid);
-                 this->writeAxisAttributes
-                    (latid, isRegularDomain ? "Y" : "", "latitude", "Latitude", "degrees_north", domid);
-
-                 if (domain->hasBounds)
-                 {
-                   SuperClassWriter::addAttribute("bounds", bounds_lonid, &lonid);
-                   SuperClassWriter::addAttribute("bounds", bounds_latid, &latid);
-
-                   dim0.clear();
-                   dim0.push_back(dimYid);
-                   dim0.push_back(dimXid);
-                   dim0.push_back(dimVertId);
-                   SuperClassWriter::addVariable(bounds_lonid, NC_FLOAT, dim0);
-                   SuperClassWriter::addVariable(bounds_latid, NC_FLOAT, dim0);
                  }
 
@@ -327,30 +336,37 @@
                      }
 
-                     SuperClassWriter::writeData(domain->latvalue_srv, latid, isCollective, 0,&start,&count);
-                     SuperClassWriter::writeData(domain->lonvalue_srv, lonid, isCollective, 0,&start,&count);
+                     if (domain->hasLonLat)
+                     {
+                       SuperClassWriter::writeData(domain->latvalue_srv, latid, isCollective, 0,&start,&count);
+                       SuperClassWriter::writeData(domain->lonvalue_srv, lonid, isCollective, 0,&start,&count);
+                     }
                      break;
                    }
                    case CDomain::type_attr::rectilinear :
                    {
-                     std::vector<StdSize> start(1) ;
-                     std::vector<StdSize> count(1) ;
-                     if (domain->isEmpty())
+                     if (domain->hasLonLat)
                      {
-                       start[0]=0 ;
-                       count[0]=0 ;
-                       SuperClassWriter::writeData(domain->latvalue_srv, latid, isCollective, 0,&start,&count);
-                       SuperClassWriter::writeData(domain->lonvalue_srv, lonid, isCollective, 0,&start,&count);
-                     }
-                     else
-                     {
-                       start[0]=domain->zoom_jbegin_srv-domain->global_zoom_jbegin;
-                       count[0]=domain->zoom_nj_srv ;
-                       CArray<double,1> lat = domain->latvalue_srv(Range(fromStart,toEnd,domain->zoom_ni_srv)) ;
-                       SuperClassWriter::writeData(CArray<double,1>(lat.copy()), latid, isCollective, 0,&start,&count);
-
-                       start[0]=domain->zoom_ibegin_srv-domain->global_zoom_ibegin;
-                       count[0]=domain->zoom_ni_srv ;
-                       CArray<double,1> lon=domain->lonvalue_srv(Range(0,domain->zoom_ni_srv-1)) ;
-                       SuperClassWriter::writeData(CArray<double,1>(lon.copy()), lonid, isCollective, 0,&start,&count);
+                       std::vector<StdSize> start(1) ;
+                       std::vector<StdSize> count(1) ;
+                       if (domain->isEmpty())
+                       {
+                         start[0]=0 ;
+                         count[0]=0 ;
+                         SuperClassWriter::writeData(domain->latvalue_srv, latid, isCollective, 0,&start,&count);
+                         SuperClassWriter::writeData(domain->lonvalue_srv, lonid, isCollective, 0,&start,&count);
+
+                       }
+                       else
+                       {
+                         start[0]=domain->zoom_jbegin_srv-domain->global_zoom_jbegin;
+                         count[0]=domain->zoom_nj_srv ;
+                         CArray<double,1> lat = domain->latvalue_srv(Range(fromStart,toEnd,domain->zoom_ni_srv)) ;
+                         SuperClassWriter::writeData(CArray<double,1>(lat.copy()), latid, isCollective, 0,&start,&count);
+
+                         start[0]=domain->zoom_ibegin_srv-domain->global_zoom_ibegin;
+                         count[0]=domain->zoom_ni_srv ;
+                         CArray<double,1> lon=domain->lonvalue_srv(Range(0,domain->zoom_ni_srv-1)) ;
+                         SuperClassWriter::writeData(CArray<double,1>(lon.copy()), lonid, isCollective, 0,&start,&count);
+                       }
                      }
                      break;
@@ -453,21 +469,22 @@
               case (MULTI_FILE) :
               {
+                 dim0.push_back(dimXid);
+                 SuperClassWriter::addDimension(dimXid, domain->zoom_ni_srv);
+
                  lonid = StdString("lon").append(appendDomid);
                  latid = StdString("lat").append(appendDomid);
-                 dim0.push_back(dimXid);
-
-                 SuperClassWriter::addDimension(dimXid, domain->zoom_ni_srv);
-                 SuperClassWriter::addVariable(latid, NC_FLOAT, dim0);
-                 SuperClassWriter::addVariable(lonid, NC_FLOAT, dim0);
-
                  bounds_lonid = StdString("bounds_lon").append(appendDomid);
                  bounds_latid = StdString("bounds_lat").append(appendDomid);
-
-
-                 this->writeAxisAttributes(lonid, "", "longitude", "Longitude", "degrees_east", domid);
-                 if (domain->hasBounds) SuperClassWriter::addAttribute("bounds",bounds_lonid, &lonid);
-                 this->writeAxisAttributes(latid, "", "latitude", "Latitude", "degrees_north", domid);
-                 if (domain->hasBounds) SuperClassWriter::addAttribute("bounds",bounds_latid, &latid);
-                 if (domain->hasBounds) SuperClassWriter::addDimension(dimVertId, domain->nvertex);
+                 if (domain->hasLonLat)
+                 {
+                   SuperClassWriter::addVariable(latid, NC_FLOAT, dim0);
+                   SuperClassWriter::addVariable(lonid, NC_FLOAT, dim0);
+                   this->writeAxisAttributes(lonid, "", "longitude", "Longitude", "degrees_east", domid);
+                   if (domain->hasBounds) SuperClassWriter::addAttribute("bounds",bounds_lonid, &lonid);
+                   this->writeAxisAttributes(latid, "", "latitude", "Latitude", "degrees_north", domid);
+                   if (domain->hasBounds) SuperClassWriter::addAttribute("bounds",bounds_latid, &latid);
+                   if (domain->hasBounds) SuperClassWriter::addDimension(dimVertId, domain->nvertex);
+                 }
+
                  dim0.clear();
                  if (domain->hasBounds)
@@ -481,5 +498,4 @@
                  dim0.clear();
                  dim0.push_back(dimXid);
-
                  if (domain->hasArea)
                  {
@@ -491,11 +507,13 @@
                  SuperClassWriter::definition_end();
 
-                 SuperClassWriter::writeData(domain->latvalue_srv, latid, isCollective, 0);
-                 SuperClassWriter::writeData(domain->lonvalue_srv, lonid, isCollective, 0);
-
-                 if (domain->hasBounds)
-                 {
-                   SuperClassWriter::writeData(domain->bounds_lon_srv, bounds_lonid, isCollective, 0);
-                   SuperClassWriter::writeData(domain->bounds_lat_srv, bounds_latid, isCollective, 0);
+                 if (domain->hasLonLat)
+                 {
+                   SuperClassWriter::writeData(domain->latvalue_srv, latid, isCollective, 0);
+                   SuperClassWriter::writeData(domain->lonvalue_srv, lonid, isCollective, 0);
+                   if (domain->hasBounds)
+                   {
+                     SuperClassWriter::writeData(domain->bounds_lon_srv, bounds_lonid, isCollective, 0);
+                     SuperClassWriter::writeData(domain->bounds_lat_srv, bounds_latid, isCollective, 0);
+                   }
                  }
 
@@ -515,11 +533,15 @@
                  dim0.push_back(dimXid);
                  SuperClassWriter::addDimension(dimXid, domain->nj_glo);
-                 SuperClassWriter::addVariable(latid, NC_FLOAT, dim0);
-                 SuperClassWriter::addVariable(lonid, NC_FLOAT, dim0);
-                 this->writeAxisAttributes(lonid, "", "longitude", "Longitude", "degrees_east", domid);
-                 if (domain->hasBounds) SuperClassWriter::addAttribute("bounds",bounds_lonid, &lonid);
-                 this->writeAxisAttributes(latid, "", "latitude", "Latitude", "degrees_north", domid);
-                 if (domain->hasBounds) SuperClassWriter::addAttribute("bounds",bounds_latid, &latid);
-                 if (domain->hasBounds) SuperClassWriter::addDimension(dimVertId, domain->nvertex);
+                 if (domain->hasLonLat)
+                 {
+                   SuperClassWriter::addVariable(latid, NC_FLOAT, dim0);
+                   SuperClassWriter::addVariable(lonid, NC_FLOAT, dim0);
+
+                   this->writeAxisAttributes(lonid, "", "longitude", "Longitude", "degrees_east", domid);
+                   if (domain->hasBounds) SuperClassWriter::addAttribute("bounds",bounds_lonid, &lonid);
+                   this->writeAxisAttributes(latid, "", "latitude", "Latitude", "degrees_north", domid);
+                   if (domain->hasBounds) SuperClassWriter::addAttribute("bounds",bounds_latid, &latid);
+                   if (domain->hasBounds) SuperClassWriter::addDimension(dimVertId, domain->nvertex);
+                 }
                  dim0.clear();
 
@@ -563,10 +585,14 @@
                    countBounds[1]=domain->nvertex ;
                  }
-                 SuperClassWriter::writeData(domain->latvalue_srv, latid, isCollective, 0,&start,&count);
-                 SuperClassWriter::writeData(domain->lonvalue_srv, lonid, isCollective, 0,&start,&count);
-                 if (domain->hasBounds)
-                 {
-                   SuperClassWriter::writeData(domain->bounds_lon_srv, bounds_lonid, isCollective, 0,&startBounds,&countBounds);
-                   SuperClassWriter::writeData(domain->bounds_lat_srv, bounds_latid, isCollective, 0,&startBounds,&countBounds);
+
+                 if (domain->hasLonLat)
+                 {
+                   SuperClassWriter::writeData(domain->latvalue_srv, latid, isCollective, 0,&start,&count);
+                   SuperClassWriter::writeData(domain->lonvalue_srv, lonid, isCollective, 0,&start,&count);
+                   if (domain->hasBounds)
+                   {
+                     SuperClassWriter::writeData(domain->bounds_lon_srv, bounds_lonid, isCollective, 0,&startBounds,&countBounds);
+                     SuperClassWriter::writeData(domain->bounds_lat_srv, bounds_latid, isCollective, 0,&startBounds,&countBounds);
+                   }
                  }
 
Index: /XIOS/trunk/src/test/test_client.f90
===================================================================
--- /XIOS/trunk/src/test/test_client.f90	(revision 664)
+++ /XIOS/trunk/src/test/test_client.f90	(revision 665)
@@ -26,5 +26,5 @@
   DOUBLE PRECISION,DIMENSION(ni_glo,nj_glo) :: lon_glo,lat_glo
   DOUBLE PRECISION :: field_A_glo(ni_glo,nj_glo,llm)
-  DOUBLE PRECISION,ALLOCATABLE :: lon(:,:),lat(:,:),field_A(:,:,:), lonvalue(:) ;
+  DOUBLE PRECISION,ALLOCATABLE :: lon(:,:),lat(:,:),field_A(:,:,:), lonvalue(:,:) ;
   INTEGER :: ni,ibegin,iend,nj,jbegin,jend
   INTEGER :: i,j,l,ts,n
@@ -64,5 +64,5 @@
   iend=ibegin+ni-1 ; jend=jbegin+nj-1
 
-  ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm),lonvalue(ni*nj))
+  ALLOCATE(lon(ni,nj),lat(ni,nj),field_A(0:ni+1,-1:nj+2,llm),lonvalue(ni,nj))
   lon(:,:)=lon_glo(ibegin+1:iend+1,jbegin+1:jend+1)
   lat(:,:)=lat_glo(ibegin+1:iend+1,jbegin+1:jend+1)
@@ -79,6 +79,5 @@
   CALL xios_set_domain_attr("domain_A",ni_glo=ni_glo, nj_glo=nj_glo, ibegin=ibegin, ni=ni,jbegin=jbegin,nj=nj,type='curvilinear')
   CALL xios_set_domain_attr("domain_A",data_dim=2, data_ibegin=-1, data_ni=ni+2, data_jbegin=-2, data_nj=nj+4)
-!  CALL xios_set_domain_attr("domain_A",lonvalue=RESHAPE(lon,(/ni*nj/)),latvalue=RESHAPE(lat,(/ni*nj/)))
-  CALL xios_set_domain_attr("domain_A",lonvalue_2D=lon,latvalue_2D=lat)
+!  CALL xios_set_domain_attr("domain_A",lonvalue_2D=lon,latvalue_2D=lat)
   CALL xios_set_fieldgroup_attr("field_definition",enabled=.TRUE.)
 
@@ -113,6 +112,6 @@
   PRINT *, "xios_date_convert_to_seconds(date - 2.5h) = ", xios_date_convert_to_seconds(date - 2.5 * xios_hour)
 
-  ni=0 ; lonvalue(:)=0; lon(:,:)=0
-  CALL xios_get_domain_attr("domain_A",ni=ni,lonvalue_2D=lon)
+  ni=0 ; lonvalue(:,:)=0;
+!  CALL xios_get_domain_attr("domain_A",ni=ni,lonvalue_2D=lon)
 
   print *,"ni",ni
Index: /XIOS/trunk/src/test/test_complete.f90
===================================================================
--- /XIOS/trunk/src/test/test_complete.f90	(revision 664)
+++ /XIOS/trunk/src/test/test_complete.f90	(revision 665)
@@ -176,5 +176,5 @@
                             time_origin=xios_date(1999, 01, 01, 15, 00, 00))
 
-  CALL xios_set_axis_attr("axis_srf",size=llm ,value=lval) ;
+  CALL xios_set_axis_attr("axis_srf",size=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='curvilinear')
   CALL xios_set_domain_attr("domain_srf",data_dim=1, data_ibegin=0, data_ni=nb_pt)
