Ignore:
Timestamp:
06/28/17 15:25:20 (7 years ago)
Author:
rlacroix
Message:

Fix: Ensure "detect_missing_value" is always applied.

Missing values are know handled as expected for input fields (both from file or from model).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/filter/source_filter.cpp

    r1018 r1186  
    3737    if (hasMissingValue) 
    3838    { 
    39       double nanValue = std::numeric_limits<double>::quiet_NaN(); 
    40       size_t nbData = packet->data.numElements(); 
     39      const double nanValue = std::numeric_limits<double>::quiet_NaN(); 
     40      const size_t nbData = packet->data.numElements(); 
    4141      for (size_t idx = 0; idx < nbData; ++idx) 
    4242      { 
     
    8282    } 
    8383 
     84    // Convert missing values to NaN 
     85    if (hasMissingValue) 
     86    { 
     87      const double nanValue = std::numeric_limits<double>::quiet_NaN(); 
     88      const size_t nbData = packet->data.numElements(); 
     89      for (size_t idx = 0; idx < nbData; ++idx) 
     90      { 
     91        if (defaultValue == packet->data(idx)) 
     92          packet->data(idx) = nanValue; 
     93      } 
     94    } 
     95 
    8496    onOutputReady(packet); 
    8597  } 
Note: See TracChangeset for help on using the changeset viewer.