Changeset 2321 for trunk


Ignore:
Timestamp:
10/04/11 14:15:54 (13 years ago)
Author:
Malte Marquarding
Message:

Ticket #249: scantbable schema was changed. This required an update to scantable version 4. I have added a class STUpgrade to handle all schema upgrades. This is handled transparently in the scantable constructor

Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/SConstruct

    r2179 r2321  
    196196    env = conf.Finish()
    197197
    198 env["version"] = "3.1.x"
     198env["version"] = "4.0.x"
    199199
    200200if env['mode'] == 'release':
     
    270270        env.Command("No data tables available. Use 'asap_update_data' after install",
    271271                    '', env.MessageAction)
    272     arch = env.Archiver(os.path.join("dist",
    273                                      env["stagedir"]+"_"+env["makedist"]),
    274                         env["stagedir"])
     272#    arch = env.Archiver(os.path.join("dist",
     273#                                    env["stagedir"]+"_"+env["makedist"]),
     274#                        env["stagedir"])
    275275#    env.AddPostAction(arch, Delete("$stagedir"))
    276276
  • trunk/src/CMakeLists.txt

    r2289 r2321  
    5757     ${SRCDIR}/MSWriter.cpp
    5858     ${SRCDIR}/AsapLogSink.cpp
     59     ${SRCDIR}/STUpgrade.cpp
    5960     ${SRCDIR}/Templates.cpp )
    6061
  • trunk/src/STMolecules.h

    r1819 r2321  
    4444***/
    4545
    46   casa::uInt addEntry( casa::Vector<casa::Double> restfreq, const casa::Vector<casa::String>& name=casa::Vector<casa::String>(0),
     46  casa::uInt addEntry( casa::Vector<casa::Double> restfreq,
     47                       const casa::Vector<casa::String>& name=casa::Vector<casa::String>(0),
    4748                       const casa::Vector<casa::String>& formattedname=casa::Vector<casa::String>(0));
    4849
     
    5152                 casa::String& formattedname, casa::uInt id) const;
    5253***/
    53   void getEntry( casa::Vector<casa::Double>& restfreq, casa::Vector<casa::String>& name,
    54                  casa::Vector<casa::String>& formattedname, casa::uInt id) const;
     54  void getEntry( casa::Vector<casa::Double>& restfreq,
     55                 casa::Vector<casa::String>& name,
     56                 casa::Vector<casa::String>& formattedname,
     57                 casa::uInt id) const;
    5558
    5659  std::vector<double> getRestFrequencies() const;
  • trunk/src/Scantable.cpp

    r2290 r2321  
    6868#include "STPolLinear.h"
    6969#include "STPolStokes.h"
     70#include "STUpgrade.h"
    7071#include "Scantable.h"
    7172
     
    116117  uInt version = tab.keywordSet().asuInt("VERSION");
    117118  if (version != version_) {
    118     if ( version == 2 && version_ == 3 ) {
    119       // run asap2to3 command
     119      STUpgrade upgrader(version_);
    120120      LogIO os( LogOrigin( "Scantable" ) ) ;
    121       string command="asap2to3" ;
    122       string exec=command+" in="+name ;
    123       string outname=name ;
    124       if ( name.at(name.length()-1) == '/' )
    125         outname = outname.substr( 0, name.length()-1 ) ;
    126       outname += ".asap3" ;
    127121      os << LogIO::WARN
    128          << name << " is incompatible data format (Scantable v2)." << endl
    129          << "Running " << command << " to create " << outname << ", " << endl 
    130          << "which is identical to " << name << " but compatible " << endl
    131          << "data format with current software version (Scantable v3)."
     122         << name << " data format version " << version
     123         << " is deprecated" << endl
     124         << "Running upgrade."<< endl 
    132125         << LogIO::POST ; 
    133       int ret = system( string("which "+command+" > /dev/null 2>&1").c_str() ) ;
    134       if ( ret != 0 )
    135         throw(AipsError(command+" is not installed")) ;
     126      std::string outname = upgrader.upgrade(name);
    136127      os << LogIO::WARN
    137128         << "Data will be loaded from " << outname << " instead of "
    138129         << name << LogIO::POST ;
    139       int tmp = system( exec.c_str() ) ;
    140       (void) tmp;
    141130      tab = Table(outname, Table::Update ) ;
    142       //os << "tab.tableName()=" << tab.tableName() << LogIO::POST ;
    143     }
    144     else {
    145       throw(AipsError("Unsupported version of ASAP file."));
    146     }
    147131  }
    148132  if ( type_ == Table::Memory ) {
  • trunk/src/Scantable.h

    r2290 r2321  
    8686
    8787  /**
    88    * Create a Scantable object form an existing table on disk
     88   * Create a Scantable object from an existing table on disk
    8989   * @param[in] name the name of the existing Scantable
    9090   */
    91   explicit Scantable(const std::string& name, casa::Table::TableType ttype = casa::Table::Memory);
     91  explicit Scantable(const std::string& name,
     92                     casa::Table::TableType ttype = casa::Table::Memory);
    9293
    9394  /// @fixme this is only sensible for MemoryTables....
     
    638639  std::vector<uint> getNumbers(const casa::ScalarColumn<casa::uInt>& col) const;
    639640
    640   static const casa::uInt version_ = 3;
     641  static const casa::uInt version_ = 4;
    641642
    642643  STSelector selector_;
Note: See TracChangeset for help on using the changeset viewer.