Changeset 2242


Ignore:
Timestamp:
07/22/11 15:34:15 (13 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...

Added maxRow=1 in table selection using TableExprNode? when
finding at least one row is enough.


Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/FillerBase.cpp

    r2230 r2242  
    193193                    && tab.col("HUMIDITY") == humidity \
    194194                    && tab.col("WINDSPEED") == windspeed \
    195                     && tab.col("WINDAZ") == windaz ) ;
     195                    && tab.col("WINDAZ") == windaz, 1 ) ;
    196196  Int nrow = tab.nrow() ;
    197197  Int nrowSel = subt.nrow() ;
     
    228228                          const Vector<Float>& tcal)
    229229{
    230   uInt id ;
     230  uInt id = 0 ;
    231231  Table tab = table_->tcal().table() ;
    232   Int nrow = tab.nrow() ;
    233   Vector<uInt> rowList( 0 ) ;
    234   ArrayColumn<Float> tcalCol( tab, "TCAL" ) ;
    235   TableColumn timeCol( tab, "TIME" ) ;
    236   TableColumn idCol( tab, "ID" ) ;
    237   uInt nelem = tcal.nelements() ;
    238   for ( Int irow = 0 ; irow < nrow ; irow++ ) {
    239     if ( tcalCol.shape(irow)[0] == nelem ) {
    240       rowList.resize( rowList.nelements()+1, True ) ;
    241       rowList[rowList.nelements()-1] = irow ;
     232  Table result =
     233    //tab( nelements(tab.col("TCAL")) == uInt (tcal.size()) &&
     234    //     all(tab.col("TCAL")== tcal) &&
     235    //     tab.col("TIME") == tcaltime, 1 ) ;
     236    tab( nelements(tab.col("TCAL")) == uInt (tcal.size()) &&
     237         all(tab.col("TCAL")== tcal), 1 ) ;
     238
     239  if ( result.nrow() > 0 ) {
     240    ROTableColumn tmpCol( result, "ID" ) ;
     241    tmpCol.getScalar( 0, id ) ;
     242  }
     243  else {
     244    uInt rno = tab.nrow();
     245    tab.addRow();
     246    TableColumn idCol( tab, "ID" ) ;
     247    TableColumn tctimeCol( tab, "TIME" ) ;
     248    ArrayColumn<Float> tcalCol( tab, "TCAL" ) ;
     249    // get last assigned _id and increment
     250    if ( rno > 0 ) {
     251      idCol.getScalar(rno-1, id);
     252      id++;
    242253    }
    243   }
    244  
    245   //cout << "rowList = " << rowList << endl ;
    246 
    247   if ( rowList.nelements() == 0 ) {
    248     // add new row
    249     tab.addRow( 1 ) ;
    250     //cout << "tab.nrow() = " << tab.nrow() << endl ;
    251     tcalCol.put( nrow, tcal ) ;
    252     timeCol.putScalar( nrow, tcaltime ) ;
    253     id = (uInt)nrow ;
    254     idCol.putScalar( nrow, id ) ;
    255   }
    256   else {
    257     uInt ichan = 0 ;
    258     while ( rowList.nelements() > 1 && ichan < nelem ) {
    259       Vector<uInt> tmp = rowList.copy() ;
    260       rowList.resize( 0 ) ;
    261       for ( uInt irow = 0 ; irow < tmp.nelements() ; irow++ ) {
    262         Vector<Float> t = tcalCol( tmp[irow] ) ;
    263         if ( t[ichan] == tcal[ichan] ) {
    264           rowList.resize( rowList.nelements()+1, True ) ;
    265           rowList[rowList.nelements()-1] = irow ;
    266         }
    267       }
    268       ichan++ ;
    269     }
    270    
    271     //cout << "updated rowList = " << rowList << endl ;
    272 
    273     if ( rowList.nelements() == 0 ) {
    274       // add new row
    275       tab.addRow( 1, True ) ;
    276       //cout << "tab.nrow() = " << tab.nrow() << endl ;
    277       tcalCol.put( nrow, tcal ) ;
    278       timeCol.putScalar( nrow, tcaltime ) ;
    279       id = (uInt)nrow ;
    280       idCol.putScalar( nrow, id ) ;
    281     }
    282     else {
    283       Vector<Float> t = tcalCol( rowList[0] ) ;
    284       if ( allEQ( t, tcal ) ) {
    285         ROTableColumn tc( tab, "ID" ) ;
    286         id = tc.asuInt( rowList[0] ) ;
    287       }
    288       else {
    289         // add new row
    290         tab.addRow( 1, True ) ;
    291         //cout << "tab.nrow() = " << tab.nrow() << endl ;
    292         tcalCol.put( nrow, tcal ) ;
    293         timeCol.putScalar( nrow, tcaltime ) ;
    294         id = (uInt)nrow ;
    295         idCol.putScalar( nrow, id ) ;
    296       }
    297     }
    298   }
    299  
     254    tctimeCol.putScalar(rno, tcaltime);
     255    tcalCol.put(rno, tcal);
     256    idCol.putScalar(rno, id);
     257  }
     258
    300259  RecordFieldPtr<uInt> mcalidCol(row_.record(), "TCAL_ID");
    301260  *mcalidCol = id;
  • trunk/src/STFocus.cpp

    r1587 r2242  
    106106                          && near(table_.col("MOUNT"), mount)
    107107                          && near(table_.col("XYPHASE"), xyphase)
    108                           && near(table_.col("XYPHASEOFFSET"), xyphaseoffset)
     108                          && near(table_.col("XYPHASEOFFSET"), xyphaseoffset), 1
    109109                          );
    110110  uInt resultid = 0;
  • trunk/src/STFrequencies.cpp

    r1819 r2242  
    8888  // test if this already exists
    8989  Table result = table_( near(table_.col("REFVAL"), refval)
    90                     && near(table_.col("REFPIX"), refpix)
    91                     && near(table_.col("INCREMENT"), inc) );
     90                         && near(table_.col("REFPIX"), refpix)
     91                         && near(table_.col("INCREMENT"), inc), 1 );
    9292  uInt resultid = 0;
    9393  if ( result.nrow() > 0) {
  • trunk/src/STMolecules.cpp

    r1819 r2242  
    108108  Table result =
    109109    table_( nelements(table_.col("RESTFREQUENCY")) == uInt (restfreq.size()) &&
    110             all(table_.col("RESTFREQUENCY")== restfreq) );
     110            all(table_.col("RESTFREQUENCY")== restfreq), 1 );
    111111  uInt resultid = 0;
    112112  if ( result.nrow() > 0) {
Note: See TracChangeset for help on using the changeset viewer.