- Timestamp:
- 07/19/11 12:48:26 (13 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/MSFiller.cpp
r2232 r2234 853 853 854 854 // WEATHER_ID 855 if ( isWeather_ ) 855 if ( isWeather_ ) { 856 856 wid = getWeatherId( wid, mTimeB[irow].get("s").getValue() ) ; 857 *widRF = wid ; 857 *widRF = mwIndex_[wid] ; 858 } 859 else { 860 *widRF = wid ; 861 } 858 862 859 863 … … 1314 1318 wtab.addRow( wnrow ) ; 1315 1319 1320 Bool stationInfoExists = mWeatherSel.tableDesc().isColumn( "NS_WX_STATION_ID" ) ; 1321 Int stationId = -1 ; 1322 if ( stationInfoExists ) { 1323 // determine which station is closer 1324 ROScalarColumn<Int> stationCol( mWeatherSel, "NS_WX_STATION_ID" ) ; 1325 ROArrayColumn<Double> stationPosCol( mWeatherSel, "NS_WX_STATION_POSITION" ) ; 1326 Vector<Int> stationIds = stationCol.getColumn() ; 1327 Vector<Int> stationIdList( 0 ) ; 1328 Matrix<Double> stationPosList( 0, 3, 0.0 ) ; 1329 uInt numStation = 0 ; 1330 for ( uInt i = 0 ; i < stationIds.size() ; i++ ) { 1331 if ( !anyEQ( stationIdList, stationIds[i] ) ) { 1332 numStation++ ; 1333 stationIdList.resize( numStation, True ) ; 1334 stationIdList[numStation-1] = stationIds[i] ; 1335 stationPosList.resize( numStation, 3, True ) ; 1336 stationPosList.row( numStation-1 ) = stationPosCol( i ) ; 1337 } 1338 } 1339 //os_ << "staionIdList = " << stationIdList << endl ; 1340 Table mAntenna = mstable_.antenna() ; 1341 ROArrayColumn<Double> antposCol( mAntenna, "POSITION" ) ; 1342 Vector<Double> antpos = antposCol( antenna_ ) ; 1343 Double minDiff = -1.0 ; 1344 for ( uInt i = 0 ; i < stationIdList.size() ; i++ ) { 1345 Double diff = sum( square( antpos - stationPosList.row( i ) ) ) ; 1346 if ( minDiff < 0.0 || minDiff > diff ) { 1347 minDiff = diff ; 1348 stationId = stationIdList[i] ; 1349 } 1350 } 1351 } 1352 //os_ << "stationId = " << stationId << endl ; 1353 1316 1354 ScalarColumn<Float> *fCol ; 1317 1355 ROScalarColumn<Float> *sharedFloatCol ; … … 1358 1396 ROScalarColumn<Double> tCol( mWeatherSel, "TIME" ) ; 1359 1397 String tUnit = tqCol.getUnits() ; 1360 mwTime_= tCol.getColumn() ;1398 Vector<Double> mwTime = tCol.getColumn() ; 1361 1399 if ( tUnit == "d" ) 1362 mwTime _*= 86400.0 ;1400 mwTime *= 86400.0 ; 1363 1401 tqCol.attach( mWeatherSel, "INTERVAL" ) ; 1364 1402 tCol.attach( mWeatherSel, "INTERVAL" ) ; 1365 1403 String iUnit = tqCol.getUnits() ; 1366 mwInterval_= tCol.getColumn() ;1404 Vector<Double> mwInterval = tCol.getColumn() ; 1367 1405 if ( iUnit == "d" ) 1368 mwInterval_ *= 86400.0 ; 1406 mwInterval *= 86400.0 ; 1407 1408 if ( stationId > 0 ) { 1409 ROScalarColumn<Int> stationCol( mWeatherSel, "NS_WX_STATION_ID" ) ; 1410 Vector<Int> stationVec = stationCol.getColumn() ; 1411 uInt wsnrow = ntrue( stationVec == stationId ) ; 1412 mwTime_.resize( wsnrow ) ; 1413 mwInterval_.resize( wsnrow ) ; 1414 mwIndex_.resize( wsnrow ) ; 1415 uInt wsidx = 0 ; 1416 for ( uInt irow = 0 ; irow < wnrow ; irow++ ) { 1417 if ( stationId == stationVec[irow] ) { 1418 mwTime_[wsidx] = mwTime[irow] ; 1419 mwInterval_[wsidx] = mwInterval[irow] ; 1420 mwIndex_[wsidx] = irow ; 1421 wsidx++ ; 1422 } 1423 } 1424 } 1425 else { 1426 mwTime_ = mwTime ; 1427 mwInterval_ = mwInterval ; 1428 mwIndex_.resize( mwTime_.size() ) ; 1429 indgen( mwIndex_ ) ; 1430 } 1369 1431 //os_ << "mwTime[0] = " << mwTime_[0] << " mwInterval[0] = " << mwInterval_[0] << LogIO::POST ; 1370 1432 // double endSec = gettimeofday_sec() ; … … 1505 1567 return 0 ; 1506 1568 uInt wid = nrow ; 1569 if ( idx == 0 ) { 1570 wid = 0 ; 1571 Double tStart = mwTime_[wid]-0.5*mwInterval_[wid] ; 1572 if ( wtime < tStart ) 1573 return wid ; 1574 } 1507 1575 for ( uInt i = idx ; i < nrow-1 ; i++ ) { 1508 1576 Double tStart = mwTime_[i]-0.5*mwInterval_[i] ; -
trunk/src/MSFiller.h
r2217 r2234 129 129 casa::Vector<casa::Double> mwTime_ ; 130 130 casa::Vector<casa::Double> mwInterval_ ; 131 casa::Vector<casa::uInt> mwIndex_ ; 131 132 132 133 // Record for TCAL_ID
Note:
See TracChangeset
for help on using the changeset viewer.