Index: XIOS/trunk/src/filter/file_writer_filter.cpp
===================================================================
--- XIOS/trunk/src/filter/file_writer_filter.cpp	(revision 1183)
+++ XIOS/trunk/src/filter/file_writer_filter.cpp	(revision 1186)
@@ -17,19 +17,21 @@
   void CFileWriterFilter::onInputReady(std::vector<CDataPacketPtr> data)
   {
-    bool ignoreMissingValue = (!field->detect_missing_value.isEmpty() && 
-                               !field->default_value.isEmpty() && 
-                               field->detect_missing_value == true);
-    if (ignoreMissingValue)
+    CDataPacketPtr packet = data[0];
+
+    const bool detectMissingValue = (!field->detect_missing_value.isEmpty()
+                                      && !field->default_value.isEmpty()
+                                      && field->detect_missing_value == true);
+    if (detectMissingValue)
     {
-      double missingValue = field->default_value;
-      size_t nbData = data[0]->data.numElements();
+      const double missingValue = field->default_value;
+      const size_t nbData = packet->data.numElements();
       for (size_t idx = 0; idx < nbData; ++idx)
       {
-        if (NumTraits<double>::isnan(data[0]->data(idx)))
-          data[0]->data(idx) = missingValue;
+        if (NumTraits<double>::isnan(packet->data(idx)))
+          packet->data(idx) = missingValue;
       }
-    }    
+    }
 
-    field->sendUpdateData(data[0]->data);
+    field->sendUpdateData(packet->data);
   }
 
Index: XIOS/trunk/src/filter/source_filter.cpp
===================================================================
--- XIOS/trunk/src/filter/source_filter.cpp	(revision 1183)
+++ XIOS/trunk/src/filter/source_filter.cpp	(revision 1186)
@@ -37,6 +37,6 @@
     if (hasMissingValue)
     {
-      double nanValue = std::numeric_limits<double>::quiet_NaN();
-      size_t nbData = packet->data.numElements();
+      const double nanValue = std::numeric_limits<double>::quiet_NaN();
+      const size_t nbData = packet->data.numElements();
       for (size_t idx = 0; idx < nbData; ++idx)
       {
@@ -82,4 +82,16 @@
     }
 
+    // Convert missing values to NaN
+    if (hasMissingValue)
+    {
+      const double nanValue = std::numeric_limits<double>::quiet_NaN();
+      const size_t nbData = packet->data.numElements();
+      for (size_t idx = 0; idx < nbData; ++idx)
+      {
+        if (defaultValue == packet->data(idx))
+          packet->data(idx) = nanValue;
+      }
+    }
+
     onOutputReady(packet);
   }
Index: XIOS/trunk/src/filter/source_filter.hpp
===================================================================
--- XIOS/trunk/src/filter/source_filter.hpp	(revision 1183)
+++ XIOS/trunk/src/filter/source_filter.hpp	(revision 1186)
@@ -62,6 +62,6 @@
       CGrid* grid; //!< The grid attached to the data the filter can accept
       const CDuration offset; //!< The offset applied to the timestamp of all packets
-      bool hasMissingValue;
-      double defaultValue;
+      const bool hasMissingValue;
+      const double defaultValue;
   }; // class CSourceFilter
 } // namespace xios
Index: XIOS/trunk/src/filter/store_filter.cpp
===================================================================
--- XIOS/trunk/src/filter/store_filter.cpp	(revision 1183)
+++ XIOS/trunk/src/filter/store_filter.cpp	(revision 1186)
@@ -6,9 +6,12 @@
 namespace xios
 {
-  CStoreFilter::CStoreFilter(CGarbageCollector& gc, CContext* context, CGrid* grid)
+  CStoreFilter::CStoreFilter(CGarbageCollector& gc, CContext* context, CGrid* grid,
+                             bool detectMissingValues /*= false*/, double missingValue /*= 0.0*/)
     : CInputPin(gc, 1)
     , gc(gc)
     , context(context)
     , grid(grid)
+    , detectMissingValues(detectMissingValues)
+    , missingValue(missingValue)
   {
     if (!context)
@@ -75,8 +78,20 @@
   void CStoreFilter::onInputReady(std::vector<CDataPacketPtr> data)
   {
-    packets.insert(std::make_pair(data[0]->timestamp, data[0]));
+    CDataPacketPtr packet = data[0];
+
+    packets.insert(std::make_pair(packet->timestamp, packet));
     // The packet is always destroyed by the garbage collector
     // so we register but never unregister
-    gc.registerObject(this, data[0]->timestamp);
+    gc.registerObject(this, packet->timestamp);
+
+    if (detectMissingValues)
+    {
+      const size_t nbData = packet->data.numElements();
+      for (size_t idx = 0; idx < nbData; ++idx)
+      {
+        if (NumTraits<double>::isnan(packet->data(idx)))
+          packet->data(idx) = missingValue;
+      }
+    }
   }
 
Index: XIOS/trunk/src/filter/store_filter.hpp
===================================================================
--- XIOS/trunk/src/filter/store_filter.hpp	(revision 1183)
+++ XIOS/trunk/src/filter/store_filter.hpp	(revision 1186)
@@ -22,6 +22,9 @@
        * \param context the context to which the data belongs
        * \param grid the grid to which the data is attached
+       * \param detectMissingValues whether missing values should be detected
+       * \param missingValue the value to use to replace missing values
        */
-      CStoreFilter(CGarbageCollector& gc, CContext* context, CGrid* grid);
+      CStoreFilter(CGarbageCollector& gc, CContext* context, CGrid* grid,
+                   bool detectMissingValues = false, double missingValue = 0.0);
 
       /*!
@@ -75,4 +78,6 @@
       CContext* context; //!< The context to which the data belongs
       CGrid* grid; //!< The grid attached to the data the filter can accept
+      const bool detectMissingValues; //!< Whether missing values should be detected
+      const double missingValue; //!< The value to use to replace missing values
       std::map<Time, CDataPacketPtr> packets; //<! The stored packets
   }; // class CStoreFilter
