Index: /XIOS/trunk/src/config/field_attribute.conf
===================================================================
--- /XIOS/trunk/src/config/field_attribute.conf	(revision 469)
+++ /XIOS/trunk/src/config/field_attribute.conf	(revision 470)
@@ -5,4 +5,5 @@
 DECLARE_ATTRIBUTE(StdString, unit)
 DECLARE_ATTRIBUTE(StdString, operation)
+DECLARE_ATTRIBUTE(bool,      detect_missing_value)
 
 DECLARE_ATTRIBUTE(StdString, freq_op)
Index: /XIOS/trunk/src/functor/accumulate.cpp
===================================================================
--- /XIOS/trunk/src/functor/accumulate.cpp	(revision 469)
+++ /XIOS/trunk/src/functor/accumulate.cpp	(revision 470)
@@ -9,5 +9,9 @@
 
       CAccumulate::CAccumulate(CArray<double,1>& doutput)
-         : SuperClass(StdString("average"), doutput)
+         : SuperClass(StdString("accumulate"), doutput)
+      { /* Ne rien faire de plus */ }
+
+      CAccumulate::CAccumulate(CArray<double,1>& doutput, double missingValue)
+         : SuperClass(StdString("accumulate"), doutput, missingValue)
       { /* Ne rien faire de plus */ }
 
@@ -20,25 +24,26 @@
                                  CArray<double,1>& _doutput)
       {
-/*
-         const double * it1  = _dinput->data(),
-                      * end1 = _dinput->data() + _dinput->num_elements(); 
-               double * it   = _doutput->data();
-         if (this->nbcall == 1)
-              for (; it1 != end1; it1++, it++) *it  = *it1;
-         else for (; it1 != end1; it1++, it++) *it += *it1;               
-*/
         if (this->nbcall == 1) _doutput=_dinput ;
-        else _doutput+=_dinput ;
+        else 
+        {
+          if (hasMissingValue)
+          {
+            int i, n =_dinput.numElements() ;
+            const double * in=_dinput.dataFirst() ;
+            double* out=_doutput.dataFirst();
+            for (i=0; i<n; ++i,++in,++out) 
+              if (*in!=missingValue)
+              {
+                if(*out!=missingValue) *out  += *in;
+                else *out=*in ;
+              }
+          }
+          else _doutput+=_dinput ;
+        }
+      }
       
-      }
       
       void CAccumulate::final(void)
       {
-/*          double * it1  = this->getDataOutput()->data(),
-                 * end1 = this->getDataOutput()->data() + this->getDataOutput()->num_elements();
-          for (; it1 != end1; it1++) *it1 /= this->nbcall;
-          this->nbcall = 0;                                                   
-*/
-//        doutput/=this->nbcall; 
         this->nbcall = 0; 
       }
Index: /XIOS/trunk/src/functor/accumulate.hpp
===================================================================
--- /XIOS/trunk/src/functor/accumulate.hpp	(revision 469)
+++ /XIOS/trunk/src/functor/accumulate.hpp	(revision 470)
@@ -22,4 +22,5 @@
             //CAccumulate(const CFunData & data);
             CAccumulate(CArray<double,1>& doutput);
+            CAccumulate(CArray<double,1>& doutput, double missingValue);
             //CAccumulate(const CAccumulate & accumulate);         // Not implemented.
             //CAccumulate(const CAccumulate * const accumulate);   // Not implemented.
Index: /XIOS/trunk/src/functor/average.cpp
===================================================================
--- /XIOS/trunk/src/functor/average.cpp	(revision 469)
+++ /XIOS/trunk/src/functor/average.cpp	(revision 470)
@@ -12,4 +12,8 @@
       { /* Ne rien faire de plus */ }
 
+      CAverage::CAverage(CArray<double,1>& doutput, double missingValue)
+         : SuperClass(StdString("average"), doutput, missingValue)
+      { /* Ne rien faire de plus */ }
+
       CAverage::~CAverage(void)
       { /* Ne rien faire de plus */ }
