Ignore:
Timestamp:
09/05/17 16:49:13 (5 years ago)
Author:
oabramkina
Message:

Fixing a bug in case of activated missing values. If nan values are replaced by default values or vice versa data package (or data) is copied.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/XIOS_DEV_CMIP6/src/filter/store_filter.cpp

    r1246 r1251  
    7878  void CStoreFilter::onInputReady(std::vector<CDataPacketPtr> data) 
    7979  { 
    80     CDataPacketPtr packet = data[0]; 
     80 
     81    CDataPacketPtr packet; 
     82    if (detectMissingValues) 
     83    { 
     84      CArray<double, 1> dataArray = data[0]->data.copy(); 
     85 
     86      const size_t nbData = dataArray.numElements(); 
     87      for (size_t idx = 0; idx < nbData; ++idx) 
     88      { 
     89        if (NumTraits<double>::isnan(dataArray(idx))) 
     90          dataArray(idx) = missingValue; 
     91      } 
     92 
     93      packet = CDataPacketPtr(new CDataPacket); 
     94      packet->date = data[0]->date; 
     95      packet->timestamp = data[0]->timestamp; 
     96      packet->status = data[0]->status; 
     97      packet->data.resize(dataArray.numElements()); 
     98      packet->data = dataArray; 
     99    } 
     100 
     101    else 
     102    { 
     103      packet = data[0]; 
     104    } 
    81105 
    82106    packets.insert(std::make_pair(packet->timestamp, packet)); 
     
    85109    gc.registerObject(this, packet->timestamp); 
    86110 
    87     if (detectMissingValues) 
    88     { 
    89       const size_t nbData = packet->data.numElements(); 
    90       for (size_t idx = 0; idx < nbData; ++idx) 
    91       { 
    92         if (NumTraits<double>::isnan(packet->data(idx))) 
    93           packet->data(idx) = missingValue; 
    94       } 
    95     } 
    96111  } 
    97112 
Note: See TracChangeset for help on using the changeset viewer.