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);
+                   }
                  }
 