@@ -20,14 +24,43 @@
                                  CArray<double,1>& _doutput)
       {
-/*
-         const double * it1  = _dinput->data(),
-                      * end1 = _dinput->data() + _dinput->num_elements(); 
-               double * it   = _doutput->data();
-         if (this->nbcall == 1)
-              for (; it1 != end1; it1++, it++) *it  = *it1;
-         else for (; it1 != end1; it1++, it++) *it += *it1;               
-*/
-        if (this->nbcall == 1) _doutput=_dinput ;
-        else _doutput+=_dinput ;
+        if (hasMissingValue)
+        {
+          if (nbcalls.numElements()==0) 
+          {
+             nbcalls.resize(_dinput.numElements()) ;
+             nbcalls=0 ;
+          }
+        }
+        
+        if (this->nbcall == 1) 
+        {
+          _doutput=_dinput ;
+          if (hasMissingValue) 
+          {
+            int i, n =_dinput.numElements() ;
+            const double * in=_dinput.dataFirst() ;
+            int* nc=nbcalls.dataFirst() ;
+            for (i=0; i<n; ++i,++nc) 
+              if (*in!=missingValue) (*nc) ++;
+          }
+        }
+        else
+        {
+          if (hasMissingValue)
+          {
+            int i, n =_dinput.numElements() ;
+            const double * in=_dinput.dataFirst() ;
+            double* out=_doutput.dataFirst();
+            int* nc=nbcalls.dataFirst() ;
+            for (i=0; i<n; ++i,++in,++out,++nc) 
+              if (*in!=missingValue) 
+              {
+                if (*nc != 0) (*out)  += *in;
+                else *out = *in ;
+                (*nc) ++;
+              } 
+          }
+          else _doutput+=_dinput ;
+        }
       
       }
@@ -35,11 +68,20 @@
       void CAverage::final(void)
       {
-/*          double * it1  = this->getDataOutput()->data(),
-                 * end1 = this->getDataOutput()->data() + this->getDataOutput()->num_elements();
-          for (; it1 != end1; it1++) *it1 /= this->nbcall;
-          this->nbcall = 0;                                                   
-*/
-        doutput/=this->nbcall; 
+        if (hasMissingValue)
+        {
+          int i, n = nbcalls.numElements() ;
+          double* out= doutput.dataFirst();
+          int* nc=nbcalls.dataFirst() ;
+          for (i=0; i<n; ++i, ++out,++nc) 
+            if (*nc!=0) 
+            {
+              *out  /= *nc;
+              *nc = 0 ;
+            }
+        
+        }  
+        else doutput/=this->nbcall; 
         this->nbcall = 0; 
+
       }
    } // namespace func
Index: /XIOS/trunk/src/functor/average.hpp
===================================================================
--- /XIOS/trunk/src/functor/average.hpp	(revision 469)
+++ /XIOS/trunk/src/functor/average.hpp	(revision 470)
@@ -22,4 +22,5 @@
             //CAverage(const CFunData & data);
             CAverage(CArray<double,1>& doutput);
+            CAverage(CArray<double,1>& doutput, double missingValue);
             //CAverage(const CAverage & average);         // Not implemented.
             //CAverage(const CAverage * const average);   // Not implemented.
Index: /XIOS/trunk/src/functor/instant.cpp
===================================================================
--- /XIOS/trunk/src/functor/instant.cpp	(revision 469)
+++ /XIOS/trunk/src/functor/instant.cpp	(revision 470)
@@ -10,4 +10,8 @@
       CInstant::CInstant(CArray<double,1>& doutput)
          : SuperClass(StdString("instant"), doutput)
+      { /* Ne rien faire de plus */ }
+ 
+      CInstant::CInstant(CArray<double,1>& doutput, double missingValue)
+         : SuperClass(StdString("instant"), doutput, missingValue)
       { /* Ne rien faire de plus */ }
 
Index: /XIOS/trunk/src/functor/instant.hpp
===================================================================
--- /XIOS/trunk/src/functor/instant.hpp	(revision 469)
+++ /XIOS/trunk/src/functor/instant.hpp	(revision 470)
@@ -22,5 +22,6 @@
             //CInstant(const CFunData & data);
             CInstant(CArray<double,1>& doutput);
-            //CInstant(const CInstant & instant);         // Not implemented.
+            CInstant(CArray<double,1>& doutput, double missingValue);
+           //CInstant(const CInstant & instant);         // Not implemented.
             //CInstant(const CInstant * const instant);   // Not implemented.
 
Index: /XIOS/trunk/src/functor/maximum.cpp
===================================================================
--- /XIOS/trunk/src/functor/maximum.cpp	(revision 469)
+++ /XIOS/trunk/src/functor/maximum.cpp	(revision 470)
@@ -14,4 +14,8 @@
       { /* Ne rien faire de plus */ }
 
+      CMaximum::CMaximum(CArray<double,1>& doutput, double missingValue)
+         : SuperClass(StdString("maximum"), doutput, missingValue)
+      { /* Ne rien faire de plus */ }
+
       CMaximum::~CMaximum(void)
       { /* Ne rien faire de plus */ }
@@ -26,5 +30,17 @@
               double * it   = _doutput.dataFirst();
          if (this->nbcall == 1) for (; it1 != end1; it1++, it++) *it = *it1;
