Changeset 1730


Ignore:
Timestamp:
04/28/10 21:44:09 (15 years ago)
Author:
Malte Marquarding
Message:

Ticket #183: added get_weather to scantable. It returns a dicr or list of dicts

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/doc/CHANGELOG

    r1725 r1730  
    44Release 3.0.0 [2010-04-??]
    55
     6* Ticket #183 Added scantable.get_weather
     7* Ticket #181 Added work-around for casacore bug in saving tables with selection
     8* Ticket #178 Added opacity_model based on  miriad's atmospheric model
    69* Ticket #177 Added function skydip to determine opacities.
    710* Ticket #172 Fixed non-working scantable.resample
     
    2124              scantable.get_coordinate
    2225* Added OS X 10.5 Disk image installer
     26* Added support for OS X 10.6
    2327* Interactive plotting annotations via optional argument interactive=True
    2428* Interactive creation of masks on the plotter - plotter.create_mask
  • trunk/python/scantable.py

    r1725 r1730  
    417417        return list(Scantable.get_column_names(self))
    418418
    419     def get_tsys(self):
     419    def get_tsys(self, row=-1):
    420420        """
    421421        Return the System temperatures.
     
    423423            a list of Tsys values for the current selection
    424424        """
    425 
     425        if row > -1:
     426            return self._get_column(self._gettsys, row)
    426427        return self._row_callback(self._gettsys, "Tsys")
     428
     429
     430    def get_weather(self, row=-1):
     431        values = self._get_column(self._get_weather, row)
     432        if row > -1:
     433            return {'temperature': values[0],
     434                    'pressure': values[1], 'humidity' : values[2],
     435                    'windspeed' : values[3], 'windaz' : values[4]
     436                    }
     437        else:
     438            out = []
     439            for r in values:
     440
     441                out.append({'temperature': r[0],
     442                            'pressure': r[1], 'humidity' : r[2],
     443                            'windspeed' : r[3], 'windaz' : r[4]
     444                    })
     445            return out
    427446
    428447    def _row_callback(self, callback, label):
     
    455474            return [callback(i) for i in range(self.nrow())]
    456475        else:
    457             if  0 <= row < self.nrow():
     476            if 0 <= row < self.nrow():
    458477                return callback(row)
    459478
     
    559578        return self._get_column(self._getdirectionvec, row)
    560579
    561 
     580    @print_log_dec
    562581    def set_unit(self, unit='channel'):
    563582        """
  • trunk/src/Scantable.cpp

    r1728 r1730  
    279279  rbeamCol_.attach(table_, "REFBEAMNO");
    280280
     281  mweatheridCol_.attach(table_,"WEATHER_ID");
    281282  mfitidCol_.attach(table_,"FIT_ID");
    282283  mfreqidCol_.attach(table_, "FREQ_ID");
     
    434435    Table tab = table_.copyToMemoryTable(generateName());
    435436    tab.deepCopy(inname, Table::New);
     437    tab.markForDelete();
     438
    436439  } else {
    437440    table_.deepCopy(inname, Table::New);
     
    10561059}
    10571060
    1058 std::string asap::Scantable::getAntennaName() const
     1061std::string Scantable::getAntennaName() const
    10591062{
    10601063  String out;
     
    10631066}
    10641067
    1065 int asap::Scantable::checkScanInfo(const std::vector<int>& scanlist) const
     1068int Scantable::checkScanInfo(const std::vector<int>& scanlist) const
    10661069{
    10671070  String tbpath;
     
    11311134}
    11321135
    1133 std::vector<double>  asap::Scantable::getDirectionVector(int whichrow) const
     1136std::vector<double> Scantable::getDirectionVector(int whichrow) const
    11341137{
    11351138  Vector<Double> Dir = dirCol_(whichrow).getAngle("rad").getValue();
     
    11391142}
    11401143
     1144std::vector<float> Scantable::getWeather(int whichrow) const
     1145{
     1146  std::vector<float> out(5);
     1147  //Float temperature, pressure, humidity, windspeed, windaz;
     1148  weatherTable_.getEntry(out[0], out[1], out[2], out[3], out[4],
     1149                         mweatheridCol_(uInt(whichrow)));
     1150
     1151
     1152  return out;
     1153}
     1154
    11411155}
    11421156 //namespace asap
  • trunk/src/Scantable.h

    r1727 r1730  
    348348  std::vector<double> getAbcissa(int whichrow) const;
    349349
     350  std::vector<float> getWeather(int whichrow) const;
     351
    350352  std::string getAbcissaLabel(int whichrow) const;
    351353  std::vector<double> getRestFrequencies() const
  • trunk/src/ScantableWrapper.h

    r1598 r1730  
    210210    { return table_->checkScanInfo(scanlist); }
    211211
    212   std::vector<double>  getDirectionVector(int whichrow) const
     212  std::vector<double> getDirectionVector(int whichrow) const
    213213    { return table_->getDirectionVector(whichrow); }
    214214
     
    219219    return STCoordinate(table_->getSpectralCoordinate(row));
    220220  }
     221
     222  std::vector<float> getWeather(int whichrow) const
     223    { return table_->getWeather(whichrow); }
    221224
    222225private:
  • trunk/src/python_Scantable.cpp

    r1598 r1730  
    126126    .def("_parallactify", &ScantableWrapper::parallactify)
    127127    .def("get_coordinate", &ScantableWrapper::getCoordinate)
     128    .def("_get_weather", &ScantableWrapper::getWeather)
    128129  ;
    129130};
Note: See TracChangeset for help on using the changeset viewer.