ARTS  2.3.1285(git:92a29ea9-dirty)
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 "abs_species_tags.h"
30 #include "absorption.h"
31 #include "interpolation_poly.h"
32 #include "matpackIV.h"
33 #include "messages.h"
34 
35 // Declare existance of some classes:
36 class bifstream;
37 class bofstream;
38 class Agenda;
39 class Workspace;
40 
42 
45 class GasAbsLookup {
46  public:
48  : species(),
50  f_grid(),
51  p_grid(),
52  vmrs_ref(),
53  t_ref(),
54  t_pert(),
55  nls_pert(),
56  xsec() { /* Nothing to do here */
57  }
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  Index GetSpeciesIndex(const Index& isp) const {
81  return species[isp][0].Species();
82  }
83 
84  // IO functions must be friends:
85  friend void xml_read_from_stream(istream& is_xml,
86  GasAbsLookup& gal,
87  bifstream* pbifs,
88  const Verbosity& verbosity);
89  friend void xml_write_to_stream(ostream& os_xml,
90  const GasAbsLookup& gal,
91  bofstream* pbofs,
92  const String& name,
93  const Verbosity& verbosity);
94 
95  friend void abs_lookupCalc( // Workspace reference:
96  Workspace& ws,
97  // WS Output:
98  GasAbsLookup& abs_lookup,
99  Index& abs_lookup_is_adapted,
100  // WS Input:
101  const ArrayOfArrayOfSpeciesTag& abs_species,
102  const ArrayOfArrayOfSpeciesTag& abs_nls,
103  const Vector& f_grid,
104  const Vector& abs_p,
105  const Matrix& abs_vmrs,
106  const Vector& abs_t,
107  const Vector& abs_t_pert,
108  const Vector& abs_nls_pert,
109  const Agenda& abs_xsec_agenda,
110  // Verbosity object:
111  const Verbosity& verbosity);
112 
113  friend Numeric calc_lookup_error( // Parameters for lookup table:
114  Workspace& ws,
115  const GasAbsLookup& al,
116  const Index& abs_p_interp_order,
117  const Index& abs_t_interp_order,
118  const Index& abs_nls_interp_order,
119  const bool ignore_errors,
120  // Parameters for LBL:
121  const Agenda& abs_xsec_agenda,
122  // Parameters for both:
123  const Numeric& local_p,
124  const Numeric& local_t,
125  const Vector& local_vmrs,
126  const Verbosity& verbosity);
127 
128  friend void abs_lookupTestAccuracy( // Workspace reference:
129  Workspace& ws,
130  // WS Input:
131  const GasAbsLookup& abs_lookup,
132  const Index& abs_lookup_is_adapted,
133  const Index& abs_p_interp_order,
134  const Index& abs_t_interp_order,
135  const Index& abs_nls_interp_order,
136  const Agenda& abs_xsec_agenda,
137  // Verbosity object:
138  const Verbosity& verbosity);
139 
140  friend void abs_lookupTestAccMC( // Workspace reference:
141  Workspace& ws,
142  // WS Input:
143  const GasAbsLookup& abs_lookup,
144  const Index& abs_lookup_is_adapted,
145  const Index& abs_p_interp_order,
146  const Index& abs_t_interp_order,
147  const Index& abs_nls_interp_order,
148  const Index& mc_seed,
149  const Agenda& abs_xsec_agenda,
150  // Verbosity object:
151  const Verbosity& verbosity);
152 
153  friend void nca_read_from_file(const int ncid,
154  GasAbsLookup& gal,
155  const Verbosity&);
156 
157  friend void nca_write_to_file(const int ncid,
158  const GasAbsLookup& gal,
159  const Verbosity&);
160 
163 
166 
168  Vector& Fgrid() {return f_grid;}
169 
172 
174  Vector& Pgrid() {return p_grid;}
175 
178 
180  Matrix& VMRs() {return vmrs_ref;}
181 
183  Vector& Tref() {return t_ref;}
184 
186  Vector& Tpert() {return t_pert;}
187 
189  Vector& NLSPert() {return nls_pert;}
190 
192  Tensor4& Xsec() {return xsec;}
193 
194  private:
197 
199 
206 
208 
210 
212 
220 
222 
224 
226 
232 
234 
242 
244 
247 
249 
261 
263 
276 
278 
310 };
311 
312 ostream& operator<<(ostream& os, const GasAbsLookup& gal);
313 
314 #endif // gas_abs_lookup_h
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
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:60
Matrix & VMRs()
The reference VMR profiles.
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.
Vector & NLSPert()
The vector of perturbations for the VMRs of the nonlinear species.
The Vector class.
Definition: matpackI.h:860
Vector & Fgrid()
The frequency grid [Hz].
The Tensor4 class.
Definition: matpackIV.h:421
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.
Vector & Tpert()
The vector of temperature perturbations [K].
void Adapt(const ArrayOfArrayOfSpeciesTag &current_species, ConstVectorView current_f_grid, const Verbosity &verbosity)
Adapt lookup table to current calculation.
Index GetSpeciesIndex(const Index &isp) const
Vector log_p_grid
The natural log of the pressure grid.
Vector & Pgrid()
The pressure grid for the table [Pa].
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].
ArrayOfGridPosPoly & FGPDefault()
Frequency grid positions.
Binary output file stream class.
Definition: bifstream.h:42
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.
ArrayOfArrayOfSpeciesTag & Species()
The species tags for which the table is valid.
ArrayOfIndex & NonLinearSpecies()
The species tags with non-linear treatment.
const Vector & GetFgrid() const
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
The Matrix class.
Definition: matpackI.h:1193
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:476
Header file for stuff related to absorption species tags.
Binary output file stream class.
Definition: bofstream.h:42
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:40
ArrayOfGridPosPoly fgp_default
Frequency grid positions.
Vector & LogPgrid()
The natural log of the pressure grid.
Tensor4 & Xsec()
Absorption cross sections.
Vector & Tref()
The reference temperature profile [K].
ArrayOfArrayOfSpeciesTag species
The species tags for which the table is valid.
ostream & operator<<(ostream &os, const GasAbsLookup &gal)
Output operatior for GasAbsLookup.