-         else for (; it1 != end1; it1++, it++) *it = std::max(*it1, *it);
+         else 
+         {
+           if (hasMissingValue) 
+           { 
+             for (; it1 != end1; it1++, it++) 
+               if (*it1 != missingValue)
+               {
+                 if ( *it != missingValue) *it = std::max(*it1, *it);
+                 else *it=*it1 ;  
+               }
+           }
+           else for (; it1 != end1; it1++, it++) *it = std::max(*it1, *it);
+         }
 
 
Index: /XIOS/trunk/src/functor/maximum.hpp
===================================================================
--- /XIOS/trunk/src/functor/maximum.hpp	(revision 469)
+++ /XIOS/trunk/src/functor/maximum.hpp	(revision 470)
@@ -22,4 +22,5 @@
             //CMaximum(const CFunData & data);
             CMaximum(CArray<double,1>& doutput);
+            CMaximum(CArray<double,1>& doutput, double missingValue);
             //CMaximum(const CMaximum & Maximum);         // Not implemented.
             //CMaximum(const CMaximum * const Maximum);   // Not implemented.
Index: /XIOS/trunk/src/functor/minimum.cpp
===================================================================
--- /XIOS/trunk/src/functor/minimum.cpp	(revision 469)
+++ /XIOS/trunk/src/functor/minimum.cpp	(revision 470)
@@ -11,4 +11,8 @@
       CMinimum::CMinimum(CArray<double,1>& doutput)
          : SuperClass(StdString("minimum"), doutput)
+      { /* Ne rien faire de plus */ }
+
+      CMinimum::CMinimum(CArray<double,1>& doutput, double missingValue)
+         : SuperClass(StdString("minimum"), doutput, missingValue)
       { /* Ne rien faire de plus */ }
 
@@ -26,5 +30,17 @@
         
         if (this->nbcall == 1)  for (; it1 != end1; it1++, it++) *it = *it1;
-        else for (; it1 != end1; it1++, it++) *it = std::min(*it1, *it);
+        else 
+        {
+          if (hasMissingValue) 
+          { 
+            for (; it1 != end1; it1++, it++) 
+              if (*it1!=missingValue)
+              {
+                if (*it != missingValue) *it = std::min(*it1, *it);
+                else *it=*it1 ;
+              }
+          }
+          else for (; it1 != end1; it1++, it++) *it = std::min(*it1, *it);
+        }
 
       }
Index: /XIOS/trunk/src/functor/minimum.hpp
===================================================================
--- /XIOS/trunk/src/functor/minimum.hpp	(revision 469)
+++ /XIOS/trunk/src/functor/minimum.hpp	(revision 470)
@@ -22,4 +22,5 @@
             //CMinimum(const CFunData & data);
             CMinimum(CArray<double,1>& doutput);
+            CMinimum(CArray<double,1>& doutput, double missingValue);
             //CMinimum(const CMinimum & Minimum);         // Not implemented.
             //CMinimum(const CMinimum * const Minimum);   // Not implemented.
Index: /XIOS/trunk/src/functor/once.cpp
===================================================================
--- /XIOS/trunk/src/functor/once.cpp	(revision 469)
+++ /XIOS/trunk/src/functor/once.cpp	(revision 470)
@@ -10,4 +10,8 @@
       COnce::COnce(CArray<double,1>& doutput)
          : SuperClass(StdString("once"), doutput)
+      { /* Ne rien faire de plus */ }
+
+      COnce::COnce(CArray<double,1>& doutput, double missingValue)
+         : SuperClass(StdString("once"), doutput, missingValue)
       { /* Ne rien faire de plus */ }
 
Index: /XIOS/trunk/src/functor/once.hpp
===================================================================
--- /XIOS/trunk/src/functor/once.hpp	(revision 469)
+++ /XIOS/trunk/src/functor/once.hpp	(revision 470)
@@ -21,4 +21,5 @@
             //COnce(void);                       // Not implemented.
             COnce(CArray<double,1>& doutput);
+            COnce(CArray<double,1>& doutput, double missingValue);
             //COnce(const COnce & once);         // Not implemented.
             //COnce(const COnce * const once);   // Not implemented.
Index: /XIOS/trunk/src/node/field.cpp
===================================================================
--- /XIOS/trunk/src/node/field.cpp	(revision 469)
+++ /XIOS/trunk/src/node/field.cpp	(revision 470)
@@ -458,11 +458,19 @@
         else isOnceOperation=false;
         isFirstOperation=true;
-
+        
+          
 #define DECLARE_FUNCTOR(MType, mtype)              \
    if  (operation.getValue().compare(#mtype) == 0) \
    {                                               \
-      boost::shared_ptr<func::CFunctor>            \
-            foperation_(new C##MType(this->data)); \
-      this->foperation = foperation_;              \
+      if (!detect_missing_value.isEmpty() && !default_value.isEmpty() && detect_missing_value==true) \
+      { \
+        boost::shared_ptr<func::CFunctor> foperation_(new C##MType(this->data,default_value)); \
+        this->foperation = foperation_; \ 
+      } \
+      else \
+      { \
+        boost::shared_ptr<func::CFunctor> foperation_(new C##MType(this->data)); \
+        this->foperation = foperation_;  \
+      } \
       return;                                      \
    }
