Changeset 1285
- Timestamp:
- 09/28/17 11:43:11 (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
r1282 r1285 17 17 , samplingOffset(samplingOffset) 18 18 , 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) 19 , nextSamplingDate(initDate + this->samplingOffset + initDate.getRelCalendar().getTimeStep()) 20 , nextOperationDate(initDate + opFreq + this->samplingOffset) 24 21 , 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)29 22 { 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 }36 23 } 37 24 … … 48 35 { 49 36 usePacket = (data[0]->date >= nextSamplingDate); 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); 37 outputResult = (data[0]->date + samplingFreq > nextOperationDate); 54 38 copyLess = (isInstantOperation && usePacket && outputResult); 55 39 } … … 65 49 } 66 50 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 51 nextSamplingDate = nextSamplingDate + samplingFreq; 81 52 } 82 53 … … 97 68 packet = data[0]; 98 69 70 isFirstOperation = false; 99 71 nextOperationDate = nextOperationDate + samplingFreq + opFreq - samplingFreq; 100 isFirstOperation = false;101 72 } 102 73 } -
XIOS/dev/XIOS_DEV_CMIP6/src/filter/temporal_filter.hpp
r1282 r1285 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 computed62 58 CDate nextSamplingDate; //!< The date of the next sampling 63 59 CDate nextOperationDate; //!< The date of the next operation 64 int nbSamplingDates;60 bool isFirstOperation; //!< True before the first operation was been computed 65 61 }; // class CTemporalFilter 66 62 } // namespace xios
Note: See TracChangeset
for help on using the changeset viewer.