ARTS 2.5.9 (git: 825fa5f2)
fastem.cc
Go to the documentation of this file.
1/* Copyright (C) 2002-2012
2 Sreerekha Ravi<rekha@sat.physik.uni-bremen.de>
3 Stefan Buehler <sbuehler@ltu.se>
4
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any
8 later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
18 USA.
19*/
20
30/*===========================================================================
31 === External declarations
32 ===========================================================================*/
33
34#include <cmath>
35#include <stdexcept>
36#include "arts_constants.h"
37#include "arts_conversions.h"
38#include "matpack_complex.h"
39#include "exceptions.h"
40#include "matpackI.h"
41
42using std::ostringstream;
43using std::runtime_error;
44
45inline constexpr Numeric PI=Constant::pi;
48
49#ifdef ENABLE_FASTEM
50extern "C" {
51#endif
52
53void rttov_fastem5_(const Index& fastem_version,
54 const Numeric& frequency,
55 const Numeric& za,
56 const Numeric& temperature,
57 const Numeric& salinity,
58 const Numeric& wind_speed,
59 Numeric* emissivity,
60 Numeric* reflectivity,
61 const Numeric& transmittance,
62 const Numeric& rel_azimuth);
63
64#ifdef ENABLE_FASTEM
65}
66#endif
67
68// Define dummy function that throws a runtime error if ARTS is
69// compiled without FASTEM support.
70#ifndef ENABLE_FASTEM
72 const Numeric&,
73 const Numeric&,
74 const Numeric&,
75 const Numeric&,
76 const Numeric&,
77 Numeric*,
78 Numeric*,
79 const Numeric&,
80 const Numeric&) {
81 throw std::runtime_error(
82 "This version of ARTS was compiled without FASTEM support.");
83}
84
85#endif
86
88
109void fastem( // Output:
110 Vector& emissivity,
111 Vector& reflectivity,
112 // Input:
113 const Numeric frequency,
114 const Numeric za,
115 const Numeric temperature,
116 const Numeric salinity,
117 const Numeric wind_speed,
118 const Numeric transmittance,
119 const Numeric rel_azimuth,
120 const Index fastem_version) {
121 emissivity.resize(4);
122 reflectivity.resize(4);
123
124 rttov_fastem5_(fastem_version,
125 frequency / 1e9,
126 180 - za,
127 temperature,
128 salinity * 1e3,
129 wind_speed,
130 emissivity.get_c_array(),
131 reflectivity.get_c_array(),
132 transmittance,
133 rel_azimuth);
134}
Constants of physical expressions as constexpr.
Common ARTS conversions.
Numeric * get_c_array() const noexcept
Conversion to plain C-array, const-version.
Definition: matpackI.h:633
The Vector class.
Definition: matpackI.h:910
void resize(Index n)
Resize function.
Definition: matpackI.cc:390
The declarations of all the exception classes.
constexpr Numeric DEG2RAD
Definition: fastem.cc:46
void rttov_fastem5_(const Index &fastem_version, const Numeric &frequency, const Numeric &za, const Numeric &temperature, const Numeric &salinity, const Numeric &wind_speed, Numeric *emissivity, Numeric *reflectivity, const Numeric &transmittance, const Numeric &rel_azimuth)
Definition: fastem.cc:71
constexpr Numeric RAD2DEG
Definition: fastem.cc:47
void fastem(Vector &emissivity, Vector &reflectivity, const Numeric frequency, const Numeric za, const Numeric temperature, const Numeric salinity, const Numeric wind_speed, const Numeric transmittance, const Numeric rel_azimuth, const Index fastem_version)
Calculate the surface emissivity using FASTEM.
Definition: fastem.cc:109
constexpr Numeric PI
Definition: fastem.cc:45
Implementation of Matrix, Vector, and such stuff.
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
constexpr Numeric pi
The following mathematical constants are generated in python Decimal package by the code:
constexpr auto deg2rad(auto x) noexcept
Converts degrees to radians.
constexpr auto rad2deg(auto x) noexcept
Converts radians to degrees.