#include <math.h>
#include <stdexcept>
#include "arts.h"
#include "matpackI.h"
#include "messages.h"
#include "math_funcs.h"
#include "make_vector.h"
Go to the source code of this file.
Functions | |
void | planck (MatrixView B, ConstVectorView f, ConstVectorView t) |
Calculates a blackbody radiation (the Planck function) matrix. | |
void | planck (VectorView B, ConstVectorView f, Numeric t) |
Calculates the Planck function for a single temperature. | |
void | invplanck (VectorView y, ConstVectorView f, ConstVectorView za) |
Converts a vector with radiances to Plack brightness temperatures. | |
void | invrayjean (VectorView y, ConstVectorView f, ConstVectorView za) |
Converts a vector with radiances to Rayleigh-Jean brightness temperatures. | |
Numeric | number_density (Numeric p, Numeric t) |
Calculates the number density (scalar version). | |
Vector | number_density (ConstVectorView p, ConstVectorView t) |
Calculates the number density (vector version). | |
Numeric | g_of_z (Numeric r_geoid, Numeric g0, Numeric z) |
Calculates the gravitational accelaration for a geometrical altitude. | |
Numeric | g_of_lat (Numeric latitude) |
Calculates the gravitational accelaration for a geocentric latitude. | |
void | rte_iterate (VectorView y, const Index start_index, const Index stop_index, ConstMatrixView tr, ConstMatrixView s, const Index n_f) |
Performs a single iteration for RTE calculations (one zenith angle). | |
void | rte (VectorView y, const Index start_index, const Index stop_index, ConstMatrixView tr, ConstMatrixView s, ConstVectorView y_space, const Index ground, ConstVectorView e_ground, ConstVectorView y_ground) |
Performs the RTE calculations for one zenith angle. | |
void | bl_iterate (VectorView y, const Index start_index, const Index stop_index, ConstMatrixView tr, const Index n_f) |
Performs a single iteration for BL calculations (one zenith angle). | |
void | bl (Vector &y, const Index start_index, const Index stop_index, ConstMatrixView tr, const Index ground, ConstVectorView e_ground) |
Performs the BL (transmission) calculations for one zenith angle. | |
void | z2p (VectorView p, ConstVectorView z0, ConstVectorView p0, ConstVectorView z) |
Converts an altitude vector to pressures. | |
void | interpp (VectorView x, ConstVectorView p0, ConstVectorView x0, ConstVectorView p) |
Interpolates a vertical profile at a new set of pressures. | |
void | interpp_cloud (VectorView x, ConstVectorView p0, ConstVectorView x0, ConstVectorView p) |
void | interpp (MatrixView A, ConstVectorView p0, ConstMatrixView A0, ConstVectorView p) |
Interpolates a matrix, such as an absorption matrix, at a new set of pressures. | |
Numeric | interpp (ConstVectorView p0, ConstVectorView x0, const Numeric p) |
Interpolates a vertical profile at one pressure level. | |
void | interpz (VectorView x, ConstVectorView p0, ConstVectorView z0, ConstVectorView x0, ConstVectorView z) |
Interpolates a vertical profile at a new set of vertical altitudes. | |
Numeric | interpz (ConstVectorView p0, ConstVectorView z0, ConstVectorView x0, const Numeric z) |
Interpolates a vertical profile at a single vertical altitude. | |
Numeric | ztan_geom (const Numeric za, const Numeric z_plat, const Numeric r_geoid) |
Calculates the geometrical tangent altitude (no refraction). | |
Numeric | n_for_z (const Numeric z, ConstVectorView p_abs, ConstVectorView z_abs, ConstVectorView refr_index, const Numeric atm_limit) |
Returns the refractive index for a vertical altitude. | |
Numeric | refr_constant (const Numeric r_geoid, const Numeric za, const Numeric z_plat, ConstVectorView p_abs, ConstVectorView z_abs, const Numeric atm_limit, ConstVectorView refr_index) |
Determines the constant for a refractive LOS. | |
Numeric | ztan_refr (const Numeric c, const Numeric za, const Numeric z_plat, const Numeric z_ground, ConstVectorView p_abs, ConstVectorView z_abs, ConstVectorView refr_index, const Numeric r_geoid) |
Calculates the tangent altitude with refraction. | |
void | e_eq_water (VectorView e_eq, ConstVectorView t) |
Calculates the equilibrium water vapor pressure over liquid water. | |
void | e_eq_ice (VectorView e_eq, ConstVectorView t) |
Calculates the equilibrium water vapor pressure over ice. | |
Variables | |
const Numeric | DEG2RAD |
const Numeric | RAD2DEG |
const Numeric | PLANCK_CONST |
const Numeric | SPEED_OF_LIGHT |
const Numeric | BOLTZMAN_CONST |
Definition in file atm_funcs.cc.
void bl | ( | Vector & | y, | |
const Index | start_index, | |||
const Index | stop_index, | |||
ConstMatrixView | tr, | |||
const Index | ground, | |||
ConstVectorView | e_ground | |||
) |
Performs the BL (transmission) calculations for one zenith angle.
This function allows calculation of transmission spectra for single zenith angles in functions beside yBlXx.
y | the spectrum |
start_index | start index for the integration | |
stop_index | stop index for the integration | |
Tr | transmission matrix | |
ground | flag/index for ground intersection | |
e_ground | ground emissivity |
Definition at line 560 of file atm_funcs.cc.
void bl_iterate | ( | VectorView | y, | |
const Index | start_index, | |||
const Index | stop_index, | |||
ConstMatrixView | tr, | |||
const Index | n_f | |||
) |
Performs a single iteration for BL calculations (one zenith angle).
The vector Y is not initilised, Y is multiplied with the obtained values. Note that only a single iteration is performed.
This function can be used to calculate transmissions for parts of the atmosphere.
y | the spectrum |
start_index | start index for the integration | |
stop_index | stop index for the integration | |
Tr | transmission matrix | |
S | source function matrix | |
n_f | number of frequencies |
Definition at line 518 of file atm_funcs.cc.
void e_eq_ice | ( | VectorView | e_eq, | |
ConstVectorView | t | |||
) |
Calculates the equilibrium water vapor pressure over ice.
Calculation is done using Sontag's formula. Sonntag, D., Advancements in the field of hygrometry, Meteorologische Zeitschrift, 3, 51-66, 1994.
Sontag's formula:
e_eq = exp( a/T + b + c*T + d*T^2 + e*log(T) )
e_eq | equilibrium water vapor pressure in [Pa] |
t | a temperature value in [K] |
Definition at line 1038 of file atm_funcs.cc.
void e_eq_water | ( | VectorView | e_eq, | |
ConstVectorView | t | |||
) |
Calculates the equilibrium water vapor pressure over liquid water.
Calculation is done using Sontag's formula. Sonntag, D., Advancements in the field of hygrometry, Meteorologische Zeitschrift, 3, 51-66, 1994.
Sontag's formula:
e_eq = exp( a/T + b + c*T + d*T^2 + e*log(T) )
e_eq | equilibrium water vapor pressure in [Pa] |
t | a temperature value in [K] |
Definition at line 998 of file atm_funcs.cc.
Calculates the gravitational accelaration for a geocentric latitude.
lat | geocentric latitude |
Definition at line 340 of file atm_funcs.cc.
Calculates the gravitational accelaration for a geometrical altitude.
r_geoid | radius of the geoid | |
g0 | the gravitational constant at the geoid surface | |
z | geometrical altitude |
Definition at line 322 of file atm_funcs.cc.
Numeric interpp | ( | ConstVectorView | p0, | |
ConstVectorView | x0, | |||
const Numeric | p | |||
) |
Interpolates a vertical profile at one pressure level.
See the vector version.
x | output: the interpolated values at p |
p0 | original pressure grid | |
x0 | the profile to be interpolated | |
p | a pressure level |
Definition at line 739 of file atm_funcs.cc.
void interpp | ( | MatrixView | A, | |
ConstVectorView | p0, | |||
ConstMatrixView | A0, | |||
ConstVectorView | p | |||
) |
Interpolates a matrix, such as an absorption matrix, at a new set of pressures.
A linear interpolation using log. pressure is applied. In Matlab notation, the following expression is used:
A = interp1(log(p0),A0,log(p),'linear')
A | output: the interpolated values at p |
p0 | original pressure grid | |
A0 | the matrix to be interpolated | |
p | new pressure grid |
Definition at line 705 of file atm_funcs.cc.
void interpp | ( | VectorView | x, | |
ConstVectorView | p0, | |||
ConstVectorView | x0, | |||
ConstVectorView | p | |||
) |
Interpolates a vertical profile at a new set of pressures.
A linear interpolation using log. pressure is applied. In Matlab notation, the following expression is used:
p = interp1(log(p0),x,log(p),'linear')
x | output: the interpolated values at p |
p0 | original pressure grid | |
x0 | the profile to be interpolated | |
p | new pressure grid |
Definition at line 658 of file atm_funcs.cc.
void interpp_cloud | ( | VectorView | x, | |
ConstVectorView | p0, | |||
ConstVectorView | x0, | |||
ConstVectorView | p | |||
) |
Definition at line 675 of file atm_funcs.cc.
Numeric interpz | ( | ConstVectorView | p0, | |
ConstVectorView | z0, | |||
ConstVectorView | x0, | |||
const Numeric | z | |||
) |
Interpolates a vertical profile at a single vertical altitude.
NOTE!! Avoid to use this function, interpolation should mainly be done in pressure, that is, use interpp when possible.
This function uses z2p and interpp to make an interpolation for a vertical altitude.
Used mainly for LOS calculations with refraction.
x | output: the interpolated values at z |
p0 | original pressure grid | |
z0 | original vertical altitude grid | |
x0 | the profile to be interpolated | |
z | new vertical altitude grid |
Definition at line 810 of file atm_funcs.cc.
void interpz | ( | VectorView | x, | |
ConstVectorView | p0, | |||
ConstVectorView | z0, | |||
ConstVectorView | x0, | |||
ConstVectorView | z | |||
) |
Interpolates a vertical profile at a new set of vertical altitudes.
NOTE!! Avoid to use this function, interpolation should mainly be done in pressure, that is, use interpp when possible.
This function uses z2p and interpp to make an interpolation for vertical altitudes.
Used mainly for LOS calculations with refraction.
x | output: the interpolated values at z |
p0 | original pressure grid | |
z0 | original vertical altitude grid | |
x0 | the profile to be interpolated | |
z | new vertical altitude grid |
Definition at line 774 of file atm_funcs.cc.
void invplanck | ( | VectorView | y, | |
ConstVectorView | f, | |||
ConstVectorView | za | |||
) |
Converts a vector with radiances to Plack brightness temperatures.
y | spectrum vector |
f | frequencies | |
za | zenith angles |
Definition at line 145 of file atm_funcs.cc.
void invrayjean | ( | VectorView | y, | |
ConstVectorView | f, | |||
ConstVectorView | za | |||
) |
Converts a vector with radiances to Rayleigh-Jean brightness temperatures.
y | spectrum vector |
f | frequencies | |
za | zenith angles |
Definition at line 202 of file atm_funcs.cc.
Numeric n_for_z | ( | const Numeric | z, | |
ConstVectorView | p_abs, | |||
ConstVectorView | z_abs, | |||
ConstVectorView | refr_index, | |||
const Numeric | atm_limit | |||
) |
Returns the refractive index for a vertical altitude.
The refractive index is set to 1 if the given altitude is above the atmospheric limit.
z | the vertical altitude | |
p_abs | absorption pressure grid | |
z_abs | absorption altitude grid | |
refr_index | refrective index corresponding to p_refr | |
atm_limit | the upper atmospheric limit |
Definition at line 871 of file atm_funcs.cc.
Vector number_density | ( | ConstVectorView | p, | |
ConstVectorView | t | |||
) |
Calculates the number density (vector version).
p | pressure | |
t | temperature |
Definition at line 291 of file atm_funcs.cc.
Calculates the number density (scalar version).
p | pressure | |
t | temperature |
Definition at line 270 of file atm_funcs.cc.
void planck | ( | VectorView | B, | |
ConstVectorView | f, | |||
Numeric | t | |||
) |
Calculates the Planck function for a single temperature.
B | output: the blackbody radiation |
f | a frequency grid | |
t | a temperature value |
Definition at line 114 of file atm_funcs.cc.
void planck | ( | MatrixView | B, | |
ConstVectorView | f, | |||
ConstVectorView | t | |||
) |
Calculates a blackbody radiation (the Planck function) matrix.
Each row of the returned matrix corresponds to a frequency, while each column corresponds to a temperature.
B | output: the blackbody radiation |
f | a frequency grid | |
t | a temperature profile |
Definition at line 75 of file atm_funcs.cc.
Numeric refr_constant | ( | const Numeric | r_geoid, | |
const Numeric | za, | |||
const Numeric | z_plat, | |||
ConstVectorView | p_abs, | |||
ConstVectorView | z_abs, | |||
const Numeric | atm_limit, | |||
ConstVectorView | refr_index | |||
) |
Determines the constant for a refractive LOS.
Calculates (Re+z)*n(z)*sin(theta) at the platform.
All observations geometries are handled. The variables za and z_plat shall be treated as the "zenith angle" and the vertical altitude of the lowest point of the LOS.
r_geoid | local geoid curvature | |
za | zenith angle | |
z_plat | platform altitude | |
p_abs | absorption pressure grid | |
z_abs | absorption altitude grid | |
atm_limit | the upper atmospheric limit | |
refr_index | refrective index corresponding to p_refr |
Definition at line 908 of file atm_funcs.cc.
void rte | ( | VectorView | y, | |
const Index | start_index, | |||
const Index | stop_index, | |||
ConstMatrixView | tr, | |||
ConstMatrixView | s, | |||
ConstVectorView | y_space, | |||
const Index | ground, | |||
ConstVectorView | e_ground, | |||
ConstVectorView | y_ground | |||
) |
Performs the RTE calculations for one zenith angle.
This function allows calculation of emission spectra for single zenith angles in function beside yRteXx.
y | the spectrum |
start_index | start index for the integration | |
stop_index | stop index for the integration | |
Tr | transmission matrix | |
S | source function matrix | |
y_space | intensity entering the atmosphre at start of LOS | |
ground | flag/index for ground intersection | |
e_ground | ground emissivity | |
y_ground | ground blackbody radiation |
Definition at line 433 of file atm_funcs.cc.
void rte_iterate | ( | VectorView | y, | |
const Index | start_index, | |||
const Index | stop_index, | |||
ConstMatrixView | tr, | |||
ConstMatrixView | s, | |||
const Index | n_f | |||
) |
Performs a single iteration for RTE calculations (one zenith angle).
The vector Y is not initilised, the obtained values are added to Y. Note that only a single iteration is performed.
This function can be used to calculate emission spectra for parts of the atmosphere.
y | the spectrum |
start_index | start index for the integration | |
stop_index | stop index for the integration | |
Tr | transmission matrix | |
S | source function matrix | |
n_f | number of frequencies |
Definition at line 386 of file atm_funcs.cc.
void z2p | ( | VectorView | p, | |
ConstVectorView | z0, | |||
ConstVectorView | p0, | |||
ConstVectorView | z | |||
) |
Converts an altitude vector to pressures.
The log of the pressures are interpolated linearly. In Matlab notation:
p = exp(interp1(z0,log(p0),z,'linear'))
p | output: the pressures at z |
z0 | original altitude grid | |
p0 | original pressure grid | |
z | new altitude grid |
Definition at line 621 of file atm_funcs.cc.
Calculates the geometrical tangent altitude (no refraction).
za | the angle between zenith and the LOS | |
z_plat | the platform altitude |
Definition at line 839 of file atm_funcs.cc.
Numeric ztan_refr | ( | const Numeric | c, | |
const Numeric | za, | |||
const Numeric | z_plat, | |||
const Numeric | z_ground, | |||
ConstVectorView | p_abs, | |||
ConstVectorView | z_abs, | |||
ConstVectorView | refr_index, | |||
const Numeric | r_geoid | |||
) |
Calculates the tangent altitude with refraction.
c | LOS constant | |
za | the angle between zenith and the LOS | |
z_plat | the platform altitude | |
z_ground | the ground altitude | |
p_abs | absorption pressure grid | |
z_abs | absorption altitude grid | |
refr_index | refrective index corresponding to p_abs |
Definition at line 940 of file atm_funcs.cc.
const Numeric BOLTZMAN_CONST |
const Numeric PLANCK_CONST |
const Numeric SPEED_OF_LIGHT |