Index: /XIOS/dev/XIOS_DEV_CMIP6/src/config/axis_attribute.conf
===================================================================
--- /XIOS/dev/XIOS_DEV_CMIP6/src/config/axis_attribute.conf	(revision 1429)
+++ /XIOS/dev/XIOS_DEV_CMIP6/src/config/axis_attribute.conf	(revision 1430)
@@ -11,4 +11,7 @@
 DECLARE_ATTRIBUTE(int,       n_glo)
 DECLARE_ENUM2(positive, up, down)
+DECLARE_ENUM4(axis_type, X, Y, Z, T)
+
+DECLARE_ATTRIBUTE(StdString, dim_name)
 
 /* GLOBAL */
Index: /XIOS/dev/XIOS_DEV_CMIP6/src/config/domain_attribute.conf
===================================================================
--- /XIOS/dev/XIOS_DEV_CMIP6/src/config/domain_attribute.conf	(revision 1429)
+++ /XIOS/dev/XIOS_DEV_CMIP6/src/config/domain_attribute.conf	(revision 1430)
@@ -5,4 +5,8 @@
 DECLARE_ATTRIBUTE(StdString       , lon_name)
 DECLARE_ATTRIBUTE(StdString       , lat_name)
+DECLARE_ATTRIBUTE(StdString       , bounds_lon_name)
+DECLARE_ATTRIBUTE(StdString       , bounds_lat_name)
+DECLARE_ATTRIBUTE(StdString       , dim_i_name)
+DECLARE_ATTRIBUTE(StdString       , dim_j_name)
 
 /* GLOBAL */
Index: /XIOS/dev/XIOS_DEV_CMIP6/src/config/scalar_attribute.conf
===================================================================
--- /XIOS/dev/XIOS_DEV_CMIP6/src/config/scalar_attribute.conf	(revision 1429)
+++ /XIOS/dev/XIOS_DEV_CMIP6/src/config/scalar_attribute.conf	(revision 1430)
@@ -7,5 +7,9 @@
 /* LOCAL and GLOBAL*/
 DECLARE_ATTRIBUTE(double, value)
+DECLARE_ATTRIBUTE(StdString, bounds_value_name)
+DECLARE_ATTRIBUTE(double, bounds_value)
 
 DECLARE_ATTRIBUTE(StdString, scalar_ref)
 DECLARE_ATTRIBUTE(int, prec)
