ARTS 2.5.11 (git: 725533f0)
m_nc.h
Go to the documentation of this file.
1
10#ifndef m_nc_h
11#define m_nc_h
12
13#include "arts.h"
14
15#include "agenda_class.h"
16#include "exceptions.h"
17#include "workspace_ng.h"
18
19#ifdef ENABLE_NETCDF
20
21#include "nc_io.h"
22
23/* Workspace method: Doxygen documentation will be auto-generated */
24template <typename T>
25void ReadNetCDF( // WS Generic Input:
26 T& v,
27 const String& v_name _U_,
28 const String& f,
29 // WS Generic Input Names:
30 const String& f_name _U_,
31 const Verbosity& verbosity)
32
33{
34 nca_read_from_file(f, v, verbosity);
35}
36
37/* Workspace method: Doxygen documentation will be auto-generated */
38template <typename T>
39void WriteNetCDF( // WS Generic Input:
40 const T& v,
41 const String& f,
42 // WS Generic Input Names:
43 const String& v_name,
44 const String& f_name _U_,
45 const Verbosity& verbosity)
46
47{
48 String filename = f;
49
50 // Create default filename if empty
51 nca_filename(filename, v_name);
52
53 nca_write_to_file(filename, v, verbosity);
54}
55
56/* Workspace method: Doxygen documentation will be auto-generated */
57template <typename T>
58void WriteNetCDFIndexed( //WS Input:
59 const Index& file_index,
60 // WS Generic Input:
61 const T& v,
62 const String& f,
63 // WS Generic Input Names:
64 const String& v_name,
65 const String& f_name,
66 const Verbosity& verbosity)
67
68{
69 String filename = f;
70
71 // Create default filename if empty
72 nca_filename_with_index(filename, file_index, v_name);
73
74 WriteNetCDF(v, filename, v_name, f_name, verbosity);
75}
76
77#else // NetCDF not enabled
78
79/* Workspace method: Doxygen documentation will be auto-generated */
80template <typename T>
81void ReadNetCDF( // WS Generic Input:
82 T&,
83 const String&,
84 const String&,
85 // WS Generic Input Names:
86 const String&,
87 const Verbosity&)
88
89{
90 throw runtime_error(
91 "This version of ARTS was compiled without NetCDF support.");
92}
93
94/* Workspace method: Doxygen documentation will be auto-generated */
95template <typename T>
96void WriteNetCDF( // WS Generic Input:
97 const T&,
98 const String&,
99 // WS Generic Input Names:
100 const String&,
101 const String&,
102 const Verbosity&)
103
104{
105 throw runtime_error(
106 "This version of ARTS was compiled without NetCDF support.");
107}
108
109/* Workspace method: Doxygen documentation will be auto-generated */
110template <typename T>
111void WriteNetCDFIndexed( //WS Input:
112 const Index&,
113 // WS Generic Input:
114 const T&,
115 const String&,
116 // WS Generic Input Names:
117 const String&,
118 const String&,
119 const Verbosity&)
120
121{
122 throw runtime_error(
123 "This version of ARTS was compiled without NetCDF support.");
124}
125
126#endif // ENABLE_NETCDF
127
128/* Workspace method: Doxygen documentation will be auto-generated */
129template <typename T>
131 // WS Generic Input:
132 T& v,
133 const String& v_name,
134 const String& f,
135 // WS Generic Input Names:
136 const String& f_name,
137 const Verbosity& verbosity)
138
139{
140 ReadNetCDF(v, f, v_name, f_name, verbosity);
141}
142
143/* Workspace method: Doxygen documentation will be auto-generated */
144inline void WriteNetCDF(Workspace& ws _U_,
145 // WS Generic Input:
146 const Agenda& v,
147 const String& f,
148 // WS Generic Input Names:
149 const String& v_name,
150 const String& f_name,
151 const Verbosity& verbosity) {
152 WriteNetCDF(v, f, v_name, f_name, verbosity);
153}
154
155#endif // m_nc_h
Declarations for agendas.
The global header file for ARTS.
The Agenda class.
Workspace class.
#define _U_
Definition config.h:177
The declarations of all the exception classes.
void WriteNetCDFIndexed(const Index &file_index, const T &v, const String &f, const String &v_name, const String &f_name, const Verbosity &verbosity)
WORKSPACE METHOD: WriteNetCDFIndexed.
Definition m_nc.h:58
void WriteNetCDF(const T &v, const String &f, const String &v_name, const String &f_name, const Verbosity &verbosity)
WORKSPACE METHOD: WriteNetCDF.
Definition m_nc.h:39
void ReadNetCDF(T &v, const String &v_name, const String &f, const String &f_name, const Verbosity &verbosity)
WORKSPACE METHOD: ReadNetCDF.
Definition m_nc.h:25
void nca_filename_with_index(String &filename, const Index &file_index, const String &varname)
Gives the default filename, with file index, for the NetCDF formats.
Definition nc_io.cc:53
void nca_filename(String &filename, const String &varname)
Gives the default filename for the NetCDF formats.
Definition nc_io.cc:36
void nca_write_to_file(const String &filename, const T &type, const Verbosity &verbosity)
Writes a variable to a NetCDF file.
Definition nc_io.cc:116
void nca_read_from_file(const String &filename, T &type, const Verbosity &verbosity)
Reads a variable from a NetCDF file.
Definition nc_io.cc:76
This file contains basic functions to handle NetCDF data files.
#define v
This file contains the Workspace class.