61 if ((retval = nc_def_dim(ncid,
"nrows", m.
nrows(), &ncdims[0])))
63 if ((retval = nc_def_dim(ncid,
"ncols", m.
ncols(), &ncdims[1])))
65 if ((retval = nc_def_var(ncid,
"Matrix", NC_DOUBLE, 2, &ncdims[0], &varid)))
67 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
68 if ((retval = nc_put_var_double(ncid, varid, m.
get_c_array())))
80 Index npages, nrows, ncols;
85 t.
resize(npages, nrows, ncols);
97 if ((retval = nc_def_dim(ncid,
"npages", t.
npages(), &ncdims[0])))
99 if ((retval = nc_def_dim(ncid,
"nrows", t.
nrows(), &ncdims[1])))
101 if ((retval = nc_def_dim(ncid,
"ncols", t.
ncols(), &ncdims[2])))
103 if ((retval = nc_def_var(ncid,
"Tensor3", NC_DOUBLE, 3, &ncdims[0], &varid)))
105 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
106 if ((retval = nc_put_var_double(ncid, varid, t.
get_c_array())))
118 Index nbooks, npages, nrows, ncols;
124 t.
resize(nbooks, npages, nrows, ncols);
135 int ncdims[4], varid;
136 if ((retval = nc_def_dim(ncid,
"nbooks", t.
nbooks(), &ncdims[0])))
138 if ((retval = nc_def_dim(ncid,
"npages", t.
npages(), &ncdims[1])))
140 if ((retval = nc_def_dim(ncid,
"nrows", t.
nrows(), &ncdims[2])))
142 if ((retval = nc_def_dim(ncid,
"ncols", t.
ncols(), &ncdims[3])))
144 if ((retval = nc_def_var(ncid,
"Tensor4", NC_DOUBLE, 4, &ncdims[0], &varid)))
146 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
147 if ((retval = nc_put_var_double(ncid, varid, t.
get_c_array())))
159 Index nshelves, nbooks, npages, nrows, ncols;
166 t.
resize(nshelves, nbooks, npages, nrows, ncols);
177 int ncdims[5], varid;
178 if ((retval = nc_def_dim(ncid,
"nshelves", t.
nshelves(), &ncdims[0])))
180 if ((retval = nc_def_dim(ncid,
"nbooks", t.
nbooks(), &ncdims[1])))
182 if ((retval = nc_def_dim(ncid,
"npages", t.
npages(), &ncdims[2])))
184 if ((retval = nc_def_dim(ncid,
"nrows", t.
nrows(), &ncdims[3])))
186 if ((retval = nc_def_dim(ncid,
"ncols", t.
ncols(), &ncdims[4])))
188 if ((retval = nc_def_var(ncid,
"Tensor5", NC_DOUBLE, 5, &ncdims[0], &varid)))
190 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
191 if ((retval = nc_put_var_double(ncid, varid, t.
get_c_array())))
218 if ((retval = nc_def_dim(ncid,
"nelem", v.
nelem(), &ncdim)))
220 if ((retval = nc_def_var(ncid,
"Vector", NC_DOUBLE, 1, &ncdim, &varid)))
222 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
223 if ((retval = nc_put_var_double(ncid, varid, v.
get_c_array())))
232 #define TMPL_NC_READ_WRITE_FILE_DUMMY(what) \ 233 void nca_write_to_file(const int, const what&, const Verbosity&) { \ 234 throw runtime_error("NetCDF support not yet implemented for this type!"); \ 236 void nca_read_from_file(const int, what&, const Verbosity&) { \ 237 throw runtime_error("NetCDF support not yet implemented for this type!"); \ 243 #undef TMPL_NC_READ_WRITE_FILE_DUMMY Index npages() const
Returns the number of pages.
INDEX Index
The type to use for all integer numbers and indices.
void nca_write_to_file(const int ncid, const Matrix &m, const Verbosity &)
Writes a Matrix to a NetCDF file.
Index nrows() const
Returns the number of rows.
This file contains basic functions to handle NetCDF data files.
void resize(Index s, Index b, Index p, Index r, Index c)
Resize function.
void nca_read_from_file(const int ncid, Matrix &m, const Verbosity &)
Reads a Matrix from a NetCDF file.
const Numeric * get_c_array() const
Conversion to plain C-array.
void nca_error(const int e, const String s)
Throws a runtime error for the given NetCDF error code.
Index npages() const
Returns the number of pages.
Index nbooks() const
Returns the number of books.
Index nrows() const
Returns the number of rows.
Index nrows() const
Returns the number of rows.
Index nelem() const
Returns the number of elements.
Index ncols() const
Returns the number of columns.
const Numeric * get_c_array() const
Conversion to plain C-array, const-version.
The global header file for ARTS.
Index nshelves() const
Returns the number of shelves.
Index ncols() const
Returns the number of columns.
This file contains private function declarations and template instantiation to handle NetCDF data fil...
const Numeric * get_c_array() const
Conversion to plain C-array.
void resize(Index p, Index r, Index c)
Resize function.
Index npages() const
Returns the number of pages.
void resize(Index n)
Resize function.
Index nelem(const Lines &l)
Number of lines.
Index nbooks() const
Returns the number of books.
void nca_get_data_double(const int ncid, const String &name, Numeric *data)
Read variable of type double from NetCDF file.
Index ncols() const
Returns the number of columns.
const Numeric * get_c_array() const
Conversion to plain C-array.
Index nc_get_dim(const int ncid, const String &name, const bool noerror)
Read a dimension from NetCDF file.
Index ncols() const
Returns the number of columns.
Index nrows() const
Returns the number of rows.
void resize(Index b, Index p, Index r, Index c)
Resize function.
void resize(Index r, Index c)
Resize function.
const Numeric * get_c_array() const
Conversion to plain C-array.