57 os <<
" Radius: " << sun.
radius <<
"m ";
58 os <<
" Distance: " << sun.
distance <<
"m \n";
59 os <<
" Latitude: " << sun.
latitude <<
"° \n";
60 os <<
" Longitude: " << sun.
longitude <<
"° \n";
61 os <<
" Spectrum [W/m2/Hz]: \n" << sun.
spectrum ;
71 const Matrix& transmitted_sunlight,
72 const Vector& gas_scattering_los_in,
73 const Vector& gas_scattering_los_out,
74 const Agenda& gas_scattering_agenda) {
88 gas_scattering_los_in,
89 gas_scattering_los_out,
91 gas_scattering_agenda);
100 Matrix mat_temp(1, ns,0.);
102 for (
Index i_f = 0; i_f < nf; i_f++) {
103 mat_temp(0,
joker) = transmitted_sunlight(i_f,
joker);
104 scattered_sunlight_temp = mat_temp;
105 scattered_sunlight_temp.
leftMul(gas_scattering_mat);
107 for (
Index j = 0; j < ns; j++) {
108 scattered_sunlight(i_f, j) =
109 scattered_sunlight_temp(0, j) * K_sca.
Kjj(0, 0)[i_f] /(4*pi);
121 const Index& stokes_dim,
122 const Index& atmosphere_dim,
123 const Vector& refellipsoid) {
134 rtp_pos.
resize(atmosphere_dim);
135 rtp_pos = ppath.
pos(np - 1,
Range(0, atmosphere_dim));
140 for (
Index i_sun = 0; i_sun < suns.
nelem(); i_sun++) {
141 get_sun_radiation(iy, suns_visible, suns[i_sun], rtp_pos, rtp_los, refellipsoid);
151 const Vector& refellipsoid) {
158 Numeric r_sun_x, r_sun_y, r_sun_z;
159 Numeric r_rte_x, r_rte_y, r_rte_z;
160 Numeric r_los_x, r_los_y, r_los_z;
180 const Numeric r_ps_x = r_sun_x - r_rte_x;
181 const Numeric r_ps_y = r_sun_y - r_rte_y;
182 const Numeric r_ps_z = r_sun_z - r_rte_z;
186 sqrt(r_ps_x * r_ps_x + r_ps_y * r_ps_y + r_ps_z * r_ps_z);
190 sqrt(r_los_x * r_los_x + r_los_y * r_los_y + r_los_z * r_los_z);
195 (r_ps_x * r_los_x + r_ps_y * r_los_y + r_ps_z * r_los_z) / (r_ps * r_glos);
196 const Numeric beta = acos(cos_beta);
218 const Index& stokes_dim,
220 const Index& atmosphere_dim,
234 const Index& cloudbox_on,
236 const Index& gas_scattering_do,
237 const Index& irradiance_flag,
241 const Vector& refellipsoid,
246 const Index& jacobian_do,
248 const Agenda& propmat_clearsky_agenda,
249 const Agenda& water_p_eq_agenda,
250 const Agenda& gas_scattering_agenda,
268 Tensor4 ppvar_trans_cumulat_dummy;
269 Tensor4 ppvar_trans_partial_dummy;
271 direct_radiation.resize(suns.
nelem(),
Matrix(f_grid.
nelem(), stokes_dim, 0.));
279 for (
Index i_sun = 0; i_sun < suns.
nelem(); i_sun++) {
280 np = sun_ppaths[i_sun].np;
282 if (suns_visible[i_sun]) {
283 sun_pos = {suns[i_sun].distance,
284 suns[i_sun].latitude,
285 suns[i_sun].longitude};
291 atmosphere_dim, refellipsoid, lat_grid, lon_grid, sun_pos);
294 if (irradiance_flag) {
299 refell2r(refellipsoid, sun_ppaths[i_sun].pos(np - 1, 1)) +
300 sun_ppaths[i_sun].pos(np - 1, 0);
306 sun_ppaths[i_sun].pos(np - 1, 1),
307 sun_ppaths[i_sun].pos(np - 1, 2),
313 radiation_toa = suns[i_sun].spectrum;
314 radiation_toa *= suns[i_sun].radius * suns[i_sun].radius;
315 radiation_toa /= (suns[i_sun].radius * suns[i_sun].radius +
316 R_Sun2Toa * R_Sun2Toa);
321 rtp_pos.
resize(atmosphere_dim);
322 rtp_pos = sun_ppaths[i_sun].pos(np - 1,
Range(0, atmosphere_dim));
323 rtp_los.
resize(sun_ppaths[i_sun].los.ncols());
324 rtp_los = sun_ppaths[i_sun].los(np - 1,
joker);
330 get_sun_radiation(radiation_toa, visible, suns[i_sun], rtp_pos, rtp_los, refellipsoid);
347 ppvar_trans_cumulat_dummy,
348 ppvar_trans_partial_dummy,
375 propmat_clearsky_agenda,
377 gas_scattering_agenda,
383 if (jacobian_do && dradiation_trans.
nelem()){
384 ddirect_radiation_dx[i_sun] = dradiation_trans;
386 direct_radiation[i_sun] = radiation_trans;
398 const Index& atmosphere_dim,
404 const Vector& refellipsoid,
406 const Numeric& ppath_lraytrace,
407 const Agenda& ppath_step_agenda,
410 Vector sun_rte_los_isun(2);
411 Numeric ppath_lraytrace2 = ppath_lraytrace;
414 for (
Index i_sun = 0; i_sun < suns.
nelem(); i_sun++) {
415 sun_pos = {suns[i_sun].distance,
416 suns[i_sun].latitude,
417 suns[i_sun].longitude};
423 atmosphere_dim, refellipsoid, lat_grid, lon_grid, sun_pos);
457 sun_ppaths[i_sun] = sun_ppath;
458 sun_rte_los[i_sun] = sun_rte_los_isun;
461 suns_visible[i_sun] =
468 const Index &stokes_dim,
475 const Numeric data_fmin = data_f_grid[0];
476 const Numeric data_fmax = data_f_grid[data_f_grid.
nelem() - 1];
481 if (out3.sufficient_priority()) {
483 os <<
" f_grid: " << f_grid[0] <<
" - " << f_grid[nf - 1]
485 <<
" data_f_grid: " << data_fmin <<
" - " << data_fmax <<
" Hz\n";
490 const Numeric* f_grid_end = f_grid_begin + f_grid.
nelem();
491 const Index i_fstart = std::distance(
492 f_grid_begin, std::lower_bound(f_grid_begin, f_grid_end, data_fmin));
493 const Index i_fstop =
496 std::upper_bound(f_grid_begin + i_fstart, f_grid_end, data_fmax)) -
500 if (i_fstart == nf || i_fstop == -1) {
501 out3 <<
"All frequencies are below or above the sun spectrum data";
504 const Index f_extent = i_fstop - i_fstart + 1;
506 if (out3.sufficient_priority()) {
508 os <<
" " << f_extent <<
" frequency extraction points starting at "
509 <<
"frequency index " << i_fstart <<
".\n";
517 out3 <<
"The entire data lies inbetween two f_grid points (So no f_grid"
518 <<
" point inside the data_f_grid)";
527 const Numeric f_grid_fmin = f_grid[i_fstart];
528 const Numeric f_grid_fmax = f_grid[i_fstop];
531 const Numeric* data_f_grid_end = data_f_grid_begin + data_f_grid.
size() - 1;
532 const Index i_data_fstart =
535 std::upper_bound(data_f_grid_begin, data_f_grid_end, f_grid_fmin)) -
537 const Index i_data_fstop = std::distance(
540 data_f_grid_begin + i_data_fstart, data_f_grid_end, f_grid_fmax));
543 const Index data_f_extent = i_data_fstop - i_data_fstart + 1;
546 const Range active_range(i_data_fstart, data_f_extent);
557 gridpos(f_gp, data_f_grid_active, f_grid_active, 0);
562 for(
int i=0; i < stokes_dim; i++){
564 sun_spectrum_raw.
data(active_range, i), f_gp);
570 if (temperature == -1){
572 "f_grid is (partially) outside the sun spectrum data"
573 "Set temperature to zero to have a padding of "
574 "0 or a fitting effective temperature"
575 "For further information take a look at the "
576 "documentation for regrid_sun_spectrum")
578 if (temperature > 0){
579 for (
int i=0; i < i_fstart; i++){
580 int_data(i,0) =
planck(f_grid[i], temperature);
582 for (
Index i=f_extent; i < nf; i++){
583 int_data(i,0) =
planck(f_grid[i], temperature);
Declarations for agendas.
The global header file for ARTS.
void gas_scattering_agendaExecute(Workspace &ws, PropagationMatrix &gas_scattering_coef, TransmissionMatrix &gas_scattering_mat, Vector &gas_scattering_fct_legendre, const Vector &f_grid, const Numeric rtp_pressure, const Numeric rtp_temperature, const Vector &rtp_vmr, const Vector &gas_scattering_los_in, const Vector &gas_scattering_los_out, const Index gas_scattering_output_type, const Agenda &input_agenda)
This can be used to make arrays out of anything.
Index nelem() const ARTS_NOEXCEPT
Index ncols() const noexcept
A constant view of a Vector.
Numeric * get_c_array() const noexcept
Conversion to plain C-array, const-version.
Index nelem() const noexcept
Returns the number of elements.
Index size() const noexcept
const Vector & get_numeric_grid(Index i) const
Get a numeric grid.
void resize(Index r, Index c)
Resize function.
VectorView Kjj(const Index iz=0, const Index ia=0)
Vector view to diagonal elements.
void resize(Index n)
Resize function.
Helper macros for debugging.
#define ARTS_USER_ERROR(...)
void distance3D(Numeric &l, const Numeric &r1, const Numeric &lat1, const Numeric &lon1, const Numeric &r2, const Numeric &lat2, const Numeric &lon2)
distance3D
void sph2cart(Numeric &x, Numeric &y, Numeric &z, const Numeric &r, const Numeric &lat, const Numeric &lon)
sph2cart
Numeric refell2r(ConstVectorView refellipsoid, const Numeric &lat)
refell2r
Numeric pos2refell_r(const Index &atmosphere_dim, ConstVectorView refellipsoid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstVectorView rte_pos)
pos2refell_r
void poslos2cart(Numeric &x, Numeric &z, Numeric &dx, Numeric &dz, const Numeric &r, const Numeric &lat, const Numeric &za)
poslos2cart
void gridpos(ArrayOfGridPos &gp, ConstVectorView old_grid, ConstVectorView new_grid, const Numeric &extpolfac)
Set up a grid position Array.
void interpweights(VectorView itw, const GridPos &tc)
Red 1D interpolation weights.
Numeric interp(ConstVectorView itw, ConstVectorView a, const GridPos &tc)
Red 1D Interpolate.
void rte_losGeometricFromRtePosToRtePos2(Vector &rte_los, const Index &atmosphere_dim, const Vector &lat_grid, const Vector &lon_grid, const Vector &refellipsoid, const Vector &rte_pos, const Vector &rte_pos2, const Verbosity &)
WORKSPACE METHOD: rte_losGeometricFromRtePosToRtePos2.
void ppathFromRtePos2(Workspace &ws, Ppath &ppath, Vector &rte_los, Numeric &ppath_lraytrace, const Agenda &ppath_step_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Vector &f_grid, const Vector &refellipsoid, const Matrix &z_surface, const Vector &rte_pos, const Vector &rte_pos2, const Numeric &ppath_lmax, const Numeric &za_accuracy, const Numeric &pplrt_factor, const Numeric &pplrt_lowest, const Verbosity &verbosity)
WORKSPACE METHOD: ppathFromRtePos2.
void iyTransmissionStandard(Workspace &ws, Matrix &iy, ArrayOfMatrix &iy_aux, ArrayOfTensor3 &diy_dx, Vector &ppvar_p, Vector &ppvar_t, EnergyLevelMap &ppvar_nlte, Matrix &ppvar_vmr, Matrix &ppvar_wind, Matrix &ppvar_mag, Matrix &ppvar_pnd, Matrix &ppvar_f, Tensor3 &ppvar_iy, Tensor4 &ppvar_trans_cumulat, Tensor4 &ppvar_trans_partial, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Tensor3 &t_field, const EnergyLevelMap &nlte_field, const Tensor4 &vmr_field, const ArrayOfArrayOfSpeciesTag &abs_species, const Tensor3 &wind_u_field, const Tensor3 &wind_v_field, const Tensor3 &wind_w_field, const Tensor3 &mag_u_field, const Tensor3 &mag_v_field, const Tensor3 &mag_w_field, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Index &gas_scattering_do, const Tensor4 &pnd_field, const ArrayOfTensor4 &dpnd_field_dx, const ArrayOfString &scat_species, const ArrayOfArrayOfSingleScatteringData &scat_data, const ArrayOfString &iy_aux_vars, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const Ppath &ppath, const Matrix &iy_transmitter, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const Agenda &gas_scattering_agenda, const Index &iy_agenda_call1, const Tensor3 &iy_transmittance, const Numeric &rte_alonglos_v, const Verbosity &)
WORKSPACE METHOD: iyTransmissionStandard.
Implementation of Matrix, Vector, and such stuff.
NUMERIC Numeric
The type to use for all floating point numbers.
INDEX Index
The type to use for all integer numbers and indices.
Declarations having to do with the four output streams.
constexpr Numeric pi
The following mathematical constants are generated in python Decimal package by the code:
constexpr Numeric sigma
Stefan-Boltzmann constant convenience name [W/(K^4*m^2)].
Numeric planck(const Numeric &f, const Numeric &t)
planck
This file contains declerations of functions of physical character.
Index ppath_what_background(const Ppath &ppath)
Returns the case number for the radiative background.
Stuff related to the propagation matrix.
Numeric sqrt(const Rational r)
Square root.
The structure to describe a propagation path and releated quantities.
Matrix los
Line-of-sight at each ppath point.
Index np
Number of points describing the ppath.
Matrix pos
The distance between start pos and the last position in pos.
Radiation Vector for Stokes dimension 1-4.
void leftMul(const TransmissionMatrix &T)
Multiply radiation vector from the left.
The structure to describe a propagation path and releated quantities.
String description
Sun description.
Matrix spectrum
Sun spectrum, monochrmatic radiance spectrum at the surface of the sun.
Numeric latitude
latitude of the sun in the sky of the planet
Numeric longitude
longitude of the sun in the sky of the planet
Numeric distance
distance from center of planet to center of sun
Numeric radius
Sun radius.
Class to keep track of Transmission Matrices for Stokes Dim 1-4.
void get_direct_radiation(Workspace &ws, ArrayOfMatrix &direct_radiation, ArrayOfArrayOfTensor3 &ddirect_radiation_dx, const Index &stokes_dim, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &t_field, const EnergyLevelMap &nlte_field, const Tensor4 &vmr_field, const ArrayOfArrayOfSpeciesTag &abs_species, const Tensor3 &wind_u_field, const Tensor3 &wind_v_field, const Tensor3 &wind_w_field, const Tensor3 &mag_u_field, const Tensor3 &mag_v_field, const Tensor3 &mag_w_field, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Index &gas_scattering_do, const Index &irradiance_flag, const ArrayOfPpath &sun_ppaths, const ArrayOfSun &suns, const ArrayOfIndex &suns_visible, const Vector &refellipsoid, const Tensor4 &pnd_field, const ArrayOfTensor4 &dpnd_field_dx, const ArrayOfString &scat_species, const ArrayOfArrayOfSingleScatteringData &scat_data, const Index &jacobian_do, const ArrayOfRetrievalQuantity &jacobian_quantities, const Agenda &propmat_clearsky_agenda, const Agenda &water_p_eq_agenda, const Agenda &gas_scattering_agenda, const Numeric &rte_alonglos_v, const Verbosity &verbosity)
Calculates the transmitted sun radiation at the end position of the ppath.
std::ostream & operator<<(std::ostream &os, const Sun &sun)
void get_sun_ppaths(Workspace &ws, ArrayOfPpath &sun_ppaths, ArrayOfIndex &suns_visible, ArrayOfVector &sun_rte_los, const Vector &rte_pos, const ArrayOfSun &suns, const Vector &f_grid, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &z_field, const Matrix &z_surface, const Vector &refellipsoid, const Numeric &ppath_lmax, const Numeric &ppath_lraytrace, const Agenda &ppath_step_agenda, const Verbosity &verbosity)
Calculates the ppath towards the suns from a given position and indicates if sun is visible or not.
void get_sun_radiation(Matrix &iy, Index &suns_visible, const Sun &sun, const Vector &rtp_pos, const Vector &rtp_los, const Vector &refellipsoid)
Checks and adds sun radiance if sun is in line of sight.
Matrix regrid_sun_spectrum(const GriddedField2 &sun_spectrum_raw, const Vector &f_grid, const Index &stokes_dim, const Numeric &temperature, const Verbosity &verbosity)
regrid_sun_spectrum
void get_scattered_sunsource(Workspace &ws, RadiationVector &scattered_sunlight, const Vector &f_grid, const Numeric &p, const Numeric &T, const Vector &vmr, const Matrix &transmitted_sunlight, const Vector &gas_scattering_los_in, const Vector &gas_scattering_los_out, const Agenda &gas_scattering_agenda)
Calculates the radiance spectrum of sun which is scattered by the atmospheric gases.
void get_sun_background(Matrix &iy, Index &suns_visible, const ArrayOfSun &suns, const Ppath &ppath, const Vector &f_grid, const Index &stokes_dim, const Index &atmosphere_dim, const Vector &refellipsoid)
Gets the sun background for a given ppath.
Declaration of functions in star.cc.
This file contains the Workspace class.