Go to the documentation of this file.
52 throw runtime_error(
"No species found in lookup table file!");
77 int species_strings_varid;
78 int species_count_varid;
81 Index species_max_strlen = 0;
82 char* species_strings = NULL;
85 long species_total_nelems = 0;
88 species_total_nelems += nspecies_nelem;
89 species_count[nspecies] = nspecies_nelem;
91 for (ArrayOfSpeciesTag::const_iterator it = gal.
species[nspecies].begin();
92 it != gal.
species[nspecies].end();
94 if (it->Name().nelem() > species_max_strlen)
95 species_max_strlen = it->Name().
nelem();
99 species_strings =
new char[species_total_nelems * species_max_strlen];
100 memset(species_strings, 0, species_total_nelems * species_max_strlen);
103 for (ArrayOfArrayOfSpeciesTag::const_iterator it1 = gal.
species.begin();
106 for (ArrayOfSpeciesTag::const_iterator it2 = it1->begin();
109 memccpy(&species_strings[str_i],
113 str_i += species_max_strlen;
116 species_count_varid =
119 int species_strings_ncdims[2];
121 "species_strings_nelem",
122 species_total_nelems,
123 &species_strings_ncdims[0]);
125 "species_strings_length",
127 &species_strings_ncdims[1]);
132 &species_strings_ncdims[0],
133 &species_strings_varid);
135 throw runtime_error(
"Current lookup table contains no species!");
139 int nonlinear_species_varid =
149 if ((retval = nc_enddef(ncid)))
nca_error(retval,
"nc_enddef");
155 nc_put_var_text(ncid, species_strings_varid, species_strings)))
159 delete[] species_strings;
177 #define TMPL_NC_READ_WRITE_FILE_DUMMY(what) \
178 void nca_write_to_file(const int, const what&, const Verbosity&) { \
179 throw runtime_error("NetCDF support not yet implemented for this type!"); \
181 void nca_read_from_file(const int, what&, const Verbosity&) { \
182 throw runtime_error("NetCDF support not yet implemented for this type!"); \
190 #undef TMPL_NC_READ_WRITE_FILE_DUMMY
void nca_get_data_Matrix(const int ncid, const String &name, Matrix &m, const bool noerror)
Read variable of type Matrix from NetCDF file.
ArrayOfIndex nonlinear_species
The species tags with non-linear treatment.
void nca_get_data_ArrayOfIndex(const int ncid, const String &name, ArrayOfIndex &aoi, const bool noerror)
Read variable of type ArrayOfIndex from NetCDF file.
This file contains basic functions to handle NetCDF data files.
bool nca_put_var_Matrix(const int ncid, const int varid, const Matrix &m)
Write variable of type Matrix to NetCDF file.
void nca_get_data_Tensor4(const int ncid, const String &name, Tensor4 &t, const bool noerror)
Read variable of type Tensor4 from NetCDF file.
This file contains private function declarations and template instantiation to handle NetCDF data fil...
An absorption lookup table.
This can be used to make arrays out of anything.
bool nca_put_var_ArrayOfIndex(const int ncid, const int varid, const ArrayOfIndex &a)
Write variable of type ArrayOfIndex to NetCDF file.
#define TMPL_NC_READ_WRITE_FILE_DUMMY(what)
void nca_read_from_file(const int ncid, GasAbsLookup &gal, const Verbosity &)
Reads a GasAbsLookup table from a NetCDF file.
int nca_def_Vector(const int ncid, const String &name, const Vector &v)
Define NetCDF dimensions and variable for a Vector.
int nca_def_Tensor4(const int ncid, const String &name, const Tensor4 &t)
Define NetCDF dimensions and variable for a Tensor4.
bool nca_put_var_Tensor4(const int ncid, const int varid, const Tensor4 &t)
Write variable of type Tensor4 to NetCDF file.
Vector t_ref
The reference temperature profile [K].
Vector f_grid
The frequency grid [Hz].
Vector p_grid
The pressure grid for the table [Pa].
int nca_def_Matrix(const int ncid, const String &name, const Matrix &m)
Define NetCDF dimensions and variable for a Matrix.
int nca_def_ArrayOfIndex(const int ncid, const String &name, const ArrayOfIndex &a)
Define NetCDF dimensions and variable for an ArrayOfIndex.
Vector nls_pert
The vector of perturbations for the VMRs of the nonlinear species.
Tensor4 xsec
Absorption cross sections.
void nca_def_var(const int ncid, const String &name, const nc_type type, const int ndims, const int *dims, int *varid)
Define NetCDF variable.
ArrayOfArrayOfSpeciesTag species
The species tags for which the table is valid.
void nca_write_to_file(const int ncid, const GasAbsLookup &gal, const Verbosity &)
Writes a GasAbsLookup table to a NetCDF file.
void nca_def_dim(const int ncid, const String &name, const Index nelem, int *ncdim)
Define NetCDF dimension.
INDEX Index
The type to use for all integer numbers and indices.
void nca_get_data_Vector(const int ncid, const String &name, Vector &v, const bool noerror)
Read variable of type Vector from NetCDF file.
Matrix vmrs_ref
The reference VMR profiles.
Vector t_pert
The vector of temperature perturbations [K].
void nca_error(const int e, const String s)
Throws a runtime error for the given NetCDF error code.
Index nelem() const
Number of elements.
The global header file for ARTS.
void nca_get_data_ArrayOfArrayOfSpeciesTag(const int ncid, const String &name, ArrayOfArrayOfSpeciesTag &aast, const bool noerror)
Read variable of type ArrayOfArrayOfSpeciesTag from NetCDF file.
bool nca_put_var_Vector(const int ncid, const int varid, const Vector &v)
Write variable of type Vector to NetCDF file.