WeatherRecord.h

Go to the documentation of this file.
00001 /*
00002  * WeatherRecord.h
00003  *
00004  *  Created on: Jan 27, 2016
00005  *      Author: nakazato
00006  */
00007 
00008 #ifndef SINGLEDISH_FILLER_WeatherRECORD_H_
00009 #define SINGLEDISH_FILLER_WeatherRECORD_H_
00010 
00011 #include <casacore/casa/BasicSL/String.h>
00012 #include <casacore/measures/Measures/MPosition.h>
00013 #include <casacore/ms/MeasurementSets/MSWeather.h>
00014 #include <casacore/ms/MeasurementSets/MSWeatherColumns.h>
00015 
00016 namespace casa { //# NAMESPACE CASA - BEGIN
00017 namespace sdfiller { //# NAMESPACE SDFILLER - BEGIN
00018 
00019 struct WeatherRecord {
00020   typedef MSWeather AssociatingTable;
00021   typedef MSWeatherColumns AssociatingColumns;
00022 
00023   // mandatory
00024   Int antenna_id;
00025   Double time;
00026   Double interval;
00027 
00028   // optional
00029   Float temperature;
00030   Float pressure;
00031   Float rel_humidity;
00032   Float wind_speed;
00033   Float wind_direction;
00034 
00035   // method
00036   void clear() {
00037     antenna_id = -1;
00038     time = 0.0;
00039     interval = 0.0;
00040     temperature = -1.0;
00041     pressure = -1.0;
00042     rel_humidity = -1.0;
00043     wind_speed = -1.0;
00044     wind_direction = -1.0;
00045   }
00046 
00047   WeatherRecord &operator=(WeatherRecord const &other) {
00048     antenna_id = other.antenna_id;
00049     time = other.time;
00050     interval = other.interval;
00051     temperature = other.temperature;
00052     pressure = other.pressure;
00053     rel_humidity = other.rel_humidity;
00054     wind_speed = other.wind_speed;
00055     wind_direction = other.wind_direction;
00056     return *this;
00057   }
00058 
00059   bool operator==(WeatherRecord const &other) {
00060     return (antenna_id == other.antenna_id)
00061         && (temperature == other.temperature) && (pressure == other.pressure)
00062         && (rel_humidity == other.rel_humidity)
00063         && (wind_speed == other.wind_speed)
00064         && (wind_direction == other.wind_direction);
00065   }
00066 
00067   void add(AssociatingTable &table, AssociatingColumns &/*columns*/) {
00068     table.addRow(1, True);
00069   }
00070 
00071   Bool fill(uInt irow, AssociatingColumns &columns) {
00072     if (columns.nrow() <= irow) {
00073       return False;
00074     }
00075 
00076     columns.antennaId().put(irow, antenna_id);
00077     columns.time().put(irow, time);
00078     columns.interval().put(irow, interval);
00079     columns.temperature().put(irow, temperature);
00080     columns.pressure().put(irow, pressure);
00081     columns.relHumidity().put(irow, rel_humidity);
00082     columns.windSpeed().put(irow, wind_speed);
00083     columns.windDirection().put(irow, wind_direction);
00084 
00085     return True;
00086   }
00087 };
00088 
00089 } //# NAMESPACE SDFILLER - END
00090 } //# NAMESPACE CASA - END
00091 
00092 #endif /* SINGLEDISH_FILLER_WeatherRECORD_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1