Changeset 1282
- Timestamp:
- 09/26/17 17:41:03 (7 years ago)
- Location:
- XIOS/dev/XIOS_DEV_CMIP6/src/filter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/XIOS_DEV_CMIP6/src/filter/temporal_filter.cpp
r1278 r1282 17 17 , samplingOffset(samplingOffset) 18 18 , opFreq(opFreq) 19 , nextSamplingDate(initDate + this->samplingOffset + initDate.getRelCalendar().getTimeStep()) 20 , nextOperationDate(initDate + this->samplingOffset + 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) 21 24 , isFirstOperation(true) 25 , nextSamplingDate(initDate + initDate.getRelCalendar().getTimeStep() + this->samplingOffset) 26 , nextOperationDate(initDate + opFreq + this->samplingOffset) 27 // , nextOperationDate(initDate + opFreq + this->offsetMonth + this->offsetAllButMonth) 28 , nbSamplingDates(0) 22 29 { 30 if (offsetMonth != NoneDu && offsetAllButMonth != NoneDu) 31 { 32 nextOperationDate = initDate + opFreq + this->offsetMonth; 33 // nextSamplingDate = initDate + initDate.getRelCalendar().getTimeStep() + this->samplingOffset; 34 nextSamplingDate = initDate + this->offsetMonth + this->offsetAllButMonth; 35 } 23 36 } 24 37 … … 35 48 { 36 49 usePacket = (data[0]->date >= nextSamplingDate); 37 outputResult = (data[0]->date + samplingFreq > nextOperationDate); 50 outputResult = ((offsetMonth != NoneDu && offsetAllButMonth != NoneDu) 51 ? (data[0]->date - offsetAllButMonth > nextOperationDate - samplingFreq) 52 : (data[0]->date + samplingFreq > nextOperationDate)); 53 // outputResult = (data[0]->date > nextOperationDate - samplingFreq); 38 54 copyLess = (isInstantOperation && usePacket && outputResult); 39 55 } … … 49 65 } 50 66 51 nextSamplingDate = nextSamplingDate + samplingFreq; 67 if (offsetMonth != NoneDu && offsetAllButMonth != NoneDu) 68 { 69 nextSamplingDate = initDate + samplingFreq; 70 for (int i=0; i<(nbSamplingDates+1); i++) 71 { 72 nextSamplingDate = nextSamplingDate + samplingFreq; 73 } 74 nextSamplingDate = nextSamplingDate + offsetAllButMonth; 75 } 76 else 77 nextSamplingDate = nextSamplingDate + samplingFreq; 78 79 nbSamplingDates++; 80 52 81 } 53 82 … … 68 97 packet = data[0]; 69 98 99 nextOperationDate = nextOperationDate + samplingFreq + opFreq - samplingFreq; 70 100 isFirstOperation = false; 71 nextOperationDate = nextOperationDate + samplingFreq + opFreq - samplingFreq;72 101 } 73 102 } -
XIOS/dev/XIOS_DEV_CMIP6/src/filter/temporal_filter.hpp
r1201 r1282 56 56 const CDuration samplingOffset; //!< The sampling offset, i.e. the offset after which the input data will be used 57 57 const CDuration opFreq; //!< The operation frequency, i.e. the frequency at which the output data will be computed 58 const CDuration offsetMonth; 59 const CDuration offsetAllButMonth; 60 const CDate initDate; 61 bool isFirstOperation; //!< True before the first operation was been computed 58 62 CDate nextSamplingDate; //!< The date of the next sampling 59 63 CDate nextOperationDate; //!< The date of the next operation 60 bool isFirstOperation; //!< True before the first operation was been computed64 int nbSamplingDates; 61 65 }; // class CTemporalFilter 62 66 } // namespace xios
Note: See TracChangeset
for help on using the changeset viewer.