ARTS 2.5.10 (git: 2f1c442c)
sun.cc
Go to the documentation of this file.
1/* Copyright (C) 2021
2 Jon Petersen <jon.petersen@studium.uni-hamburg.de>
3 Manfred Brath <manfred.brath@uni-hamburg.de>
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/*===========================================================================
21 === File description
22 ===========================================================================*/
23
33#include "sun.h"
34#include "auto_md.h"
35#include "agenda_class.h"
36#include "arts_conversions.h"
37#include "check_input.h"
38#include "debug.h"
39#include "matpack.h"
40#include "matpackI.h"
41#include "messages.h"
42#include "physics_funcs.h"
43#include "propagationmatrix.h"
44#include "geodetic.h"
45#include "arts.h"
46#include "workspace_ng.h"
47
48using Constant::sigma;
49using Constant::pi;
50
51/*===========================================================================
52 === The functions
53 ===========================================================================*/
54
55std::ostream& operator<<(std::ostream& os, const Sun& sun) {
56 os << "Sun: " << sun.description;
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 ;
62 return os;
63}
64
66 RadiationVector& scattered_sunlight,
67 const Vector& f_grid,
68 const Numeric& p,
69 const Numeric& T,
70 const Vector& vmr,
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) {
76 TransmissionMatrix gas_scattering_mat;
77 Vector sca_fct_dummy;
78
79 // calculate gas scattering properties
81 K_sca,
82 gas_scattering_mat,
83 sca_fct_dummy,
84 f_grid,
85 p,
86 T,
87 vmr,
88 gas_scattering_los_in,
89 gas_scattering_los_out,
90 0,
91 gas_scattering_agenda);
92
93 //some basic quantities
94 Index ns = transmitted_sunlight.ncols();
95 Index nf = f_grid.nelem();
96
97 //allocate and resize
98 RadiationVector scattered_sunlight_temp(1, ns);
99
100 Matrix mat_temp(1, ns,0.);
101 // Calculate the scattered radiation
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;//transmitted_sunlight(i_f, joker);
105 scattered_sunlight_temp.leftMul(gas_scattering_mat);
106
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);
110 }
111 }
112
113 //TODO: Include jacobian mechanism
114}
115
117 Index& suns_visible,
118 const ArrayOfSun& suns,
119 const Ppath& ppath,
120 const Vector& f_grid,
121 const Index& stokes_dim,
122 const Index& atmosphere_dim,
123 const Vector& refellipsoid) {
124 const Index np = ppath.np;
125
126 //set visibilty flag to default
127 suns_visible = 0;
128
129 //allocate iy and set it to zero
130 iy.resize(f_grid.nelem(), stokes_dim);
131 iy=0.;
132
133 Vector rtp_pos, rtp_los;
134 rtp_pos.resize(atmosphere_dim);
135 rtp_pos = ppath.pos(np - 1, Range(0, atmosphere_dim));
136 rtp_los.resize(ppath.los.ncols());
137 rtp_los = ppath.los(np - 1, joker);
138
139 if (ppath_what_background(ppath) == 9 || ppath_what_background(ppath) == 1){
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);
142 }
143 }
144}
145
147 Index& suns_visible,
148 const Sun& sun,
149 const Vector& rtp_pos,
150 const Vector& rtp_los,
151 const Vector& refellipsoid) {
152
153 //Calculate earth centric radial component of sun_pos and rtp_pos.
154 const Numeric R_sun = sun.distance;
155 const Numeric R_rte = refell2r(refellipsoid, rtp_pos[1]) + rtp_pos[0];
156
157 //Transform to cartesian coordinate system
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;
161
162 // r_sun
163 sph2cart(r_sun_x, r_sun_y, r_sun_z, R_sun, sun.latitude, sun.longitude);
164
165 // r_rte, r_los
166 poslos2cart(r_rte_x,
167 r_rte_y,
168 r_rte_z,
169 r_los_x,
170 r_los_y,
171 r_los_z,
172 R_rte,
173 rtp_pos[1],
174 rtp_pos[2],
175 rtp_los[0],
176 rtp_los[1]);
177
178 //Calculate vector of line of sight and unit vector pointing from
179 //ppath point to the sun.
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;
183
184 //abs value of r_ps
185 const Numeric r_ps =
186 sqrt(r_ps_x * r_ps_x + r_ps_y * r_ps_y + r_ps_z * r_ps_z);
187
188 //abs value of r_los
189 const Numeric r_glos =
190 sqrt(r_los_x * r_los_x + r_los_y * r_los_y + r_los_z * r_los_z);
191
192 //Calculate angle beta between line of sight and the line between ppath point and the sun
193 //using scalar product
194 const Numeric cos_beta =
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);
197
198 // angular radius of sun
199 const Numeric alpha = atan(sun.radius / r_ps);
200
201 //Check if we see the sun. We see the sun if the angle beta is smaller than
202 // the angular radius alpha of the sun.
203 if (beta <= alpha) {
204 //Here we assume that the sun radiates isotropically.
205 Matrix sun_radiance = sun.spectrum;
206 sun_radiance /= pi;
207
208 iy += sun_radiance;
209
210 // visibility flag
211 suns_visible = 1;
212 }
213}
214
216 ArrayOfMatrix& direct_radiation,
217 ArrayOfArrayOfTensor3& ddirect_radiation_dx,
218 const Index& stokes_dim,
219 const Vector& f_grid,
220 const Index& atmosphere_dim,
221 const Vector& p_grid,
222 const Vector& lat_grid,
223 const Vector& lon_grid,
224 const Tensor3& t_field,
225 const EnergyLevelMap& nlte_field,
226 const Tensor4& vmr_field,
227 const ArrayOfArrayOfSpeciesTag& abs_species,
228 const Tensor3& wind_u_field,
229 const Tensor3& wind_v_field,
230 const Tensor3& wind_w_field,
231 const Tensor3& mag_u_field,
232 const Tensor3& mag_v_field,
233 const Tensor3& mag_w_field,
234 const Index& cloudbox_on,
235 const ArrayOfIndex& cloudbox_limits,
236 const Index& gas_scattering_do,
237 const Index& irradiance_flag,
238 const ArrayOfPpath& sun_ppaths,
239 const ArrayOfSun& suns,
240 const ArrayOfIndex& suns_visible,
241 const Vector& refellipsoid,
242 const Tensor4& pnd_field,
243 const ArrayOfTensor4& dpnd_field_dx,
244 const ArrayOfString& scat_species,
245 const ArrayOfArrayOfSingleScatteringData& scat_data,
246 const Index& jacobian_do,
247 const ArrayOfRetrievalQuantity& jacobian_quantities,
248 const Agenda& propmat_clearsky_agenda,
249 const Agenda& water_p_eq_agenda,
250 const Agenda& gas_scattering_agenda,
251 const Numeric& rte_alonglos_v,
252 const Verbosity& verbosity) {
253 Vector sun_pos(3);
254
255 //dummy variables needed for the output and input of iyTransmission and
256 // gas_scattering_agenda
257 ArrayOfMatrix iy_aux_dummy;
258 ArrayOfString iy_aux_vars_dummy;
259 Vector ppvar_p_dummy;
260 Vector ppvar_t_dummy;
261 EnergyLevelMap ppvar_nlte_dummy;
262 Matrix ppvar_vmr_dummy;
263 Matrix ppvar_wind_dummy;
264 Matrix ppvar_mag_dummy;
265 Matrix ppvar_pnd_dummy;
266 Matrix ppvar_f_dummy;
267 Tensor3 ppvar_iy_dummy;
268 Tensor4 ppvar_trans_cumulat_dummy;
269 Tensor4 ppvar_trans_partial_dummy;
270
271 direct_radiation.resize(suns.nelem(),Matrix(f_grid.nelem(), stokes_dim, 0.));
272
273 Matrix radiation_toa;
274 Matrix radiation_trans;
275 ArrayOfTensor3 dradiation_trans;
276 Vector rtp_pos, rtp_los;
277 Index np;
278
279 for (Index i_sun = 0; i_sun < suns.nelem(); i_sun++) {
280 np = sun_ppaths[i_sun].np;
281
282 if (suns_visible[i_sun]) {
283 sun_pos = {suns[i_sun].distance,
284 suns[i_sun].latitude,
285 suns[i_sun].longitude};
286
287 // we need the distance to the sun relative to the surface
288 sun_pos[0] =
289 sun_pos[0] -
291 atmosphere_dim, refellipsoid, lat_grid, lon_grid, sun_pos);
292
293
294 if (irradiance_flag) {
295 //Get the spectral irradiance
296
297 //get the TOA distance to earth center.
298 Numeric R_TOA =
299 refell2r(refellipsoid, sun_ppaths[i_sun].pos(np - 1, 1)) +
300 sun_ppaths[i_sun].pos(np - 1, 0);
301
302 //get the distance between sun and sun_ppath at TOA
303 Numeric R_Sun2Toa;
304 distance3D(R_Sun2Toa,
305 R_TOA,
306 sun_ppaths[i_sun].pos(np - 1, 1),
307 sun_ppaths[i_sun].pos(np - 1, 2),
308 sun_pos[0],
309 sun_pos[1],
310 sun_pos[2]);
311
312 // Scale the incoming sun_irradiance spectrum
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);
317 } else {
318 //Get the spectral radiance instead
319
320 //Set sun position
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);
325
326 radiation_toa.resize(f_grid.nelem(), stokes_dim);
327 radiation_toa = 0;
328
329 Index visible;
330 get_sun_radiation(radiation_toa, visible, suns[i_sun], rtp_pos, rtp_los, refellipsoid);
331 }
332
333
335 radiation_trans,
336 iy_aux_dummy,
337 dradiation_trans,
338 ppvar_p_dummy,
339 ppvar_t_dummy,
340 ppvar_nlte_dummy,
341 ppvar_vmr_dummy,
342 ppvar_wind_dummy,
343 ppvar_mag_dummy,
344 ppvar_pnd_dummy,
345 ppvar_f_dummy,
346 ppvar_iy_dummy,
347 ppvar_trans_cumulat_dummy,
348 ppvar_trans_partial_dummy,
349 stokes_dim,
350 f_grid,
351 atmosphere_dim,
352 p_grid,
353 t_field,
354 nlte_field,
355 vmr_field,
356 abs_species,
357 wind_u_field,
358 wind_v_field,
359 wind_w_field,
360 mag_u_field,
361 mag_v_field,
362 mag_w_field,
363 cloudbox_on,
364 cloudbox_limits,
365 gas_scattering_do,
366 pnd_field,
367 dpnd_field_dx,
368 scat_species,
369 scat_data,
370 iy_aux_vars_dummy,
371 jacobian_do,
372 jacobian_quantities,
373 sun_ppaths[i_sun],
374 radiation_toa,
375 propmat_clearsky_agenda,
376 water_p_eq_agenda,
377 gas_scattering_agenda,
378 1,
379 Tensor3(),
380 rte_alonglos_v,
381 verbosity);
382
383 if (jacobian_do && dradiation_trans.nelem()){
384 ddirect_radiation_dx[i_sun] = dradiation_trans;
385 }
386 direct_radiation[i_sun] = radiation_trans;
387 }
388 }
389}
390
392 ArrayOfPpath& sun_ppaths,
393 ArrayOfIndex& suns_visible,
394 ArrayOfVector& sun_rte_los,
395 const Vector& rte_pos,
396 const ArrayOfSun& suns,
397 const Vector& f_grid,
398 const Index& atmosphere_dim,
399 const Vector& p_grid,
400 const Vector& lat_grid,
401 const Vector& lon_grid,
402 const Tensor3& z_field,
403 const Matrix& z_surface,
404 const Vector& refellipsoid,
405 const Numeric& ppath_lmax,
406 const Numeric& ppath_lraytrace,
407 const Agenda& ppath_step_agenda,
408 const Verbosity& verbosity) {
409 Vector sun_pos(3);
410 Vector sun_rte_los_isun(2);
411 Numeric ppath_lraytrace2 = ppath_lraytrace;
412 Ppath sun_ppath;
413
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};
418
419 // we need the distance to the sun relative to the surface
420 sun_pos[0] =
421 sun_pos[0] -
423 atmosphere_dim, refellipsoid, lat_grid, lon_grid, sun_pos);
424
425 // get the line of sight direction from sun i_sun to ppath point
427 atmosphere_dim,
428 lat_grid,
429 lon_grid,
430 refellipsoid,
431 rte_pos,
432 sun_pos,
433 verbosity);
434
435 // calculate ppath (sun path) from sun to ppath point
437 sun_ppath,
438 sun_rte_los_isun,
439 ppath_lraytrace2,
440 ppath_step_agenda,
441 atmosphere_dim,
442 p_grid,
443 lat_grid,
444 lon_grid,
445 z_field,
446 f_grid,
447 refellipsoid,
448 z_surface,
449 rte_pos,
450 sun_pos,
451 ppath_lmax,
452 2e-5,
453 5.,
454 0.5,
455 verbosity);
456
457 sun_ppaths[i_sun] = sun_ppath;
458 sun_rte_los[i_sun] = sun_rte_los_isun;
459
460 // Check that sun path hast more than 1 ppath points and that space is background
461 suns_visible[i_sun] =
462 sun_ppath.np > 1 && ppath_what_background(sun_ppath) == 9;
463 }
464}
465
467 const Vector &f_grid,
468 const Index &stokes_dim,
469 const Numeric &temperature,
470 const Verbosity &verbosity){
472
473 const Index nf = f_grid.nelem();
474 const Vector data_f_grid = sun_spectrum_raw.get_numeric_grid(0);
475 const Numeric data_fmin = data_f_grid[0];
476 const Numeric data_fmax = data_f_grid[data_f_grid.nelem() - 1];
477
478 // Result array
479 Matrix int_data(f_grid.nelem(), stokes_dim, 0.);
480
481 if (out3.sufficient_priority()) {
482 ostringstream os;
483 os << " f_grid: " << f_grid[0] << " - " << f_grid[nf - 1]
484 << " Hz\n"
485 << " data_f_grid: " << data_fmin << " - " << data_fmax << " Hz\n";
486 out3 << os.str();
487 }
488
489 const Numeric* f_grid_begin = f_grid.get_c_array();
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 =
494 std::distance(
495 f_grid_begin,
496 std::upper_bound(f_grid_begin + i_fstart, f_grid_end, data_fmax)) -
497 1;
498
499 // Ignore band if all frequencies are below or above data_f_grid:
500 if (i_fstart == nf || i_fstop == -1) {
501 out3 << "All frequencies are below or above the sun spectrum data";
502 }
503
504 const Index f_extent = i_fstop - i_fstart + 1;
505
506 if (out3.sufficient_priority()) {
507 ostringstream os;
508 os << " " << f_extent << " frequency extraction points starting at "
509 << "frequency index " << i_fstart << ".\n";
510 out3 << os.str();
511 }
512
513 // If f_extent is less than one, then the entire data_f_grid is between two
514 // grid points of f_grid. (So that we do not have any f_grid points inside
515 // data_f_grid.) Return also in this case.
516 if (f_extent < 1){
517 out3 << "The entire data lies inbetween two f_grid points (So no f_grid"
518 << " point inside the data_f_grid)";
519 }
520
521 // This is the part of f_grid that lies inside the spectrum data band
522 const ConstVectorView f_grid_active = f_grid[Range(i_fstart, f_extent)];
523
524 // Determine the index of the first grid points in the spectrum band that
525 // lies outside or on the boundary of the part of f_grid that lies inside
526 // the spectral band.
527 const Numeric f_grid_fmin = f_grid[i_fstart];
528 const Numeric f_grid_fmax = f_grid[i_fstop];
529
530 const Numeric* data_f_grid_begin = data_f_grid.get_c_array();
531 const Numeric* data_f_grid_end = data_f_grid_begin + data_f_grid.size() - 1;
532 const Index i_data_fstart =
533 std::distance(
534 data_f_grid_begin,
535 std::upper_bound(data_f_grid_begin, data_f_grid_end, f_grid_fmin)) -
536 1;
537 const Index i_data_fstop = std::distance(
538 data_f_grid_begin,
539 std::upper_bound(
540 data_f_grid_begin + i_data_fstart, data_f_grid_end, f_grid_fmax));
541
542 // Extent for active data frequency vector:
543 const Index data_f_extent = i_data_fstop - i_data_fstart + 1;
544
545 // For this range the interpolation will find place.
546 const Range active_range(i_data_fstart, data_f_extent);
547 const ConstVectorView data_f_grid_active = data_f_grid[active_range];
548
549 // Check if frequency is inside the range covered by the data:
550 chk_interpolation_grids("Frequency interpolation for cross sections",
551 data_f_grid,
552 f_grid_active);
553
554 {
555 // Find frequency grid positions:
556 ArrayOfGridPos f_gp(f_grid_active.nelem());
557 gridpos(f_gp, data_f_grid_active, f_grid_active, 0);
558
559 Matrix itw(f_gp.nelem(), 2);
560 interpweights(itw, f_gp);
561
562 for(int i=0; i < stokes_dim; i++){
563 interp(int_data(Range(i_fstart, f_extent),i), itw,
564 sun_spectrum_raw.data(active_range, i), f_gp);
565 }
566 }
567
568 // Padding
569 if (f_extent < nf){
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")
577 }
578 if (temperature > 0){
579 for (int i=0; i < i_fstart; i++){
580 int_data(i,0) = planck(f_grid[i], temperature);
581 }
582 for (Index i=f_extent; i < nf; i++){
583 int_data(i,0) = planck(f_grid[i], temperature);
584 }
585 }
586 }
587
588 return int_data;
589}
590
Declarations for agendas.
The global header file for ARTS.
Common ARTS conversions.
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)
Definition: auto_md.cc:25058
void chk_interpolation_grids(const String &which_interpolation, ConstVectorView old_grid, ConstVectorView new_grid, const Index order, const Numeric &extpolfac, const bool islog)
Check interpolation grids.
Definition: check_input.cc:906
The Agenda class.
Definition: agenda_class.h:69
This can be used to make arrays out of anything.
Definition: array.h:48
Index nelem() const ARTS_NOEXCEPT
Definition: array.h:92
Index ncols() const noexcept
Definition: matpackI.h:1080
A constant view of a Vector.
Definition: matpackI.h:521
Numeric * get_c_array() const noexcept
Conversion to plain C-array, const-version.
Definition: matpackI.h:633
Index nelem() const noexcept
Returns the number of elements.
Definition: matpackI.h:547
Index size() const noexcept
Definition: matpackI.h:550
const Vector & get_numeric_grid(Index i) const
Get a numeric grid.
The Matrix class.
Definition: matpackI.h:1285
void resize(Index r, Index c)
Resize function.
Definition: matpackI.cc:1011
VectorView Kjj(const Index iz=0, const Index ia=0)
Vector view to diagonal elements.
The range class.
Definition: matpackI.h:160
The Tensor3 class.
Definition: matpackIII.h:352
The Tensor4 class.
Definition: matpackIV.h:435
The Vector class.
Definition: matpackI.h:910
void resize(Index n)
Resize function.
Definition: matpackI.cc:390
Workspace class.
Definition: workspace_ng.h:53
Helper macros for debugging.
#define ARTS_USER_ERROR(...)
Definition: debug.h:169
void distance3D(Numeric &l, const Numeric &r1, const Numeric &lat1, const Numeric &lon1, const Numeric &r2, const Numeric &lat2, const Numeric &lon2)
distance3D
Definition: geodetic.cc:670
void sph2cart(Numeric &x, Numeric &y, Numeric &z, const Numeric &r, const Numeric &lat, const Numeric &lon)
sph2cart
Definition: geodetic.cc:1367
Numeric refell2r(ConstVectorView refellipsoid, const Numeric &lat)
refell2r
Definition: geodetic.cc:1266
Numeric pos2refell_r(const Index &atmosphere_dim, ConstVectorView refellipsoid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstVectorView rte_pos)
pos2refell_r
Definition: geodetic.cc:1212
void poslos2cart(Numeric &x, Numeric &z, Numeric &dx, Numeric &dz, const Numeric &r, const Numeric &lat, const Numeric &za)
poslos2cart
Definition: geodetic.cc:356
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.
Definition: m_ppath.cc:2071
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.
Definition: m_ppath.cc:889
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.
Definition: matpack.h:33
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
const Joker joker
Declarations having to do with the four output streams.
#define CREATE_OUTS
Definition: messages.h:208
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.
Definition: ppath.cc:1477
Stuff related to the propagation matrix.
Numeric sqrt(const Rational r)
Square root.
Definition: rational.h:705
The structure to describe a propagation path and releated quantities.
Definition: ppath_struct.h:17
Matrix los
Line-of-sight at each ppath point.
Definition: ppath_struct.h:35
Index np
Number of points describing the ppath.
Definition: ppath_struct.h:21
Matrix pos
The distance between start pos and the last position in pos.
Definition: ppath_struct.h:33
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.
Definition: sun.h:58
String description
Sun description.
Definition: sun.h:60
Matrix spectrum
Sun spectrum, monochrmatic radiance spectrum at the surface of the sun.
Definition: sun.h:62
Numeric latitude
latitude of the sun in the sky of the planet
Definition: sun.h:68
Numeric longitude
longitude of the sun in the sky of the planet
Definition: sun.h:70
Numeric distance
distance from center of planet to center of sun
Definition: sun.h:66
Numeric radius
Sun radius.
Definition: sun.h:64
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.
Definition: sun.cc:215
std::ostream & operator<<(std::ostream &os, const Sun &sun)
Definition: sun.cc:55
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.
Definition: sun.cc:391
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.
Definition: sun.cc:146
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
Definition: sun.cc:466
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.
Definition: sun.cc:65
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.
Definition: sun.cc:116
Declaration of functions in star.cc.
This file contains the Workspace class.