Index: XIOS/trunk/src/output/nc4_data_output.cpp
===================================================================
--- XIOS/trunk/src/output/nc4_data_output.cpp	(revision 384)
+++ XIOS/trunk/src/output/nc4_data_output.cpp	(revision 391)
@@ -22,6 +22,6 @@
          StdString timeid = StdString("time_counter");
          SuperClass::type = MULTI_FILE;
-         if (!exist)
-            SuperClassWriter::addDimension(timeid);
+//         if (!exist)
+//            SuperClassWriter::addDimension(timeid);
       }
 
@@ -38,6 +38,6 @@
          SuperClass::type = (multifile) ? MULTI_FILE : ONE_FILE;
          
-         if (!exist)
-            SuperClassWriter::addDimension(timeid);
+ //        if (!exist)
+//            SuperClassWriter::addDimension(timeid);
       }
 
@@ -71,6 +71,9 @@
          StdString appendDomid  = (singleDomain) ? "" : "_"+domid ;
 
-         StdString lonid     = StdString("lon").append(appendDomid);
-         StdString latid     = StdString("lat").append(appendDomid);
+         StdString dimXid     = StdString("x").append(appendDomid);
+         StdString dimYid     = StdString("y").append(appendDomid);
+         
+         string lonid,latid ;
+/*
          StdString lonid_loc = (server->intraCommSize > 1)
                              ? StdString("lon").append(appendDomid).append("_local")
@@ -79,5 +82,5 @@
                              ? StdString("lat").append(appendDomid).append("_local")
                              : latid;
-
+*/
          bool isCurvilinear = domain->isCurvilinear ;
 
@@ -90,11 +93,11 @@
                if (server->intraCommSize > 1)
                {
-                 SuperClassWriter::addDimension(lonid, domain->zoom_ni.getValue());
-                 SuperClassWriter::addDimension(latid, domain->zoom_nj.getValue());
+//                 SuperClassWriter::addDimension(lonid, domain->zoom_ni.getValue());
+//                 SuperClassWriter::addDimension(latid, domain->zoom_nj.getValue());
                }
 
                if (isCurvilinear)
                {
-                 dim0.push_back(latid_loc); dim0.push_back(lonid_loc);
+                 dim0.push_back(dimYid); dim0.push_back(dimXid);
                  lonid = StdString("nav_lon").append(appendDomid);
                  latid = StdString("nav_lat").append(appendDomid);
@@ -102,10 +105,12 @@
                else
                {
-                 dim0.push_back(latid_loc);
-                 dim1.push_back(lonid_loc);
-               }
-
-               SuperClassWriter::addDimension(lonid_loc, domain->zoom_ni_srv);
-               SuperClassWriter::addDimension(latid_loc, domain->zoom_nj_srv);
+                 lonid = StdString("lon").append(appendDomid);
+                 latid = StdString("lat").append(appendDomid);
+                 dim0.push_back(dimYid);
+                 dim1.push_back(dimXid);
+               }
+
+               SuperClassWriter::addDimension(dimXid, domain->zoom_ni_srv);
+               SuperClassWriter::addDimension(dimYid, domain->zoom_nj_srv);
                if (server->intraCommSize > 1)
                {
@@ -115,4 +120,11 @@
                                              domain->zoom_nj_srv,
                                              appendDomid);
+                  
+                  if (singleDomain) this->writeLocalAttributes_IOIPSL(domain->zoom_ibegin_srv,
+                                             domain->zoom_ni_srv,
+                                             domain->zoom_jbegin_srv,
+                                             domain->zoom_nj_srv,
+                                             domain->ni_glo,domain->nj_glo,
+                                             server->intraCommRank,server->intraCommSize);
                }
                
@@ -133,6 +145,6 @@
 
                dim0.clear();