+
+DECLARE_ENUM4(axis_type, X, Y, Z, T)
Index: /XIOS/dev/XIOS_DEV_CMIP6/src/io/inetcdf4.cpp
===================================================================
--- /XIOS/dev/XIOS_DEV_CMIP6/src/io/inetcdf4.cpp	(revision 1429)
+++ /XIOS/dev/XIOS_DEV_CMIP6/src/io/inetcdf4.cpp	(revision 1430)
@@ -502,5 +502,6 @@
       {
         std::map<StdString, StdSize> dimvar = this->getDimensions(&coord, path);
-        if ((dimvar.size() == 1) && (dimvar.find(coord) != dimvar.end()))
+//        if ((dimvar.size() == 1) && (dimvar.find(coord) != dimvar.end()))
+        if ((dimvar.size() == 1) )
           continue;
         else
Index: /XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_input.cpp
===================================================================
--- /XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_input.cpp	(revision 1429)
+++ /XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_input.cpp	(revision 1430)
@@ -185,5 +185,29 @@
 */
     for (std::list<StdString>::const_iterator it = dimList.begin(); it != dimList.end(); ++it)
-      listDimSize.push_front(*dimSizeMap.find(*it));
+    {
+      // It is not required any more for dimension name and lon/lat names to be the same (aka lon(lon))
+      if (SuperClassWriter::isRectilinear(fieldId))
+      {
+        StdString lonName =   SuperClassWriter::getLonCoordName(fieldId);
+        StdString latName =   SuperClassWriter::getLatCoordName(fieldId);
+        StdString dimLonName = SuperClassWriter::getDimensions(&lonName).begin()->first;
+        StdString dimLatName = SuperClassWriter::getDimensions(&latName).begin()->first;
+        if ((lonName != dimLonName) && (*it == dimLonName))
+        {
+          StdSize dimSizeTmp = dimSizeMap.find(*it)->second;
+          listDimSize.push_front(make_pair(lonName, dimSizeTmp));
+        }
+        else if ((latName != dimLatName) && (*it == dimLatName))
+        {
+          StdSize dimSizeTmp = dimSizeMap.find(*it)->second;
+          listDimSize.push_front(make_pair(latName, dimSizeTmp));
+        }
+        else
+          listDimSize.push_front(*dimSizeMap.find(*it));
+      }
+      else
+        listDimSize.push_front(*dimSizeMap.find(*it));
+
+    }
 
     // Now process domain and axis
Index: /XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_output.cpp
===================================================================
--- /XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_output.cpp	(revision 1429)
+++ /XIOS/dev/XIOS_DEV_CMIP6/src/io/nc4_data_output.cpp	(revision 1430)
@@ -103,18 +103,37 @@
              else latName = domain->lat_name;
 
-             dimXid     = StdString("x").append(appendDomid);
-             dimYid     = StdString("y").append(appendDomid);
+             if (domain->dim_i_name.isEmpty()) dimXid=StdString("x").append(appendDomid);
+             else dimXid=domain->dim_i_name.getValue() + appendDomid;
+
+             if (domain->dim_j_name.isEmpty()) dimYid=StdString("y").append(appendDomid);
+             else dimYid=domain->dim_j_name.getValue() + appendDomid;
+
              break ;
 
            case CDomain::type_attr::rectilinear :
 
-             if (domain->lon_name.isEmpty()) lonName = "lon";
+             if (domain->lon_name.isEmpty())
+             {
+               if (domain->dim_i_name.isEmpty())
+                   lonName = "lon";
+               else
+                 lonName = domain->dim_i_name.getValue();
+             }
              else lonName = domain->lon_name;
 
-             if (domain->lat_name.isEmpty()) latName = "lat";
+             if (domain->lat_name.isEmpty())
+             {
+               if (domain->dim_j_name.isEmpty())
+                 latName = "lat";
+               else
+                 latName = domain->dim_j_name.getValue();
+             }
              else latName = domain->lat_name;
              
-             dimXid     = lonName+appendDomid;
-             dimYid     = latName+appendDomid;
+             if (domain->dim_i_name.isEmpty()) dimXid = lonName+appendDomid;
+             else dimXid = domain->dim_i_name.getValue()+appendDomid;
+
+             if (domain->dim_j_name.isEmpty()) dimYid = latName+appendDomid;
+             else dimYid = domain->dim_j_name.getValue()+appendDomid;
              break;
          }
@@ -222,7 +241,8 @@
                      break;
                  }
-
-                 bounds_lonid = "bounds_"+lonName+appendDomid;
-                 bounds_latid = "bounds_"+latName+appendDomid;
+                 if (!domain->bounds_lon_name.isEmpty()) bounds_lonid = domain->bounds_lon_name;
+                 else bounds_lonid = "bounds_"+lonName+appendDomid;
+                 if (!domain->bounds_lat_name.isEmpty()) bounds_latid = domain->bounds_lat_name;
+                 else bounds_latid = "bounds_"+latName+appendDomid;
 
                  SuperClassWriter::addDimension(dimXid, domain->zoom_ni);
@@ -370,7 +390,8 @@
                        break;
                    }
