- Timestamp:
- 04/17/14 11:35:34 (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/scantable.py
r2926 r2930 1098 1098 def get_weather(self, row=-1): 1099 1099 """\ 1100 Return the weather information s.1100 Return the weather information. 1101 1101 1102 1102 Parameters: … … 1109 1109 1110 1110 """ 1111 1111 if row >= len(self): 1112 raise IndexError("row out of range") 1112 1113 values = self._get_column(self._get_weather, row) 1113 1114 if row > -1: … … 1119 1120 out = [] 1120 1121 for r in values: 1121 1122 1122 out.append({'temperature': r[0], 1123 1123 'pressure': r[1], 'humidity' : r[2], -
trunk/src/STWeather.cpp
r2243 r2930 85 85 /// @todo this is a zero implementation as none of the telescopes 86 86 /// 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(); 89 99 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); 104 111 } 105 return 0;112 return resultid; 106 113 } 107 114
Note:
See TracChangeset
for help on using the changeset viewer.