Changeset 1302 for XIOS


Ignore:
Timestamp:
10/09/17 16:48:08 (7 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.

Location:
XIOS/dev/XIOS_DEV_CMIP6/src
Files:
3 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 
  • XIOS/dev/XIOS_DEV_CMIP6/src/filter/temporal_filter.hpp

    r1285 r1302  
    5656      const CDuration samplingOffset; //!< The sampling offset, i.e. the offset after which the input data will be used 
    5757      const CDuration opFreq; //!< The operation frequency, i.e. the frequency at which the output data will be computed 
     58      const CDuration offsetMonth; //!< The month duration of samplingOffset 
     59      CDuration offsetAllButMonth; //!< All but the month duration of samplingOffset 
     60      const CDate initDate; 
    5861      CDate nextSamplingDate; //!< The date of the next sampling 
    59       CDate nextOperationDate; //!< The date of the next operation 
     62      int nbOperationDates; //!< The number of times an operation is performed 
     63//      CDate nextOperationDate; //!< The date of the next operation 
    6064      bool isFirstOperation; //!< True before the first operation was been computed 
    6165  }; // class CTemporalFilter 
  • XIOS/dev/XIOS_DEV_CMIP6/src/node/field.cpp

    r1294 r1302  
    951951     { 
    952952        if (!instantDataFilter) 
    953 //          instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, NoneDu, false, 
    954 //                                                                                                      detectMissingValues, defaultValue)); 
    955953          instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid,true)); 
    956954 
     
    969967     { 
    970968       if (!instantDataFilter) 
    971 //         instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, false, NoneDu, false, 
    972 //                                                                                                     detectMissingValues, defaultValue)); 
    973969         instantDataFilter = clientSourceFilter = boost::shared_ptr<CSourceFilter>(new CSourceFilter(gc, grid, true)); 
    974970 
Note: See TracChangeset for help on using the changeset viewer.