-               dim0.push_back(latid_loc);
-               dim0.push_back(lonid_loc);
+               dim0.push_back(dimYid);
+               dim0.push_back(dimXid);
 
 
@@ -172,11 +184,11 @@
             case (ONE_FILE) :
             {
-               SuperClassWriter::addDimension(lonid, domain->zoom_ni.getValue());
-               SuperClassWriter::addDimension(latid, domain->zoom_nj.getValue());
+               SuperClassWriter::addDimension(dimXid, domain->zoom_ni.getValue());
+               SuperClassWriter::addDimension(dimYid, domain->zoom_nj.getValue());
 
                
                if (isCurvilinear)
                {
-                  dim0.push_back(latid); dim0.push_back(lonid);
+                  dim0.push_back(dimYid); dim0.push_back(dimXid);
                   lonid = StdString("nav_lon").append(appendDomid);
                   latid = StdString("nav_lat").append(appendDomid);
@@ -186,6 +198,8 @@
                else
                {
-                  dim0.push_back(latid);
-                  dim1.push_back(lonid);
+                  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);
@@ -303,6 +317,10 @@
          }
          axis->addRelFile(this->filename);
-      }
-
+     }
+     
+     void CNc4DataOutput::writeTimeDimension_(void)
+     {
+       SuperClassWriter::addDimension(string("time_counter"));
+     }
       //--------------------------------------------------------------
 
@@ -324,6 +342,7 @@
          StdString appendDomid  = (singleDomain) ? "" : "_"+domid ;
 
-         StdString lonid     = StdString("lon").append(appendDomid);
-         StdString latid     = StdString("lat").append(appendDomid);
+         StdString dimXid     = StdString("x").append(appendDomid);
+         StdString dimYid     = StdString("y").append(appendDomid);
+/*
          StdString lonid_loc = (server->intraCommSize > 1)
                              ? StdString("lon").append(appendDomid).append("_local")
@@ -332,4 +351,5 @@
                              ? StdString("lat").append(appendDomid).append("_local")
                              : latid;
+*/
          StdString fieldid   = (!field->name.isEmpty())
                              ? field->name.getValue() : field->getBaseFieldReference()->getId();
@@ -370,6 +390,6 @@
          else
          {
-            coodinates.push_back(latid);
-            coodinates.push_back(lonid);
+            coodinates.push_back(StdString("lat").append(appendDomid));
+            coodinates.push_back(StdString("lon").append(appendDomid));
          }
 
@@ -378,12 +398,12 @@
             case (MULTI_FILE) :
             {
-               dims.push_back(latid_loc);
-               dims.push_back(lonid_loc);
+               dims.push_back(dimYid);
+               dims.push_back(dimXid);
                break ;
             }
             case (ONE_FILE) :
             {
-               dims.push_back(latid);
-               dims.push_back(lonid);
+               dims.push_back(dimYid);
+               dims.push_back(dimXid);
                break;
             }
@@ -674,4 +694,33 @@
       }
 
+     void CNc4DataOutput::writeLocalAttributes_IOIPSL
+         (int ibegin, int ni, int jbegin, int nj, int ni_glo, int nj_glo, int rank, int size)
+      {
+         CArray<int,1> array(2) ;
+
+         SuperClassWriter::addAttribute("DOMAIN_number_total",size ) ;
+         SuperClassWriter::addAttribute("DOMAIN_number", rank) ;
+         array=1,2 ;
+         SuperClassWriter::addAttribute("DOMAIN_dimensions_ids",array) ;
+         array=ni_glo,nj_glo ;
+         SuperClassWriter::addAttribute("DOMAIN_size_global", array) ;
+         array=ni,nj ;
+         SuperClassWriter::addAttribute("DOMAIN_size_local", array) ;
+         array=ibegin,jbegin ;
+         SuperClassWriter::addAttribute("DOMAIN_position_first", array) ;
+         array=ibegin+ni-1,jbegin+nj-1 ;
+         SuperClassWriter::addAttribute("DOMAIN_position_last",array) ;
+         array=0,0 ;
+         SuperClassWriter::addAttribute("DOMAIN_halo_size_start", array) ;
+         SuperClassWriter::addAttribute("DOMAIN_halo_size_end", array);
+         SuperClassWriter::addAttribute("DOMAIN_type",string("box")) ;
+/*
+         SuperClassWriter::addAttribute("DOMAIN_DIM_N001",string("x")) ;
+         SuperClassWriter::addAttribute("DOMAIN_DIM_N002",string("y")) ;
+         SuperClassWriter::addAttribute("DOMAIN_DIM_N003",string("axis_A")) ;
+         SuperClassWriter::addAttribute("DOMAIN_DIM_N004",string("time_counter")) ;
+*/
+
+      }
       //---------------------------------------------------------------
 
