Changeset 990 for XIOS/trunk/src/io/nc4_data_output.cpp
- Timestamp:
- 11/16/16 14:53:24 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/io/nc4_data_output.cpp
r989 r990 1675 1675 for (vector<CVariable*>::iterator it = listVars.begin() ;it != listVars.end(); it++) writeAttribute_(*it, fieldid) ; 1676 1676 1677 bool alreadyAddCellMethod = false; 1678 StdString cellMethodsPrefix(""), cellMethodsSuffix(""); 1679 if (!field->cell_methods.isEmpty()) 1680 { 1681 StdString cellMethodString = field->cell_methods; 1682 if (field->cell_methods_mode.isEmpty() || 1683 (CField::cell_methods_mode_attr::overwrite == field->cell_methods_mode)) 1684 { 1685 SuperClassWriter::addAttribute("cell_methods", cellMethodString, &fieldid); 1686 alreadyAddCellMethod = true; 1687 } 1688 else 1689 { 1690 switch (field->cell_methods_mode) 1691 { 1692 case (CField::cell_methods_mode_attr::prefix): 1693 cellMethodsPrefix = cellMethodString; 1694 cellMethodsPrefix += " "; 1695 break; 1696 case (CField::cell_methods_mode_attr::suffix): 1697 cellMethodsSuffix = " "; 1698 cellMethodsSuffix += cellMethodString; 1699 break; 1700 case (CField::cell_methods_mode_attr::none): 1701 break; 1702 default: 1703 break; 1704 } 1705 } 1706 } 1707 1677 1708 1678 1709 if (wtime) … … 1687 1718 SuperClassWriter::addAttribute("interval_write", freqOut.toStringUDUnits(), &fieldid); 1688 1719 1689 StdString cellMethods = "time: ";1720 StdString cellMethods(cellMethodsPrefix + "time: "); 1690 1721 if (field->operation.getValue() == "instant") cellMethods += "point"; 1691 1722 else if (field->operation.getValue() == "average") cellMethods += "mean"; … … 1694 1725 if (freqOp.resolve(*context->calendar) != freqOut.resolve(*context->calendar)) 1695 1726 cellMethods += " (interval: " + freqOpStr + ")"; 1696 SuperClassWriter::addAttribute("cell_methods", cellMethods, &fieldid); 1727 cellMethods += cellMethodsSuffix; 1728 if (!alreadyAddCellMethod) 1729 SuperClassWriter::addAttribute("cell_methods", cellMethods, &fieldid); 1697 1730 } 1698 1731
Note: See TracChangeset
for help on using the changeset viewer.