Changeset 2930 for trunk


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

Use weather information as that is provide at MOPRA now

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/scantable.py

    r2926 r2930  
    10981098    def get_weather(self, row=-1):
    10991099        """\
    1100         Return the weather informations.
     1100        Return the weather information.
    11011101
    11021102        Parameters:
     
    11091109
    11101110        """
    1111 
     1111        if row >= len(self):
     1112            raise IndexError("row out of range")
    11121113        values = self._get_column(self._get_weather, row)
    11131114        if row > -1:
     
    11191120            out = []
    11201121            for r in values:
    1121 
    11221122                out.append({'temperature': r[0],
    11231123                            'pressure': r[1], 'humidity' : r[2],
  • 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.