Changeset 2332
- Timestamp:
- 10/06/11 12:32:49 (13 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STUpgrade.cpp
r2321 r2332 47 47 48 48 std::string STUpgrade::three2four(const std::string& name) { 49 std::string fname = name +".asap4";49 std::string fname = name; 50 50 Table origtab(name); 51 origtab.deepCopy(fname, Table::New);52 Table tab(fname, Table::Update);53 Table moltable = tab.rwKeywordSet().asTable("MOLECULES");54 51 Vector<String> cnames(3); 55 52 cnames[0] = "RESTFREQUENCY"; 56 53 cnames[1] = "NAME"; 57 54 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 } 80 89 return fname; 81 90 } -
trunk/src/Scantable.cpp
r2321 r2332 125 125 << LogIO::POST ; 126 126 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 } 131 133 } 132 134 if ( type_ == Table::Memory ) {
Note:
See TracChangeset
for help on using the changeset viewer.