ARTS  2.0.49
m_nc.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 Oliver Lemke <olemke@core-dump.info>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA. */
17 
27 #ifndef m_nc_h
28 #define m_nc_h
29 
30 #include "arts.h"
31 
32 #include "exceptions.h"
33 #include "workspace_ng.h"
34 #include "agenda_class.h"
35 
36 
37 #ifdef ENABLE_NETCDF
38 
39 #include "nc_io.h"
40 
41 /* Workspace method: Doxygen documentation will be auto-generated */
42 template<typename T> void
43 ReadNetCDF (// WS Generic Input:
44  T& v,
45  const String& v_name _U_,
46  const String& f,
47  // WS Generic Input Names:
48  const String& f_name _U_,
49  const Verbosity& verbosity)
50 
51 {
52  nc_read_from_file (f, v, verbosity);
53 }
54 
55 /* Workspace method: Doxygen documentation will be auto-generated */
56 template<typename T> void
57 WriteNetCDF (// WS Generic Input:
58  const T& v,
59  const String& f,
60  // WS Generic Input Names:
61  const String& v_name,
62  const String& f_name _U_,
63  const Verbosity& verbosity)
64 
65 {
66  String filename = f;
67 
68  // Create default filename if empty
69  filename_nc (filename, v_name);
70 
71  nc_write_to_file (filename, v, verbosity);
72 }
73 
74 #else // NetCDF not enabled
75 
76 /* Workspace method: Doxygen documentation will be auto-generated */
77 template<typename T> void
78 ReadNetCDF (// WS Generic Input:
79  T&,
80  const String&,
81  const String&,
82  // WS Generic Input Names:
83  const String&,
84  const Verbosity&)
85 
86 {
87  throw runtime_error("This version of ARTS was compiled without NetCDF support.");
88 }
89 
90 /* Workspace method: Doxygen documentation will be auto-generated */
91 template<typename T> void
92 WriteNetCDF (// WS Generic Input:
93  const T&,
94  const String&,
95  // WS Generic Input Names:
96  const String&,
97  const String&,
98  const Verbosity&)
99 
100 {
101  throw runtime_error("This version of ARTS was compiled without NetCDF support.");
102 }
103 
104 #endif // ENABLE_NETCDF
105 
106 /* Workspace method: Doxygen documentation will be auto-generated */
107 template<typename T> void
109  // WS Generic Input:
110  T& v,
111  const String& v_name,
112  const String& f,
113  // WS Generic Input Names:
114  const String& f_name,
115  const Verbosity& verbosity)
116 
117 {
118  ReadNetCDF (v, f, v_name, f_name, verbosity);
119 }
120 
121 /* Workspace method: Doxygen documentation will be auto-generated */
122 void
124  // WS Generic Input:
125  const Agenda& v,
126  const String& f,
127  // WS Generic Input Names:
128  const String& v_name,
129  const String& f_name,
130  const Verbosity& verbosity)
131 {
132  WriteNetCDF (v, f, v_name, f_name, verbosity);
133 }
134 
135 #endif // m_nc_h
136 
exceptions.h
The declarations of all the exception classes.
nc_io.h
This file contains basic functions to handle NetCDF data files.
ReadNetCDF
void ReadNetCDF(T &, const String &, const String &, const String &, const Verbosity &)
WORKSPACE METHOD: ReadNetCDF.
Definition: m_nc.h:78
Agenda
The Agenda class.
Definition: agenda_class.h:44
agenda_class.h
Declarations for agendas.
_U_
#define _U_
Definition: config.h:158
my_basic_string
The implementation for String, the ARTS string class.
Definition: mystring.h:62
Verbosity
Definition: messages.h:50
workspace_ng.h
This file contains the declaration and partly the implementation of the workspace class.
Workspace
Workspace class.
Definition: workspace_ng.h:47
WriteNetCDF
void WriteNetCDF(const T &, const String &, const String &, const String &, const Verbosity &)
WORKSPACE METHOD: WriteNetCDF.
Definition: m_nc.h:92
arts.h
The global header file for ARTS.