- Timestamp:
- 02/28/13 18:58:29 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/MSFiller.cpp
r2754 r2775 272 272 dataColumnName = "FLOAT_DATA" ; 273 273 getpt = False ; 274 isWeather = False ;274 isWeather_ = False ; 275 275 isSysCal = False ; 276 276 isTcal = False ; … … 532 532 // WEATHER_ID 533 533 uInt wid = 0 ; 534 if ( isWeather )534 if ( isWeather_ ) 535 535 wid = getWeatherId() ; 536 536 … … 685 685 initConvert() ; 686 686 } 687 void setWeatherTime( const Vector<Double> &t, const Vector<Double> &it ) 688 { 689 isWeather = True ; 690 weatherTime = t ; 691 weatherInterval = it ; 687 void setWeatherTime( const Vector<Double> &t, const Vector<Double> &it, 688 const Vector<uInt> &idx ) 689 { 690 isWeather_ = True ; 691 weatherTime_ = t ; 692 weatherInterval_ = it ; 693 weatherIndex_ = idx; 692 694 } 693 695 void setSysCalRecord( const Record &r ) … … 1153 1155 { 1154 1156 // if only one row, return 0 1155 if ( weatherTime .nelements() == 1 )1157 if ( weatherTime_.nelements() == 1 ) 1156 1158 return 0 ; 1157 1159 … … 1159 1161 // if this is bottleneck, frequency of binary search must be reduced 1160 1162 Double t = currentTime.get( "s" ).getValue() ; 1161 uInt idx = min( binarySearch( weatherTime , t ), weatherTime.nelements()-1 ) ;1162 if ( weatherTime [idx] < t ) {1163 if ( idx != weatherTime .nelements()-1 ) {1164 if ( weatherTime [idx+1] - t < 0.5 * weatherInterval[idx+1] )1163 uInt idx = min( binarySearch( weatherTime_, t ), weatherTime_.nelements()-1 ) ; 1164 if ( weatherTime_[idx] < t ) { 1165 if ( idx != weatherTime_.nelements()-1 ) { 1166 if ( weatherTime_[idx+1] - t < 0.5 * weatherInterval_[idx+1] ) 1165 1167 idx++ ; 1166 1168 } 1167 1169 } 1168 else if ( weatherTime [idx] > t ) {1170 else if ( weatherTime_[idx] > t ) { 1169 1171 if ( idx != 0 ) { 1170 if ( weatherTime [idx] - t > 0.5 * weatherInterval[idx] )1172 if ( weatherTime_[idx] - t > 0.5 * weatherInterval_[idx] ) 1171 1173 idx-- ; 1172 1174 } 1173 1175 } 1174 return idx;1176 return weatherIndex_[idx] ; 1175 1177 } 1176 1178 void processSysCal( Int &spwId ) … … 1305 1307 Cube<Double> pointingDirection; 1306 1308 MDirection::Types dirType; 1307 Bool isWeather; 1308 Vector<Double> weatherTime; 1309 Vector<Double> weatherInterval; 1309 Bool isWeather_; 1310 Vector<Double> weatherTime_; 1311 Vector<Double> weatherInterval_; 1312 Vector<uInt> weatherIndex_; 1310 1313 Bool isSysCal; 1311 1314 Bool isTcal; … … 1804 1807 } 1805 1808 if ( isWeather_ ) 1806 myVisitor.setWeatherTime( mwTime_, mwInterval_ ) ;1809 myVisitor.setWeatherTime( mwTime_, mwInterval_, mwIndex_ ) ; 1807 1810 if ( isSysCal_ ) 1808 1811 myVisitor.setSysCalRecord( tcalrec_ ) ; … … 2008 2011 } 2009 2012 //os_ << "mwTime[0] = " << mwTime_[0] << " mwInterval[0] = " << mwInterval_[0] << LogIO::POST ; 2013 //os_ << "mwIndex_=" << mwIndex_ << LogIO::POST; 2010 2014 //double endSec = mathutil::gettimeofday_sec() ; 2011 2015 //os_ << "end MSFiller::fillWeather() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
Note:
See TracChangeset
for help on using the changeset viewer.