Changeset 2775 for trunk/src


Ignore:
Timestamp:
02/28/13 18:58:29 (12 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

Bug fix on indexing of WEATHER_ID when more than one weather station
is included in input MS.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MSFiller.cpp

    r2754 r2775  
    272272      dataColumnName = "FLOAT_DATA" ;
    273273    getpt = False ;
    274     isWeather = False ;
     274    isWeather_ = False ;
    275275    isSysCal = False ;
    276276    isTcal = False ;
     
    532532    // WEATHER_ID
    533533    uInt wid = 0 ;
    534     if ( isWeather )
     534    if ( isWeather_ )
    535535      wid = getWeatherId() ;
    536536
     
    685685    initConvert() ;
    686686  }
    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;
    692694  }
    693695  void setSysCalRecord( const Record &r )
     
    11531155  {
    11541156    // if only one row, return 0
    1155     if ( weatherTime.nelements() == 1 )
     1157    if ( weatherTime_.nelements() == 1 )
    11561158      return 0 ;
    11571159
     
    11591161    //       if this is bottleneck, frequency of binary search must be reduced
    11601162    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] )
    11651167          idx++ ;
    11661168      }
    11671169    }
    1168     else if ( weatherTime[idx] > t ) {
     1170    else if ( weatherTime_[idx] > t ) {
    11691171      if ( idx != 0 ) {
    1170         if ( weatherTime[idx] - t > 0.5 * weatherInterval[idx] )
     1172        if ( weatherTime_[idx] - t > 0.5 * weatherInterval_[idx] )
    11711173          idx-- ;
    11721174      }
    11731175    }
    1174     return idx ;
     1176    return weatherIndex_[idx] ;
    11751177  }
    11761178  void processSysCal( Int &spwId )
     
    13051307  Cube<Double> pointingDirection;
    13061308  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_;
    13101313  Bool isSysCal;
    13111314  Bool isTcal;
     
    18041807    }
    18051808    if ( isWeather_ )
    1806       myVisitor.setWeatherTime( mwTime_, mwInterval_ ) ;
     1809      myVisitor.setWeatherTime( mwTime_, mwInterval_, mwIndex_ ) ;
    18071810    if ( isSysCal_ )
    18081811      myVisitor.setSysCalRecord( tcalrec_ ) ;
     
    20082011  }
    20092012  //os_ << "mwTime[0] = " << mwTime_[0] << " mwInterval[0] = " << mwInterval_[0] << LogIO::POST ;
     2013  //os_ << "mwIndex_=" << mwIndex_ << LogIO::POST;
    20102014  //double endSec = mathutil::gettimeofday_sec() ;
    20112015  //os_ << "end MSFiller::fillWeather() endSec=" << endSec << " (" << endSec-startSec << "sec)" << LogIO::POST ;
Note: See TracChangeset for help on using the changeset viewer.