Index: XIOS/trunk/src/output/nc4_data_output.cpp
===================================================================
--- XIOS/trunk/src/output/nc4_data_output.cpp	(revision 379)
+++ XIOS/trunk/src/output/nc4_data_output.cpp	(revision 384)
@@ -80,5 +80,5 @@
                              : latid;
 
-         bool isCurvilinear = true ; //for moment
+         bool isCurvilinear = domain->isCurvilinear ;
 
          switch (SuperClass::type)
@@ -152,7 +152,18 @@
 
                SuperClassWriter::definition_end();
-               SuperClassWriter::writeData(domain->latvalue_srv, latid, isCollective, 0);
-               SuperClassWriter::writeData(domain->lonvalue_srv, lonid, isCollective, 0);
+               if (isCurvilinear)
+               {
+ 
+                 SuperClassWriter::writeData(domain->latvalue_srv, latid, isCollective, 0);
+                 SuperClassWriter::writeData(domain->lonvalue_srv, lonid, isCollective, 0);
 // supress mask               if (server->intraCommSize > 1) SuperClassWriter::writeData(mask, maskid);
+               }
+               else
+               {
+                  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);
+               }
                SuperClassWriter::definition_start();
 
@@ -187,21 +198,46 @@
 
                SuperClassWriter::definition_end();
-               std::vector<StdSize> start(2) ; 
-               std::vector<StdSize> count(2) ;
-               if (domain->isEmpty())
-               {
-                 start[0]=0 ; start [1]=0 ; 
-                 count[0]=0 ; count[1]=0 ; 
+               if (isCurvilinear)
+               {
+                 std::vector<StdSize> start(2) ; 
+                 std::vector<StdSize> count(2) ;
+                 if (domain->isEmpty())
+                 {
+                   start[0]=0 ; start [1]=0 ; 
+                   count[0]=0 ; count[1]=0 ; 
+                 }
+                 else
+                 {
+                   start[1]=domain->zoom_ibegin_srv-domain->zoom_ibegin.getValue() ; start [0]=domain->zoom_jbegin_srv-domain->zoom_jbegin.getValue() ; 
+                   count[1]=domain->zoom_ni_srv ; count[0]=domain->zoom_nj_srv ; 
+                 }
+                 
+                 SuperClassWriter::writeData(domain->latvalue_srv, latid, isCollective, 0,&start,&count);
+                 SuperClassWriter::writeData(domain->lonvalue_srv, lonid, isCollective, 0,&start,&count);
                }
                else
                {
-                 start[1]=domain->zoom_ibegin_srv-domain->zoom_ibegin.getValue() ; start [0]=domain->zoom_jbegin_srv-domain->zoom_jbegin.getValue() ; 
-                 count[1]=domain->zoom_ni_srv ; count[0]=domain->zoom_nj_srv ; 
-               }
-               
-               SuperClassWriter::writeData(domain->latvalue_srv, latid, isCollective, 0,&start,&count);
-               SuperClassWriter::writeData(domain->lonvalue_srv, 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->zoom_jbegin.getValue() ; 
+                   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->zoom_ibegin.getValue() ; 
+                   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);
+                 }
+               }
                SuperClassWriter::definition_start();
-
                break;
             }           
@@ -301,5 +337,5 @@
 //         unsigned int ssize = domain->zoom_ni_loc.getValue() * domain->zoom_nj_loc.getValue();
 //         bool isCurvilinear = (domain->lonvalue.getValue()->size() == ssize);
-          bool isCurvilinear = true ; // for moment 
+          bool isCurvilinear = domain->isCurvilinear ; 
           
          nc_type type = (!field->prec.isEmpty() &&
@@ -492,4 +528,5 @@
             CAxis* axis = grid->axis ;
             CArray<double,3> field_data3D(domain->zoom_ni_srv,domain->zoom_nj_srv,axis->zoom_size) ;
+            if (!field->default_value.isEmpty()) field_data3D = field->default_value ;
             field->outputField(field_data3D);
             switch (SuperClass::type)
@@ -526,4 +563,5 @@
          {
             CArray<double,2> field_data2D(domain->zoom_ni_srv,domain->zoom_nj_srv) ;
+            if (!field->default_value.isEmpty()) field_data2D = field->default_value ;
             field->outputField(field_data2D);
             switch (SuperClass::type)
