Go to the documentation of this file.
66 assert(result.
nelem()==nf);
72 if (out3.sufficient_priority())
76 os <<
" f_grid: " << f_grid[0] <<
" - "
77 << f_grid[nf-1] <<
" Hz\n"
78 <<
" data_f_grid: " << data_f_grid[0] <<
" - "
79 << data_f_grid[data_f_grid.
nelem()-1] <<
" Hz\n"
80 <<
" temperature: " << temperature <<
" K\n"
81 <<
" data_T_grid: " << data_T_grid[0] <<
" - "
82 << data_T_grid[data_T_grid.
nelem()-1] <<
" K\n";
93 Index i_fstart, i_fstop;
95 for (i_fstart=0; i_fstart<nf; ++i_fstart)
96 if (f_grid[i_fstart] >= data_f_grid[0])
break;
99 if (i_fstart==nf)
return;
101 for (i_fstop=nf-1; i_fstop>=0; --i_fstop)
102 if (f_grid[i_fstop] <= data_f_grid[data_f_grid.
nelem()-1])
break;
105 if (i_fstop==-1)
return;
108 const Index f_extent = i_fstop-i_fstart+1;
110 if (out3.sufficient_priority())
113 os <<
" " << f_extent <<
" frequency extraction points starting at "
114 <<
"frequency index " << i_fstart <<
".\n";
121 if (f_extent < 1)
return;
132 const Index f_order = 3;
136 if ( data_f_grid.
nelem() < f_order+1 )
139 os <<
"Not enough frequency grid points in CIA data.\n"
140 <<
"You have only " << data_f_grid.
nelem() <<
" grid points.\n"
141 <<
"But need at least " << f_order+1 <<
".";
142 throw runtime_error(os.str());
149 switch (data_T_grid.
nelem()) {
179 }
catch (runtime_error e) {
187 throw runtime_error(e.what());
194 gridpos_poly(f_gp, data_f_grid, f_grid_active, f_order);
201 Matrix itw(f_gp.nelem(),f_order+1);
210 gridpos_poly(T_gp, data_T_grid, temperature, T_order, T_extrapolfac);
213 Tensor3 itw(f_gp.nelem(),T_gp.
nelem(),(f_order+1)*(T_order+1));
226 interp(result_matrix, itw, cia_data.
data, f_gp, T_gp);
236 if (result_active[i]<0)
237 result_active[i] = 0;
256 if ((cia_data[i].Species(0) == sp1 && cia_data[i].Species(1) == sp2)
257 || (cia_data[i].Species(0) == sp2 && cia_data[i].Species(1) == sp1))
268 const Index& dataset,
281 os <<
"There are only " <<
mdata.
nelem() <<
" datasets in this CIA file.\n"
282 <<
"But you are trying to use dataset " << dataset <<
". (Zero-based indexing.)";
283 throw runtime_error(os.str());
328 os <<
"Species does not exist in ARTS: " << name;
329 throw runtime_error(os.str());
351 out2 <<
" Reading file: " << filename <<
"\n";
386 if (is.eof())
continue;
388 if (line.
nelem() < 100)
391 os <<
"Error in line " << nline
392 <<
" reading CIA catalog file " << filename << endl
393 <<
"Header line unexpectedly short: " << endl << line;
395 throw runtime_error(os.str());
401 os <<
"Error in line " << nline
402 <<
" reading CIA catalog file " << filename << endl;
404 throw runtime_error(os.str());
417 istr >> set_wave_min >> set_wave_max >> set_npoints >> set_temp;
419 if (!istr || isnan(set_temp) || isnan(set_wave_min) || isnan(set_wave_max))
422 os <<
"Error in line " << nline
423 <<
" reading CIA catalog file " << filename << endl;
425 throw runtime_error(os.str());
430 if (npoints == -1 || wave_min != set_wave_min || wave_max != set_wave_max)
435 npoints = set_npoints;
437 wave_min = set_wave_min;
438 wave_max = set_wave_max;
444 if (npoints != set_npoints)
447 os <<
"Error in line " << nline
448 <<
" reading CIA catalog file " << filename << endl
449 <<
"Inconsistent number of data points. Expected " << npoints
450 <<
", got " << set_npoints;
452 throw runtime_error(os.str());
455 temp.push_back(set_temp);
456 cia.push_back(
Vector(npoints));
460 for (
Index i = 0; i < npoints; i++)
472 if (isnan(
w) || isnan(c) || is.bad() || istr.bad())
475 os <<
"Error in line " << nline
476 <<
" reading CIA catalog file " << filename <<
":" << endl
479 throw runtime_error(os.str());
487 cia[nset][i] = c / 1e10;
496 os <<
"Error in line " << nline
497 <<
" reading CIA catalog file " << filename << endl;
499 throw runtime_error(os.str());
531 mdata.push_back(dataset);
545 os <<
"CIARecord output operator not yet implemented." << endl;
void set_grid_name(Index i, const String &s)
Set grid name.
Declarations required for the calculation of absorption coefficients.
void AppendDataset(const Vector &freq, const ArrayOfNumeric &temp, const ArrayOfVector &cia)
Append dataset to mdata.
Numeric interp(ConstVectorView itw, ConstVectorView a, const GridPos &tc)
Red 1D Interpolate.
void cia_interpolation(VectorView result, ConstVectorView f_grid, const Numeric &temperature, const GriddedField2 &cia_data, const Numeric &T_extrapolfac, const Index &robust, const Verbosity &verbosity)
Interpolate CIA data.
void resize(Index n)
Resize function.
ostream & operator<<(ostream &os, const CIARecord &)
Output operator for CIARecord.
void open_input_file(ifstream &file, const String &name)
Open a file for reading.
ConstVectorView get_numeric_grid(Index i) const
Get a numeric grid.
void ReadFromCIA(const String &filename, const Verbosity &verbosity)
Read CIA catalog file.
cmplx FADDEEVA() w(cmplx z, double relerr)
Index species_index_from_species_name(String name)
Return species index for given species name.
void SetMoleculeName(const Index i, const String &name)
Set each molecule name (from a string) that is associated with this CIARecord.
String species_name_from_species_index(const Index spec_ind)
Return species name for given species index.
Index nelem() const
Returns the number of elements.
NUMERIC Numeric
The type to use for all floating point numbers.
ArrayOfGriddedField2 mdata
The data itself, directly from the HITRAN file.
Index nelem() const
Number of elements.
Header file for interpolation_poly.cc.
void set_grid(Index i, const Vector &g)
Set a numeric grid.
CIA data for a single pair of molecules.
const Numeric SPEED_OF_LIGHT
This file contains basic functions to handle ASCII files.
INDEX Index
The type to use for all integer numbers and indices.
void gridpos_poly(ArrayOfGridPosPoly &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Index order, const Numeric &extpolfac)
Set up grid positions for higher order interpolation.
String MoleculeName(const Index i) const
Return each molecule name (as a string) that is associated with this CIARecord.
void Extract(VectorView result, ConstVectorView f_grid, const Numeric &temperature, const Index &dataset, const Numeric &T_extrapolfac, const Index &robust, const Verbosity &verbosity) const
Vector version of extract.
A constant view of a Vector.
Index cia_get_index(const ArrayOfCIARecord &cia_data, const Index sp1, const Index sp2)
Get the index in cia_data for the two given species.
Index nelem() const
Number of elements.
void interpweights(VectorView itw, const GridPos &tc)
Red 1D interpolation weights.
Header file for work with HITRAN collision induced absorption (CIA).
void resize(const GriddedField2 &gf)
Make this GriddedField2 the same size as the given one.
Index mspecies[2]
The pair of molecules associated with these CIA data.