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
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:35
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
The Agenda class.
Definition: agenda_class.h:44
Vector nls_pert
The vector of perturbations for the VMRs of the nonlinear species.
Vector t_pert
The vector of temperature perturbations [K].
Declarations having to do with the four output streams.
The Vector class.
Definition: matpackI.h:556
The Tensor4 class.
Definition: matpackIV.h:383
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.
friend void xml_read_from_stream(istream &is_xml, GasAbsLookup &gal, bifstream *pbifs, const Verbosity &verbosity)
Reads GasAbsLookup from XML input stream.
ArrayOfIndex nonlinear_species
The species tags with non-linear treatment.
void Adapt(const ArrayOfArrayOfSpeciesTag &current_species, ConstVectorView current_f_grid, const Verbosity &verbosity)
Adapt lookup table to current calculation.
Vector log_p_grid
The natural log of the pressure grid.
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.
Tensor4 xsec
Absorption cross sections.
Matrix vmrs_ref
The reference VMR profiles.
Vector f_grid
The frequency grid [Hz].
Binary output file stream class.
Definition: bifstream.h:44
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.
friend void nca_write_to_file(const int ncid, const GasAbsLookup &gal, const Verbosity &)
Writes a GasAbsLookup table to a NetCDF file.
An absorption lookup table.
const Vector & GetFgrid() const
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:29
The Matrix class.
Definition: matpackI.h:788
Declarations required for the calculation of absorption coefficients.
Vector t_ref
The reference temperature profile [K].
Vector p_grid
The pressure grid for the table [Pa].
This can be used to make arrays out of anything.
Definition: array.h:40
Header file for interpolation_poly.cc.
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.
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.
A constant view of a Vector.
Definition: matpackI.h:292
Header file for stuff related to absorption species tags.
Binary output file stream class.
Definition: bofstream.h:44
const Vector & GetPgrid() const
friend void nca_read_from_file(const int ncid, GasAbsLookup &gal, const Verbosity &)
Reads a GasAbsLookup table from a NetCDF file.
Workspace class.
Definition: workspace_ng.h:47
ArrayOfGridPosPoly fgp_default
Frequency grid positions.
ArrayOfArrayOfSpeciesTag species
The species tags for which the table is valid.
ostream & operator<<(ostream &os, const GasAbsLookup &gal)
Output operatior for GasAbsLookup.