ARTS  2.2.66
gas_abs_lookup.h
Go to the documentation of this file.
1 /* Copyright (C) 2002-2012 Stefan Buehler <sbuehler@ltu.se>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA. */
17 
26 #ifndef gas_abs_lookup_h
27 #define gas_abs_lookup_h
28 
29 #include "matpackIV.h"
30 #include "absorption.h"
31 #include "abs_species_tags.h"
32 #include "messages.h"
33 #include "interpolation_poly.h"
34 
35 
36 // Declare existance of some classes:
37 class bifstream;
38 class bofstream;
39 class Agenda;
40 class Workspace;
41 
43 
46 class GasAbsLookup {
47 public:
50  f_grid(),
51  p_grid(),
52  vmrs_ref(),
53  t_ref(),
54  t_pert(),
55  nls_pert(),
56  xsec()
57  { /* Nothing to do here */ }
58 
59  // Documentation is with the implementation!
60  void Adapt( const ArrayOfArrayOfSpeciesTag& current_species,
61  ConstVectorView current_f_grid,
62  const Verbosity& verbosity );
63 
64  // Documentation is with the implementation!
65  void Extract( Matrix& sga,
66  const Index& p_interp_order,
67  const Index& t_interp_order,
68  const Index& h2o_interp_order,
69  const Index& f_interp_order,
70  const Numeric& p,
71  const Numeric& T,
72  ConstVectorView abs_vmrs,
73  ConstVectorView new_f_grid,
74  const Numeric& extpolfac ) const;
75 
76  const Vector& GetFgrid() const;
77 
78  const Vector& GetPgrid() const;
79 
80  // IO functions must be friends:
81  friend void xml_read_from_stream( istream& is_xml,
82  GasAbsLookup& gal,
83  bifstream *pbifs,
84  const Verbosity& verbosity);
85  friend void xml_write_to_stream ( ostream& os_xml,
86  const GasAbsLookup& gal,
87  bofstream *pbofs,
88  const String& name,
89  const Verbosity& verbosity);
90 
91  friend void abs_lookupCalc(// Workspace reference:
92  Workspace& ws,
93  // WS Output:
94  GasAbsLookup& abs_lookup,
95  Index& abs_lookup_is_adapted,
96  // WS Input:
97  const ArrayOfArrayOfSpeciesTag& abs_species,
98  const ArrayOfArrayOfSpeciesTag& abs_nls,
99  const Vector& f_grid,
100  const Vector& abs_p,
101  const Matrix& abs_vmrs,
102  const Vector& abs_t,
103  const Vector& abs_t_pert,
104  const Vector& abs_nls_pert,
105  const Agenda& abs_xsec_agenda,
106  // Verbosity object:
107  const Verbosity& verbosity);
108 
109  friend Numeric calc_lookup_error(// Parameters for lookup table:
110  Workspace& ws,
111  const GasAbsLookup& al,
112  const Index& abs_p_interp_order,
113  const Index& abs_t_interp_order,
114  const Index& abs_nls_interp_order,
115  const bool ignore_errors,
116  // Parameters for LBL:
117  const Agenda& abs_xsec_agenda,
118  // Parameters for both:
119  const Numeric& local_p,
120  const Numeric& local_t,
121  const Vector& local_vmrs,
122  const Verbosity& verbosity);
123 
124  friend void abs_lookupTestAccuracy(// Workspace reference:
125  Workspace& ws,
126  // WS Input:
127  const GasAbsLookup& abs_lookup,
128  const Index& abs_lookup_is_adapted,
129  const Index& abs_p_interp_order,
130  const Index& abs_t_interp_order,
131  const Index& abs_nls_interp_order,
132  const Agenda& abs_xsec_agenda,
133  // Verbosity object:
134  const Verbosity& verbosity);
135 
136  friend void abs_lookupTestAccMC(// Workspace reference:
137  Workspace& ws,
138  // WS Input:
139  const GasAbsLookup& abs_lookup,
140  const Index& abs_lookup_is_adapted,
141  const Index& abs_p_interp_order,
142  const Index& abs_t_interp_order,
143  const Index& abs_nls_interp_order,
144  const Index& mc_seed,
145  const Agenda& abs_xsec_agenda,
146  // Verbosity object:
147  const Verbosity& verbosity);
148 
149  friend void nca_read_from_file(const int ncid, GasAbsLookup& gal, const Verbosity&);
150 
151  friend void nca_write_to_file(const int ncid, const GasAbsLookup& gal, const Verbosity&);
152 
153 private:
154 
157 
159 
166 
168 
170 
172 
180 
182 
184 
186 
192 
194 
202 
204 
207 
209 
221 
223 
236 
238 
270 
271 };
272 
273 
274 ostream& operator<< (ostream& os, const GasAbsLookup& gal);
275 
276 #endif // gas_abs_lookup_h
Matrix
The Matrix class.
Definition: matpackI.h:788
GasAbsLookup::GetPgrid
const Vector & GetPgrid() const
Definition: gas_abs_lookup.cc:1235
GasAbsLookup::nca_write_to_file
friend void nca_write_to_file(const int ncid, const GasAbsLookup &gal, const Verbosity &)
Writes a GasAbsLookup table to a NetCDF file.
Definition: nc_io_compound_types.cc:74
GasAbsLookup::GetFgrid
const Vector & GetFgrid() const
Definition: gas_abs_lookup.cc:1229
GasAbsLookup::nonlinear_species
ArrayOfIndex nonlinear_species
The species tags with non-linear treatment.
Definition: gas_abs_lookup.h:165
absorption.h
Declarations required for the calculation of absorption coefficients.
GasAbsLookup::Extract
void Extract(Matrix &sga, const Index &p_interp_order, const Index &t_interp_order, const Index &h2o_interp_order, const Index &f_interp_order, const Numeric &p, const Numeric &T, ConstVectorView abs_vmrs, ConstVectorView new_f_grid, const Numeric &extpolfac) const
Extract scalar gas absorption coefficients from the lookup table.
Definition: gas_abs_lookup.cc:593
Tensor4
The Tensor4 class.
Definition: matpackIV.h:383
Agenda
The Agenda class.
Definition: agenda_class.h:44
GasAbsLookup
An absorption lookup table.
Definition: gas_abs_lookup.h:46
matpackIV.h
Array
This can be used to make arrays out of anything.
Definition: array.h:107
GasAbsLookup::calc_lookup_error
friend Numeric calc_lookup_error(Workspace &ws, const GasAbsLookup &al, const Index &abs_p_interp_order, const Index &abs_t_interp_order, const Index &abs_nls_interp_order, const bool ignore_errors, const Agenda &abs_xsec_agenda, const Numeric &local_p, const Numeric &local_t, const Vector &local_vmrs, const Verbosity &verbosity)
Compare lookup and LBL calculation.
Definition: m_abs_lookup.cc:2344
messages.h
Declarations having to do with the four output streams.
GasAbsLookup::abs_lookupCalc
friend void abs_lookupCalc(Workspace &ws, GasAbsLookup &abs_lookup, Index &abs_lookup_is_adapted, const ArrayOfArrayOfSpeciesTag &abs_species, const ArrayOfArrayOfSpeciesTag &abs_nls, const Vector &f_grid, const Vector &abs_p, const Matrix &abs_vmrs, const Vector &abs_t, const Vector &abs_t_pert, const Vector &abs_nls_pert, const Agenda &abs_xsec_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lookupCalc.
Definition: m_abs_lookup.cc:63
my_basic_string
The implementation for String, the ARTS string class.
Definition: mystring.h:64
GasAbsLookup::t_ref
Vector t_ref
The reference temperature profile [K].
Definition: gas_abs_lookup.h:206
GasAbsLookup::f_grid
Vector f_grid
The frequency grid [Hz].
Definition: gas_abs_lookup.h:169
GasAbsLookup::p_grid
Vector p_grid
The pressure grid for the table [Pa].
Definition: gas_abs_lookup.h:183
GasAbsLookup::GasAbsLookup
GasAbsLookup()
Definition: gas_abs_lookup.h:48
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:29
Verbosity
Definition: messages.h:50
GasAbsLookup::abs_lookupTestAccuracy
friend void abs_lookupTestAccuracy(Workspace &ws, const GasAbsLookup &abs_lookup, const Index &abs_lookup_is_adapted, const Index &abs_p_interp_order, const Index &abs_t_interp_order, const Index &abs_nls_interp_order, const Agenda &abs_xsec_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lookupTestAccuracy.
Definition: m_abs_lookup.cc:2462
GasAbsLookup::nca_read_from_file
friend void nca_read_from_file(const int ncid, GasAbsLookup &gal, const Verbosity &)
Reads a GasAbsLookup table from a NetCDF file.
Definition: nc_io_compound_types.cc:51
bifstream
Binary output file stream class.
Definition: bifstream.h:45
GasAbsLookup::fgp_default
ArrayOfGridPosPoly fgp_default
Frequency grid positions.
Definition: gas_abs_lookup.h:179
GasAbsLookup::nls_pert
Vector nls_pert
The vector of perturbations for the VMRs of the nonlinear species.
Definition: gas_abs_lookup.h:235
GasAbsLookup::xsec
Tensor4 xsec
Absorption cross sections.
Definition: gas_abs_lookup.h:269
abs_species_tags.h
Header file for stuff related to absorption species tags.
interpolation_poly.h
Header file for interpolation_poly.cc.
GasAbsLookup::species
ArrayOfArrayOfSpeciesTag species
The species tags for which the table is valid.
Definition: gas_abs_lookup.h:156
GasAbsLookup::abs_lookupTestAccMC
friend void abs_lookupTestAccMC(Workspace &ws, const GasAbsLookup &abs_lookup, const Index &abs_lookup_is_adapted, const Index &abs_p_interp_order, const Index &abs_t_interp_order, const Index &abs_nls_interp_order, const Index &mc_seed, const Agenda &abs_xsec_agenda, const Verbosity &verbosity)
WORKSPACE METHOD: abs_lookupTestAccMC.
Definition: m_abs_lookup.cc:2800
GasAbsLookup::log_p_grid
Vector log_p_grid
The natural log of the pressure grid.
Definition: gas_abs_lookup.h:191
Workspace
Workspace class.
Definition: workspace_ng.h:47
GasAbsLookup::Adapt
void Adapt(const ArrayOfArrayOfSpeciesTag &current_species, ConstVectorView current_f_grid, const Verbosity &verbosity)
Adapt lookup table to current calculation.
Definition: gas_abs_lookup.cc:124
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:35
operator<<
ostream & operator<<(ostream &os, const GasAbsLookup &gal)
Output operatior for GasAbsLookup.
Definition: gas_abs_lookup.cc:1242
GasAbsLookup::vmrs_ref
Matrix vmrs_ref
The reference VMR profiles.
Definition: gas_abs_lookup.h:201
GasAbsLookup::t_pert
Vector t_pert
The vector of temperature perturbations [K].
Definition: gas_abs_lookup.h:220
GasAbsLookup::xml_write_to_stream
friend void xml_write_to_stream(ostream &os_xml, const GasAbsLookup &gal, bofstream *pbofs, const String &name, const Verbosity &verbosity)
Writes GasAbsLookup to XML output stream.
Definition: xml_io_compound_types.cc:169
Vector
The Vector class.
Definition: matpackI.h:556
ConstVectorView
A constant view of a Vector.
Definition: matpackI.h:292
GasAbsLookup::xml_read_from_stream
friend void xml_read_from_stream(istream &is_xml, GasAbsLookup &gal, bifstream *pbifs, const Verbosity &verbosity)
Reads GasAbsLookup from XML input stream.
Definition: xml_io_compound_types.cc:138
bofstream
Binary output file stream class.
Definition: bofstream.h:45