Ignore:
Timestamp:
11/30/15 16:21:33 (8 years ago)
Author:
rlacroix
Message:

Add a new file attribute time_counter_name.

Users can now modify the name of the time counter dimension and axis name.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/io/nc4_data_output.cpp

    r796 r802  
    2222            , filename(filename) 
    2323      { 
    24          StdString timeid = StdString("time_counter"); 
    2524         SuperClass::type = MULTI_FILE; 
    2625      } 
     
    2827      CNc4DataOutput::CNc4DataOutput 
    2928         (const StdString & filename, bool exist, bool useClassicFormat, 
    30           MPI_Comm comm_file,bool multifile, bool isCollective) 
     29          MPI_Comm comm_file,bool multifile, bool isCollective, const StdString& timeCounterName) 
    3130            : SuperClass() 
    32             , SuperClassWriter(filename, exist, useClassicFormat, &comm_file, multifile) 
     31            , SuperClassWriter(filename, exist, useClassicFormat, &comm_file, multifile, timeCounterName) 
    3332            , comm_file(comm_file) 
    3433            , filename(filename) 
    3534            , isCollective(isCollective) 
    3635      { 
    37          StdString timeid = StdString("time_counter"); 
    38  
    3936         SuperClass::type = (multifile) ? MULTI_FILE : ONE_FILE; 
    4037      } 
     
    952949       try 
    953950       { 
    954         SuperClassWriter::addDimension("time_counter"); 
     951        SuperClassWriter::addDimension(getTimeCounterName()); 
    955952       } 
    956953       catch (CNetCdfException& e) 
     
    982979         std::vector<StdString> axisList   = grid->getAxisList(); 
    983980 
    984          StdString timeid  = StdString("time_counter"); 
     981         StdString timeid  = getTimeCounterName(); 
    985982         StdString dimXid,dimYid; 
    986983         std::deque<StdString> dimIdList, dimCoordList; 
     
    13911388        else if (field->getOperationTimeType() == func::CFunctor::centered) timeAxisId = "time_centered"; 
    13921389 
    1393         StdString timeBoundId("time_counter_bounds"); 
     1390        StdString timeBoundId = getTimeCounterName() + "_bounds"; 
    13941391 
    13951392        StdString timeAxisBoundId; 
     
    14921489                   if (field->file->time_counter != CFile::time_counter_attr::none) 
    14931490                   { 
    1494                      SuperClassWriter::writeData(time_counter, string("time_counter"), isCollective, field->getNStep() - 1); 
     1491                     SuperClassWriter::writeData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1); 
    14951492                     if (field->file->time_counter != CFile::time_counter_attr::record) 
    14961493                       SuperClassWriter::writeData(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1); 
     
    16191616                   if (field->file->time_counter != CFile::time_counter_attr::none) 
    16201617                   { 
    1621                      SuperClassWriter::writeTimeAxisData(time_counter, string("time_counter"), isCollective, field->getNStep() - 1, isRoot); 
     1618                     SuperClassWriter::writeTimeAxisData(time_counter, getTimeCounterName(), isCollective, field->getNStep() - 1, isRoot); 
    16221619                     if (field->file->time_counter != CFile::time_counter_attr::record) 
    16231620                       SuperClassWriter::writeTimeAxisData(time_counter_bound, timeBoundId, isCollective, field->getNStep() - 1, isRoot); 
     
    16591656         StdString axisid("time_centered") ; 
    16601657         StdString axisBoundId("time_centered_bounds"); 
    1661          StdString timeid("time_counter"); 
     1658         StdString timeid(getTimeCounterName()); 
    16621659         StdString timeBoundId("axis_nbounds"); 
    16631660 
     
    17011698           { 
    17021699             // Adding time_counter 
    1703              axisid = "time_counter"; 
    1704              axisBoundId = "time_counter_bounds"; 
     1700             axisid = getTimeCounterName(); 
     1701             axisBoundId = getTimeCounterName() + "_bounds"; 
    17051702             dims.clear(); 
    17061703             dims.push_back(timeid); 
     
    19551952        if (it == timeToRecordCache.end()) 
    19561953        { 
    1957           StdString timeAxisBoundsId("time_counter_bounds"); 
     1954          StdString timeAxisBoundsId(getTimeCounterName() + "_bounds"); 
    19581955          if (!SuperClassWriter::varExist(timeAxisBoundsId)) 
    19591956            timeAxisBoundsId = "time_instant_bounds"; 
Note: See TracChangeset for help on using the changeset viewer.