Changeset 2332 for trunk/src


Ignore:
Timestamp:
10/06/11 12:32:49 (13 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: No

Ready for Test: No

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

###THIS SHOULD NOT BE INCLUDED RELEASE 3.3###
Take care of the data that the version number is 3 while the definition
of MOLECULE table is along version 4. For such data, just increment
version number.


Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STUpgrade.cpp

    r2321 r2332  
    4747
    4848std::string STUpgrade::three2four(const std::string& name) {
    49   std::string fname = name+".asap4";
     49  std::string fname = name;
    5050  Table origtab(name);
    51   origtab.deepCopy(fname, Table::New);
    52   Table tab(fname, Table::Update);
    53   Table moltable = tab.rwKeywordSet().asTable("MOLECULES");
    5451  Vector<String> cnames(3);
    5552  cnames[0] = "RESTFREQUENCY";
    5653  cnames[1] = "NAME";
    5754  cnames[2] = "FORMATTEDNAME";
    58   ROScalarColumn<Double> rfcol(moltable, cnames[0]);
    59   ROScalarColumn<String> nmecol(moltable,  cnames[1]);
    60   ROScalarColumn<String> fmtnmecol(moltable, cnames[2]);
    61   Vector<Double> rf = rfcol.getColumn();
    62   Vector<String> nme = nmecol.getColumn();
    63   Vector<String> fmtnme = fmtnmecol.getColumn();
    64   Array<Double> arf = rf.addDegenerate(1);
    65   Array<String> anme = nme.addDegenerate(1);
    66   Array<String> afmtnme = fmtnme.addDegenerate(1);
    67   moltable.removeColumn(cnames);
    68   moltable.addColumn(ArrayColumnDesc<Double>(cnames[0]));
    69   moltable.addColumn(ArrayColumnDesc<String>(cnames[1]));
    70   moltable.addColumn(ArrayColumnDesc<String>(cnames[2]));
    71   ArrayColumn<Double> arfcol(moltable, cnames[0]);
    72   ArrayColumn<String> anmecol(moltable, cnames[1]);
    73   ArrayColumn<String> afmtnmecol(moltable, cnames[2] );
    74   arfcol.putColumn(arf);
    75   anmecol.putColumn(anme);
    76   afmtnmecol.putColumn(afmtnme);
    77 
    78   Int verid = tab.rwKeywordSet().fieldNumber("VERSION");
    79   tab.rwKeywordSet().define(verid, uInt(4));
     55  Table origmoltab = origtab.rwKeywordSet().asTable("MOLECULES");
     56  const ColumnDesc &desc = (origmoltab.tableDesc().columnDescSet())[cnames[0]];
     57  Bool isScalar = desc.isScalar() ;
     58  if ( isScalar ) {
     59    fname += ".asap4";
     60    origtab.deepCopy(fname, Table::New);
     61    Table tab(fname, Table::Update);
     62    Table moltable = tab.rwKeywordSet().asTable("MOLECULES");
     63    ROScalarColumn<Double> rfcol(moltable, cnames[0]);
     64    ROScalarColumn<String> nmecol(moltable,  cnames[1]);
     65    ROScalarColumn<String> fmtnmecol(moltable, cnames[2]);
     66    Vector<Double> rf = rfcol.getColumn();
     67    Vector<String> nme = nmecol.getColumn();
     68    Vector<String> fmtnme = fmtnmecol.getColumn();
     69    Array<Double> arf = rf.addDegenerate(1);
     70    Array<String> anme = nme.addDegenerate(1);
     71    Array<String> afmtnme = fmtnme.addDegenerate(1);
     72    moltable.removeColumn(cnames);
     73    moltable.addColumn(ArrayColumnDesc<Double>(cnames[0]));
     74    moltable.addColumn(ArrayColumnDesc<String>(cnames[1]));
     75    moltable.addColumn(ArrayColumnDesc<String>(cnames[2]));
     76    ArrayColumn<Double> arfcol(moltable, cnames[0]);
     77    ArrayColumn<String> anmecol(moltable, cnames[1]);
     78    ArrayColumn<String> afmtnmecol(moltable, cnames[2] );
     79    arfcol.putColumn(arf);
     80    anmecol.putColumn(anme);
     81    afmtnmecol.putColumn(afmtnme);
     82    Int verid = tab.rwKeywordSet().fieldNumber("VERSION");
     83    tab.rwKeywordSet().define(verid, uInt(4));
     84  }
     85  else {
     86    Int verid = origtab.rwKeywordSet().fieldNumber("VERSION");
     87    origtab.rwKeywordSet().define(verid, uInt(4));
     88  }
    8089  return fname;
    8190}
  • trunk/src/Scantable.cpp

    r2321 r2332  
    125125         << LogIO::POST ; 
    126126      std::string outname = upgrader.upgrade(name);
    127       os << LogIO::WARN
    128          << "Data will be loaded from " << outname << " instead of "
    129          << name << LogIO::POST ;
    130       tab = Table(outname, Table::Update ) ;
     127      if ( outname != name ) {
     128        os << LogIO::WARN
     129           << "Data will be loaded from " << outname << " instead of "
     130           << name << LogIO::POST ;
     131        tab = Table(outname, Table::Update ) ;
     132      }
    131133  }
    132134  if ( type_ == Table::Memory ) {
Note: See TracChangeset for help on using the changeset viewer.