-
-                   bounds_lonid = "bounds_"+lonName+appendDomid;
-                   bounds_latid = "bounds_"+latName+appendDomid;
+                   if (!domain->bounds_lon_name.isEmpty()) bounds_lonid = domain->bounds_lon_name;
+                   else bounds_lonid = "bounds_"+lonName+appendDomid;
+                   if (!domain->bounds_lat_name.isEmpty()) bounds_latid = domain->bounds_lat_name;
+                   else bounds_latid = "bounds_"+latName+appendDomid;
 
                    this->writeAxisAttributes
@@ -951,5 +972,5 @@
          StdString appendDomid  = (singleDomain) ? "" : "_"+domid ;
 
-         StdString lonName,latName ;
+         StdString lonName,latName, cellName ;
          if (domain->lon_name.isEmpty()) lonName = "lon";
          else lonName = domain->lon_name;
@@ -958,5 +979,7 @@
          else latName = domain->lat_name;
 
-         StdString dimXid = StdString("cell").append(appendDomid);
+         if (!domain->dim_i_name.isEmpty()) cellName=domain->dim_i_name;
+         else cellName="cell";
+         StdString dimXid = cellName+appendDomid;
          StdString dimVertId = StdString("nvertex").append(appendDomid);
 
@@ -1044,6 +1067,9 @@
                  lonid = lonName+appendDomid;
                  latid = latName+appendDomid;
