46 const Index n = sa_grid.nelem();
57 transform(sterm, sin, sterm);
59 transform(cterm, cos, cterm);
63 for (Index i=0; i<n; ++i) {
64 f1[i] = sterm[i] * pfun[i];
65 f2[i] = cterm[i] * f1[i];
69 const Numeric normfac =
trapz(sa, f1);
71 if (normfac < 1e-12) {
74 return trapz(sa, f2) / normfac;
83 const Numeric& x_fit_start,
84 const Numeric& x_fit_end) {
85 const Index nse = x.nelem();
89 Vector x_unsorted(nse), m_unsorted(nse);
93 for (Index i = 0; i < nse; i++) {
95 throw runtime_error(
"NaN found in selected size grid data.");
96 if (std::isnan(mass[i]))
97 throw runtime_error(
"NaN found among particle mass data.");
99 if (x[i] >= x_fit_start && x[i] <= x_fit_end) {
100 x_unsorted[nsev] = x[i];
101 m_unsorted[nsev] = mass[i];
108 "Less than two size points found in the range "
109 "[x_fit_start,x_fit_end]. It is then not possible "
110 "to determine the a and b parameters.");
113 Vector log_x(nsev), log_m(nsev);
115 for (Index i = 0; i < nsev; i++) {
116 log_x[i] = log(x_unsorted[intarr_sort[i]]);
117 log_m[i] = log(m_unsorted[intarr_sort[i]]);
120 linreg(q, log_x, log_m);
The global header file for ARTS.
Constants of physical expressions as constexpr.
Internal cloudbox functions.
#define ARTS_ASSERT(condition,...)
Numeric trapz(ConstVectorView x, ConstVectorView y)
trapz
Workspace functions for the solution of cloud-box radiative transfer by Monte Carlo methods....
Declarations having to do with the four output streams.
Numeric asymmetry_parameter(ConstVectorView sa_grid, ConstVectorView pfun)
asymmetry_parameter
constexpr Numeric DEG2RAD
constexpr Numeric DENSITY_OF_ICE
void derive_scat_species_a_and_b(Numeric &a, Numeric &b, const Vector &x, const Vector &mass, const Numeric &x_fit_start, const Numeric &x_fit_end)
constexpr Numeric DENSITY_OF_WATER
Internal functions for microphysics calculations (size distributions etc.)
constexpr Numeric pi
The following mathematical constants are generated in python Decimal package by the code:
constexpr Numeric density_of_ice_at_0c
Global constant, Density of water ice at 0C [kg/m3] source: http://en.wikipedia.org/wiki/Ice.
constexpr Numeric denity_of_water_at_4c
Global constant, Density of liquid water +4C [kg/m3] source: http://en.wikipedia.org/wiki/Water.
constexpr auto deg2rad(auto x) noexcept
Converts degrees to radians.
This file contains declerations of functions of physical character.
Propagation path structure and functions.
Internal functions associated with size distributions.
Contains sorting routines.
void get_sorted_indexes(ArrayOfIndex &sorted, const T &data)
get_sorted_indexes