66 if ((retval = nc_def_dim(ncid,
"nrows", m.
nrows(), &ncdims[0])))
68 if ((retval = nc_def_dim(ncid,
"ncols", m.
ncols(), &ncdims[1])))
70 if ((retval = nc_def_var(ncid,
"Matrix", NC_DOUBLE, 2, &ncdims[0], &varid)))
72 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
73 if ((retval = nc_put_var_double(ncid, varid, m.
get_c_array())))
87 Index npages, nrows, ncols;
92 t.
resize(npages, nrows, ncols);
105 int ncdims[3], varid;
106 if ((retval = nc_def_dim(ncid,
"npages", t.
npages(), &ncdims[0])))
108 if ((retval = nc_def_dim(ncid,
"nrows", t.
nrows(), &ncdims[1])))
110 if ((retval = nc_def_dim(ncid,
"ncols", t.
ncols(), &ncdims[2])))
112 if ((retval = nc_def_var(ncid,
"Tensor3", NC_DOUBLE, 3, &ncdims[0], &varid)))
114 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
115 if ((retval = nc_put_var_double(ncid, varid, t.
get_c_array())))
129 Index nbooks, npages, nrows, ncols;
135 t.
resize(nbooks, npages, nrows, ncols);
148 int ncdims[4], varid;
149 if ((retval = nc_def_dim(ncid,
"nbooks", t.
nbooks(), &ncdims[0])))
151 if ((retval = nc_def_dim(ncid,
"npages", t.
npages(), &ncdims[1])))
153 if ((retval = nc_def_dim(ncid,
"nrows", t.
nrows(), &ncdims[2])))
155 if ((retval = nc_def_dim(ncid,
"ncols", t.
ncols(), &ncdims[3])))
157 if ((retval = nc_def_var(ncid,
"Tensor4", NC_DOUBLE, 4, &ncdims[0], &varid)))
159 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
160 if ((retval = nc_put_var_double(ncid, varid, t.
get_c_array())))
174 Index nshelves, nbooks, npages, nrows, ncols;
181 t.
resize(nshelves, nbooks, npages, nrows, ncols);
194 int ncdims[5], varid;
195 if ((retval = nc_def_dim(ncid,
"nshelves", t.
nshelves(), &ncdims[0])))
197 if ((retval = nc_def_dim(ncid,
"nbooks", t.
nbooks(), &ncdims[1])))
199 if ((retval = nc_def_dim(ncid,
"npages", t.
npages(), &ncdims[2])))
201 if ((retval = nc_def_dim(ncid,
"nrows", t.
nrows(), &ncdims[3])))
203 if ((retval = nc_def_dim(ncid,
"ncols", t.
ncols(), &ncdims[4])))
205 if ((retval = nc_def_var(ncid,
"Tensor5", NC_DOUBLE, 5, &ncdims[0], &varid)))
207 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
208 if ((retval = nc_put_var_double(ncid, varid, t.
get_c_array())))
239 if ((retval = nc_def_dim(ncid,
"nelem", v.
nelem(), &ncdim)))
241 if ((retval = nc_def_var(ncid,
"Vector", NC_DOUBLE, 1, &ncdim, &varid)))
243 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
244 if ((retval = nc_put_var_double(ncid, varid, v.
get_c_array())))
254 #define TMPL_NC_READ_WRITE_FILE_DUMMY(what) \ 255 void nca_write_to_file(const int, const what&, const Verbosity&) \ 257 throw runtime_error("NetCDF support not yet implemented for this type!"); \ 259 void nca_read_from_file(const int, what&, const Verbosity&) \ 261 throw runtime_error("NetCDF support not yet implemented for this type!"); \ 267 #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.
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)
Assignment operator from VectorView.
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.