-                 bounds_lonid = "bounds_"+lonName+appendDomid;
-                 bounds_latid = "bounds_"+latName+appendDomid;
+                 if (!domain->bounds_lon_name.isEmpty()) bounds_lonid = domain->bounds_lon_name;
+                 else bounds_lonid = "bounds_"+lonName+appendDomid;
+                 if (!domain->bounds_lat_name.isEmpty()) bounds_latid = domain->bounds_lat_name;
+                 else bounds_latid = "bounds_"+latName+appendDomid;
+
                  if (domain->hasLonLat)
                  {
@@ -1098,6 +1124,8 @@
                  lonid = lonName+appendDomid;
                  latid = latName+appendDomid;
-                 bounds_lonid = "bounds_"+lonName+appendDomid;
-                 bounds_latid = "bounds_"+latName+appendDomid;
+                 if (!domain->bounds_lon_name.isEmpty()) bounds_lonid = domain->bounds_lon_name;
+                 else bounds_lonid = "bounds_"+lonName+appendDomid;
+                 if (!domain->bounds_lat_name.isEmpty()) bounds_latid = domain->bounds_lat_name;
+                 else bounds_latid = "bounds_"+latName+appendDomid;
 
                  dim0.push_back(dimXid);
@@ -1213,4 +1241,5 @@
         std::vector<StdString> dims;
         StdString axisid = axis->getAxisOutputName();
+        StdString axisDim;
         if (isWrittenAxis(axisid)) return ;
         else setWrittenAxis(axisid);
@@ -1225,10 +1254,15 @@
         try
         {
-          SuperClassWriter::addDimension(axisid, zoom_size);
           if (!axis->label.isEmpty()) SuperClassWriter::addDimension(strId, stringArrayLen);
           if (axis->hasValue)
           {
-            dims.push_back(axisid);
+            if (axis->dim_name.isEmpty()) axisDim = axisid;
+            else axisDim=axis->dim_name.getValue();
+
+            SuperClassWriter::addDimension(axisDim, zoom_size);
+            dims.push_back(axisDim);
+
             if (!axis->label.isEmpty()) dims.push_back(strId);
+
             SuperClassWriter::addVariable(axisid, typePrec, dims);
 
@@ -1245,7 +1279,25 @@
               SuperClassWriter::addAttribute("units", axis->unit.getValue(), &axisid);
 
+            if (!axis->axis_type.isEmpty())
+            {
+              switch(axis->axis_type)
+              {
+              case CAxis::axis_type_attr::X :
+                SuperClassWriter::addAttribute("axis", string("X"), &axisid);
+                break;
+              case CAxis::axis_type_attr::Y :
+                SuperClassWriter::addAttribute("axis", string("Y"), &axisid);
+                break;
+              case CAxis::axis_type_attr::Z :
+                SuperClassWriter::addAttribute("axis", string("Z"), &axisid);
+                break;
+              case CAxis::axis_type_attr::T :
+                SuperClassWriter::addAttribute("axis", string("T"), &axisid);
+                break;
+              }
+            }
+
             if (!axis->positive.isEmpty())
             {
-              SuperClassWriter::addAttribute("axis", string("Z"), &axisid);
               SuperClassWriter::addAttribute("positive",
                                              (axis->positive == CAxis::positive_attr::up) ? string("up") : string("down"),
@@ -1278,5 +1330,4 @@
                 SuperClassWriter::addAttribute("formula_term", axis->formula_term_bounds.getValue(), &axisBoundsId);
             }
-
               
             SuperClassWriter::definition_end();
@@ -1413,4 +1464,5 @@
 
         StdString scalaId = scalar->getScalarOutputName();
+        StdString boundsId;
         if (isWrittenAxis(scalaId)) return ;
         else setWrittenAxis(scalaId);
@@ -1421,11 +1473,12 @@
         else if (scalar->prec==8)   typePrec =  NC_DOUBLE ;
 
-        
         try
         {
           if (!scalar->value.isEmpty())
           {
+            std::vector<StdString> dims;
 //            dims.push_back(scalaId);
-            std::vector<StdString> dims;
+            StdString scalarDim = scalaId;
+
             SuperClassWriter::addVariable(scalaId, typePrec, dims);
 
@@ -1441,4 +1494,34 @@
             if (!scalar->unit.isEmpty())
               SuperClassWriter::addAttribute("units", scalar->unit.getValue(), &scalaId);
+
+            if (!scalar->axis_type.isEmpty())
+            {
+              switch(scalar->axis_type)
+              {
+              case CScalar::axis_type_attr::X :
+                SuperClassWriter::addAttribute("axis", string("X"), &scalaId);
+                break;
+              case CScalar::axis_type_attr::Y :
+                SuperClassWriter::addAttribute("axis", string("Y"), &scalaId);
+                break;
+              case CScalar::axis_type_attr::Z :
+                SuperClassWriter::addAttribute("axis", string("Z"), &scalaId);
+                break;
+              case CScalar::axis_type_attr::T :
+                SuperClassWriter::addAttribute("axis", string("T"), &scalaId);
+                break;
+              }
+            }
+
+            if (!scalar->bounds_value.isEmpty())
+            {
+              if (!scalar->bounds_value_name.isEmpty())
+              {
+                boundsId = scalar->bounds_value_name.getValue();
+                SuperClassWriter::addAttribute("bounds_value_name", boundsId, &scalaId);
+              }
+              SuperClassWriter::addDimension(boundsId, 1);
+              SuperClassWriter::addVariable(boundsId, typePrec, dims);
+            }
 
             SuperClassWriter::definition_end();
@@ -1451,4 +1534,9 @@
                 scalarValue(0) = scalar->value;
                 SuperClassWriter::writeData(scalarValue, scalaId, isCollective, 0);
+                if (!scalar->bounds_value.isEmpty())
+                {
+                  scalarValue(0) = scalar->bounds_value;
+                  SuperClassWriter::writeData(scalarValue, boundsId, isCollective, 0);
+                }
                 SuperClassWriter::definition_start();
 
@@ -1465,4 +1553,9 @@
                 count[0] = 1;
                 SuperClassWriter::writeData(scalarValue, scalaId, isCollective, 0, &start, &count);
+                if (!scalar->bounds_value.isEmpty())
+                {
+                  scalarValue(0) = scalar->bounds_value;
+                  SuperClassWriter::writeData(scalarValue, boundsId, isCollective, 0, &start, &count);
+                }
                 SuperClassWriter::definition_start();
 
@@ -1533,5 +1626,7 @@
                    break;
                  case CDomain::type_attr::unstructured:
-                   compress << "cell" << appendDomId;
+                   StdString cellName = (!domain->dim_i_name.isEmpty()) ? cellName=domain->dim_i_name : "cell";
+                   compress << cellName << appendDomId;
+//                   compress << "cell" << appendDomId;
                    break;
                }
@@ -1759,4 +1854,5 @@
             StdString appendDomId  = singleDomain ? "" : "_" + domId ;
             StdString lonName,latName ;
+            StdString dimIname,dimJname ;
 
             if (domain->lon_name.isEmpty())
@@ -1773,4 +1869,19 @@
             }
             else latName = domain->lat_name;
+
+            if (domain->dim_i_name.isEmpty())
+            {
+              if (domain->type==CDomain::type_attr::curvilinear) dimIname = "x";
+              else if (domain->type==CDomain::type_attr::unstructured) dimIname = "cell";
+              else dimIname = lonName;
+            }
+            else dimIname = domain->dim_i_name;
+
+            if (domain->dim_j_name.isEmpty())
+            {
+              if (domain->type==CDomain::type_attr::curvilinear) dimJname = "y";
+              else dimJname = latName;
+            }
+            else dimJname = domain->dim_j_name;
         
             if (compressedOutput && domain->isCompressible() && domain->type != CDomain::type_attr::unstructured)
@@ -1785,7 +1896,7 @@
                 if (!compressedOutput || !domain->isCompressible())
                 {
-                  dimXid     = StdString("x").append(appendDomId);
+                  dimXid=dimIname+appendDomId;
+                  dimYid=dimJname+appendDomId;
                   dimIdList.push_back(dimXid);
-                  dimYid     = StdString("y").append(appendDomId);
                   dimIdList.push_back(dimYid);
                 }
@@ -1796,9 +1907,12 @@
                 if (!compressedOutput || !domain->isCompressible())
                 {
-                  dimXid     = lonName+appendDomId;
+                  dimXid     = dimIname+appendDomId;
+                  dimYid     = dimJname+appendDomId;
                   dimIdList.push_back(dimXid);
-                  dimYid     = latName+appendDomId;
                   dimIdList.push_back(dimYid);
                 }
+                if (lonName != dimIname)  dimCoordList.push_back(lonName+appendDomId);
+                if (latName != dimJname)  dimCoordList.push_back(latName+appendDomId);
+
               break ;
               case CDomain::type_attr::unstructured:
@@ -1806,5 +1920,5 @@
                 if (SuperClassWriter::useCFConvention)
                 {
-                  dimXid     = StdString("cell").append(appendDomId);
+                  dimXid     = dimIname + appendDomId;
                   dimIdList.push_back(dimXid);
                   dimCoordList.push_back(lonName+appendDomId);
@@ -1850,19 +1964,26 @@
             CAxis* axis = CAxis::get(axisList[idxAxis]);
             StdString axisId = axis->getAxisOutputName();
+            StdString axisDim;
+
+            if (axis->dim_name.isEmpty()) axisDim = axisId;
+            else axisDim=axis->dim_name.getValue();
 
             if (compressedOutput && axis->isCompressible())
             {
-              dimIdList.push_back(axisId + "_points");
+              dimIdList.push_back(axisDim + "_points");
               field->setUseCompressedOutput();
             }
             else
-              dimIdList.push_back(axisId);
-
-            dimCoordList.push_back(axisId);
+              dimIdList.push_back(axisDim);
+
+            if (axisDim != axisId) dimCoordList.push_back(axisId);
             ++idxAxis;
           }
-          else // scalar
+          else
           {
-             /* Do nothing here */
+            CScalar* scalar = CScalar::get(scalarList[idxScalar]);
+            StdString scalarId = scalar->getScalarOutputName();
+            dimCoordList.push_back(scalarId);
+            ++idxScalar;
           }
         }
