source: XIOS/trunk/src/output/nc4_data_output.hpp @ 517

Last change on this file since 517 was 517, checked in by rlacroix, 10 years ago

Add a new attribute to the file definition so that the output format can be controlled.

Currently the supported formats are "netcdf4" and "netcdf4_classic". The "format" attribute is optional. The "netcdf4" format will be used when no format is explicitly defined. Since "netcdf4" is the format which was previously used by XIOS, existing configuration files will not be affected by this change.

If "netcdf4_classic" is used, the output file(s) will be created using the classic NetCDF format. This format can be used with the attribute "type" set to "one_file" if the NetCDF4 library was compiled with Parallel NetCDF support (--enable-pnetcdf).

  • 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: 4.2 KB
Line 
1#ifndef __XMLIO_NC4_DATA_OUTPUT__
2#define __XMLIO_NC4_DATA_OUTPUT__
3
4/// xios headers ///
5#include "xmlioserver_spl.hpp"
6#include "onetcdf4.hpp"
7#include "data_output.hpp"
8
9namespace xios
10{
11      /// ////////////////////// Déclarations ////////////////////// ///
12
13      class CNc4DataOutput
14         : protected CONetCDF4
15         , public virtual CDataOutput
16      {
17         public :
18
19            /// Définition de type ///
20            typedef CONetCDF4   SuperClassWriter;
21            typedef CDataOutput SuperClass;
22
23            /// Constructeurs ///
24            CNc4DataOutput
25               (const StdString & filename, bool exist);
26            CNc4DataOutput
27               (const StdString & filename, bool exist, bool useClassicFormat,
28                MPI_Comm comm_file, bool multifile, bool isCollective=true);
29
30            CNc4DataOutput(const CNc4DataOutput & dataoutput);       // Not implemented.
31            CNc4DataOutput(const CNc4DataOutput * const dataoutput); // Not implemented.
32
33            /// Accesseur ///
34            const StdString & getFileName(void) const;
35
36            /// Destructeur ///
37            virtual ~CNc4DataOutput(void);
38            bool singleDomain ;
39            bool isCollective ;
40         protected :
41
42            /// Ecriture ///
43            virtual void writeDomain_    (CDomain* domain);
44            virtual void writeAxis_      (CAxis* axis);
45            virtual void writeTimeDimension_(void);
46            virtual void writeField_     (CField* field);
47            virtual void writeAttribute_ (CVariable* var);
48            virtual void writeAttribute_ (CVariable* var, const string& fieldId);
49            virtual void writeFieldData_ (CField* field);
50            virtual void writeFile_      (CFile* file);
51            virtual void closeFile_      (void);
52            virtual void syncFile_      (void);
53            virtual void writeTimeAxis_  (CField* field,
54                                          const boost::shared_ptr<CCalendar> cal);
55
56         protected :
57            void writeUnstructuredDomain (CDomain* domain);
58            void writeLocalAttributes(int ibegin, int ni, int jbegin, int nj, StdString domid);
59            void writeLocalAttributes_IOIPSL(int ibegin, int ni, int jbegin, int nj, int ni_glo, int nj_glo, int rank, int size) ;
60            void writeTimeAxisAttributes(const StdString & axis_name,
61                                         const StdString & calendar,
62                                         const StdString & units,
63                                         const StdString & time_origin,
64                                         const StdString & time_bounds   = StdString("bounds"),
65                                         const StdString & standard_name = StdString("time"),
66                                         const StdString & long_name     = StdString("Time axis"),
67                                         const StdString & title         = StdString("Time"));
68
69            void writeFileAttributes(const StdString & name,
70                                     const StdString & description,
71                                     const StdString & conventions,
72                                     const StdString & production,
73                                     const StdString & timeStamp);
74
75            void writeMaskAttributes(const StdString & mask_name,
76                                     int data_dim,
77                                     int data_ni     = 0,
78                                     int data_nj     = 0,
79                                     int data_ibegin = 0,
80                                     int data_jbegin = 0);
81
82            void writeAxisAttributes(const StdString & axis_name,
83                                     const StdString & axis,
84                                     const StdString & standard_name,
85                                     const StdString & long_name,
86                                     const StdString & units,
87                                     const StdString & nav_model);
88
89         private :
90
91            /// Traitement ///
92            StdString getTimeStamp(void) const;
93
94            /// Propriétés privées ///
95            MPI_Comm comm_file;
96            const StdString filename;
97
98      }; // class CNc4DataOutput
99
100} // namespace xios
101
102#endif //__XMLIO_NC4_DATA_OUTPUT__
Note: See TracBrowser for help on using the repository browser.