Changeset 2930 for trunk/src


Ignore:
Timestamp:
04/17/14 11:35:34 (10 years ago)
Author:
Malte Marquarding
Message:

Use weather information as that is provide at MOPRA now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STWeather.cpp

    r2243 r2930  
    8585  /// @todo this is a zero implementation as none of the telescopes
    8686  /// fills in this information (yet)
    87   uInt nrow = table_.nrow();
    88   if ( nrow == 0 ) {
     87// test if this already exists
     88  Table result = table_( near(table_.col("TEMPERATURE"), temp)
     89                         && near(table_.col("PRESSURE"), pressure)
     90                         && near(table_.col("WINDSPEED"), wspeed)
     91                         && near(table_.col("WINDAZ"), waz)
     92                         && near(table_.col("HUMIDITY"), humidity), 1 );
     93  uInt resultid = 0;
     94  if ( result.nrow() > 0) {
     95    ROScalarColumn<uInt> c(result, "ID");
     96    c.get(0, resultid);
     97  } else {
     98    uInt rno = table_.nrow();
    8999    table_.addRow();
    90     TableRow row(table_);
    91     TableRecord& rec = row.record();
    92     RecordFieldPtr< Float > rfp;
    93     rfp.attachToRecord(rec,"TEMPERATURE");
    94     *rfp = temp;
    95     rfp.attachToRecord(rec,"PRESSURE");
    96     *rfp = pressure;
    97     rfp.attachToRecord(rec,"HUMIDITY");
    98     *rfp = humidity;
    99     rfp.attachToRecord(rec,"WINDSPEED");
    100     *rfp = wspeed;
    101     rfp.attachToRecord(rec,"WINDAZ");
    102     *rfp = waz;
    103     row.put(table_.nrow()-1, rec);
     100    // get last assigned freq_id and increment
     101    if ( rno > 0 ) {
     102      idCol_.get(rno-1, resultid);
     103      resultid++;
     104    }
     105    temperatureCol_.put(rno, temp);
     106    pressureCol_.put(rno, pressure);
     107    windspeedCol_.put(rno, wspeed);
     108    windazCol_.put(rno, waz);
     109    humidityCol_.put(rno, humidity);
     110    idCol_.put(rno, resultid);
    104111  }
    105   return 0;
     112  return resultid;
    106113}
    107114
Note: See TracChangeset for help on using the changeset viewer.