Index: XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_output.cpp
===================================================================
--- XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_output.cpp	(revision 1390)
+++ XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_output.cpp	(revision 1391)
@@ -53,4 +53,6 @@
       void CNc4DataOutput::writeDomain_(CDomain* domain)
       {
+        StdString lonName,latName ;
+         
         domain->computeWrittenIndex();
         domain->computeWrittenCompressedIndex(comm_file);
@@ -94,10 +96,25 @@
          {
            case CDomain::type_attr::curvilinear :
+
+             if (domain->lon_name.isEmpty()) lonName = "nav_lon";
+             else lonName = domain->lon_name;
+
+             if (domain->lat_name.isEmpty()) latName = "nav_lat";
+             else latName = domain->lat_name;
+
              dimXid     = StdString("x").append(appendDomid);
              dimYid     = StdString("y").append(appendDomid);
              break ;
+
            case CDomain::type_attr::rectilinear :
-             dimXid     = StdString("lon").append(appendDomid);
-             dimYid     = StdString("lat").append(appendDomid);
+
+             if (domain->lon_name.isEmpty()) lonName = "lon";
+             else lonName = domain->lon_name;
+
+             if (domain->lat_name.isEmpty()) latName = "lat";
+             else latName = domain->lat_name;
+             
+             dimXid     = lonName.append(appendDomid);
+             dimYid     = latName.append(appendDomid);
              break;
          }
@@ -195,10 +212,10 @@
                    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);
+                     lonid = lonName.append(appendDomid);
+                     latid = latName.append(appendDomid);
                      break ;
                    case CDomain::type_attr::rectilinear :
-                     lonid = StdString("lon").append(appendDomid);
-                     latid = StdString("lat").append(appendDomid);
+                     lonid = lonName.append(appendDomid);
+                     latid = latName.append(appendDomid);
                      dim0.push_back(dimYid);
                      dim1.push_back(dimXid);
@@ -206,6 +223,6 @@
                  }
 
-                 bounds_lonid = StdString("bounds_lon").append(appendDomid);
-                 bounds_latid = StdString("bounds_lat").append(appendDomid);
+                 bounds_lonid = "bounds_"+lonName+appendDomid;
+                 bounds_latid = "bounds_"+latName+appendDomid;
 
                  SuperClassWriter::addDimension(dimXid, domain->zoom_ni);
@@ -338,6 +355,6 @@
                      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);
+                       lonid = lonName.append(appendDomid);
+                       latid = latName.append(appendDomid);
                        SuperClassWriter::addVariable(latid, typePrec, dim0);
                        SuperClassWriter::addVariable(lonid, typePrec, dim0);
@@ -347,6 +364,6 @@
                        dim0.push_back(dimYid);
                        dim1.push_back(dimXid);
-                       lonid = StdString("lon").append(appendDomid);
-                       latid = StdString("lat").append(appendDomid);
+                       lonid = lonName.append(appendDomid);
+                       latid = latName.append(appendDomid);
                        SuperClassWriter::addVariable(latid, typePrec, dim0);
                        SuperClassWriter::addVariable(lonid, typePrec, dim1);
@@ -354,6 +371,6 @@
                    }
 
-                   bounds_lonid = StdString("bounds_lon").append(appendDomid);
-                   bounds_latid = StdString("bounds_lat").append(appendDomid);
+                   bounds_lonid = "bounds_"+lonName+appendDomid;
+                   bounds_latid = "bounds_"+latName+appendDomid;
 
                    this->writeAxisAttributes
@@ -934,4 +951,11 @@
          StdString appendDomid  = (singleDomain) ? "" : "_"+domid ;
 
+         StdString lonName,latName ;
+         if (domain->lon_name.isEmpty()) lonName = "lon";
+         else lonName = domain->lon_name;
+
+         if (domain->lat_name.isEmpty()) latName = "lat";
+         else latName = domain->lat_name;
+
          StdString dimXid = StdString("cell").append(appendDomid);
          StdString dimVertId = StdString("nvertex").append(appendDomid);
@@ -1018,8 +1042,8 @@
                  SuperClassWriter::addDimension(dimXid, domain->zoom_ni);
 
-                 lonid = StdString("lon").append(appendDomid);
-                 latid = StdString("lat").append(appendDomid);
-                 bounds_lonid = StdString("bounds_lon").append(appendDomid);
-                 bounds_latid = StdString("bounds_lat").append(appendDomid);
+                 lonid = lonName.append(appendDomid);
+                 latid = latName.append(appendDomid);
+                 bounds_lonid = "bounds_"+lonName+appendDomid;
+                 bounds_latid = "bounds_"+latName+appendDomid;
                  if (domain->hasLonLat)
                  {
@@ -1072,8 +1096,9 @@
               case (ONE_FILE) :
               {
-                 lonid = StdString("lon").append(appendDomid);
-                 latid = StdString("lat").append(appendDomid);
-                 bounds_lonid = StdString("bounds_lon").append(appendDomid);
-                 bounds_latid = StdString("bounds_lat").append(appendDomid);
+                 lonid = lonName.append(appendDomid);
+                 latid = latName.append(appendDomid);
+                 bounds_lonid = "bounds_"+lonName+appendDomid;
+                 bounds_latid = "bounds_"+latName+appendDomid;
+
                  dim0.push_back(dimXid);
                  SuperClassWriter::addDimension(dimXid, domain->ni_glo);
@@ -1703,5 +1728,12 @@
             StdString domId = domain->getDomainOutputName();
             StdString appendDomId  = singleDomain ? "" : "_" + domId ;
-
+            StdString lonName,latName ;
+
+            if (domain->lon_name.isEmpty()) lonName = "lon";
+            else lonName = domain->lon_name;
+
+            if (domain->lat_name.isEmpty()) latName = "lat";
+            else latName = domain->lat_name;
+        
             if (compressedOutput && domain->isCompressible() && domain->type != CDomain::type_attr::unstructured)
             {
@@ -1720,13 +1752,13 @@
                   dimIdList.push_back(dimYid);
                 }
-                dimCoordList.push_back(StdString("nav_lon").append(appendDomId));
-                dimCoordList.push_back(StdString("nav_lat").append(appendDomId));
+                dimCoordList.push_back(lonName.append(appendDomId));
+                dimCoordList.push_back(latName.append(appendDomId));
               break ;
               case CDomain::type_attr::rectilinear:
                 if (!compressedOutput || !domain->isCompressible())
                 {
-                  dimXid     = StdString("lon").append(appendDomId);
+                  dimXid     = lonName.append(appendDomId);
                   dimIdList.push_back(dimXid);
-                  dimYid     = StdString("lat").append(appendDomId);
+                  dimYid     = latName.append(appendDomId);
                   dimIdList.push_back(dimYid);
                 }
@@ -1738,6 +1770,6 @@
                   dimXid     = StdString("cell").append(appendDomId);
                   dimIdList.push_back(dimXid);
-                  dimCoordList.push_back(StdString("lon").append(appendDomId));
-                  dimCoordList.push_back(StdString("lat").append(appendDomId));
+                  dimCoordList.push_back(lonName.append(appendDomId));
+                  dimCoordList.push_back(latName.append(appendDomId));
                 }
                 else
