source: XIOS/trunk/src/data_output.cpp @ 831

Last change on this file since 831 was 676, checked in by rlacroix, 9 years ago

Add support for indexed output.

If the new field attribute "indexed_output" is set to true and a mask is defined (either at grid, domain or axis level), the indexed data will be outputed instead of the full data with missing values.

See http://cfconventions.org/Data/cf-conventions/cf-conventions-1.5/build/cf-conventions.html#compression-by-gathering for more information.

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 2.9 KB
RevLine 
[219]1#include "data_output.hpp"
2
[352]3#include "attribute_template.hpp"
4#include "group_template.hpp"
[219]5#include "context.hpp"
6
[335]7namespace xios
[219]8{
9      /// ////////////////////// Définitions ////////////////////// ///
10
11      CDataOutput::~CDataOutput(void)
12      { /* Ne rien faire de plus */ }
13
14      //----------------------------------------------------------------
15
[676]16      void CDataOutput::writeGrid(CGrid* grid, bool allowCompressedOutput /*= false*/)
[219]17      {
[540]18        this->writeGrid(grid->getDomains(), grid->getAxis());
[676]19
20        if (allowCompressedOutput)
21          writeGridCompressed_(grid);
[219]22      }
23
24      //----------------------------------------------------------------
25
[347]26      void CDataOutput::writeFile(CFile*  file)
[219]27      {
28         this->writeFile_(file);
29      }
[472]30
31      void CDataOutput::writeAttribute(CVariable*  var)
32      {
33         this->writeAttribute_(var) ;
34      }
35
[321]36      void CDataOutput::syncFile(void)
37      {
38         this->syncFile_();
39      }
[219]40
[286]41      void CDataOutput::closeFile(void)
42      {
43         this->closeFile_();
44      }
45
[219]46      //----------------------------------------------------------------
47
[676]48      void CDataOutput::writeGrid(CDomain* domain, CAxis* axis)
[219]49      {
50         this->writeDomain_(domain);
51         this->writeAxis_(axis);
52      }
53
[540]54      void CDataOutput::writeGrid(std::vector<CDomain*> domains, std::vector<CAxis*> axis)
55      {
56        int domSize = domains.size();
57        int aSize = axis.size();
58        for (int i = 0; i < domSize; ++i) this->writeDomain_(domains[i]);
59        for (int i = 0; i < aSize; ++i) this->writeAxis_(axis[i]);
60      }
61
[219]62      //----------------------------------------------------------------
63
[347]64      void CDataOutput::writeGrid(CDomain* domain)
[219]65      {
66         this->writeDomain_(domain);
67      }
68
[391]69      void CDataOutput::writeTimeDimension(void)
70      {
71         this->writeTimeDimension_();
72      }
73
[219]74      //----------------------------------------------------------------
75
[347]76      void CDataOutput::writeField(CField* field)
[219]77      {
[347]78         CContext* context = CContext::getCurrent() ;
[343]79         boost::shared_ptr<CCalendar> calendar = context->getCalendar();
[540]80
[219]81         this->writeField_(field);
82         this->writeTimeAxis_(field, calendar);
83      }
84
85      //----------------------------------------------------------------
86
[347]87      void CDataOutput::writeFieldGrid(CField* field)
[219]88      {
[676]89         this->writeGrid(field->getRelGrid(),
90                         !field->indexed_output.isEmpty() && field->indexed_output);
[219]91      }
[540]92
[219]93      //----------------------------------------------------------------
[540]94
[347]95      void CDataOutput::writeFieldData(CField* field)
[219]96      {
[540]97//         CGrid* grid = CGrid::get(field->grid_ref.getValue());
98//         CDomain* domain = CDomain::get(grid->domain_ref.getValue());
[219]99         this->writeFieldData_(field);
100      }
[540]101
[219]102      ///----------------------------------------------------------------
103
[335]104} // namespace xios
Note: See TracBrowser for help on using the repository browser.