Ignore:
Timestamp:
10/09/17 16:48:08 (5 years ago)
Author:
oabramkina
Message:

Correcting behaviour of the temporal filter in case of frequencies defined in months.
Now in case of instant operation and output_freq=1mo, data are output correctly without unnecessary copies being created.

File:
1 edited

Legend:

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

    r1285 r1302  
    1717    , samplingOffset(samplingOffset) 
    1818    , opFreq(opFreq) 
     19    , offsetMonth({0, this->samplingOffset.month, 0, 0, 0, 0, 0}) 
     20    , offsetAllButMonth({this->samplingOffset.year, 0 , this->samplingOffset.day, 
     21                       this->samplingOffset.hour, this->samplingOffset.minute, 
     22                       this->samplingOffset.second, this->samplingOffset.timestep}) 
     23    , initDate(initDate) 
    1924    , nextSamplingDate(initDate + this->samplingOffset + initDate.getRelCalendar().getTimeStep()) 
    20     , nextOperationDate(initDate + opFreq + this->samplingOffset) 
     25    , nbOperationDates(1) 
     26//    , nextOperationDate(initDate + opFreq + this->samplingOffset) 
    2127    , isFirstOperation(true) 
    2228  { 
     
    3541      { 
    3642        usePacket = (data[0]->date >= nextSamplingDate); 
    37         outputResult = (data[0]->date + samplingFreq > nextOperationDate); 
     43//        outputResult = (data[0]->date + samplingFreq > nextOperationDate); 
     44        outputResult = (data[0]->date  > initDate + nbOperationDates*opFreq - samplingFreq + offsetMonth + offsetAllButMonth); 
    3845        copyLess = (isInstantOperation && usePacket && outputResult); 
    3946      } 
     
    5461      if (outputResult) 
    5562      { 
     63        nbOperationDates ++; 
    5664        if (!copyLess) 
    5765        { 
     
    6977 
    7078        isFirstOperation = false; 
    71         nextOperationDate = nextOperationDate + samplingFreq + opFreq - samplingFreq; 
     79//        nextOperationDate = initDate + samplingFreq + nbOperationDates*opFreq - samplingFreq + offsetMonth + offsetAllButMonth; 
    7280      } 
    7381    } 
     
    7886  bool CTemporalFilter::isDataExpected(const CDate& date) const 
    7987  { 
    80     return isOnceOperation ? isFirstOperation : (date >= nextSamplingDate || date + samplingFreq > nextOperationDate); 
     88//    return isOnceOperation ? isFirstOperation : (date >= nextSamplingDate || date + samplingFreq > nextOperationDate); 
     89    return isOnceOperation ? isFirstOperation : (date >= nextSamplingDate || date > initDate + nbOperationDates*opFreq - samplingFreq + offsetMonth + offsetAllButMonth); 
    8190  } 
    8291 
Note: See TracChangeset for help on using the changeset viewer.