ARTS  2.2.66
ppath.cc File Reference

Functions releated to calculation of propagation paths. More...

#include <cmath>
#include <stdexcept>
#include "agenda_class.h"
#include "array.h"
#include "arts_omp.h"
#include "auto_md.h"
#include "check_input.h"
#include "geodetic.h"
#include "math_funcs.h"
#include "messages.h"
#include "mystring.h"
#include "logic.h"
#include "poly_roots.h"
#include "ppath.h"
#include "refraction.h"
#include "rte.h"
#include "special_interp.h"

Go to the source code of this file.

Functions

Numeric geometrical_ppc (const Numeric &r, const Numeric &za)
 geometrical_ppc More...
 
Numeric geompath_za_at_r (const Numeric &ppc, const Numeric &a_za, const Numeric &r)
 geompath_za_at_r More...
 
Numeric geompath_r_at_za (const Numeric &ppc, const Numeric &za)
 geompath_r_at_za More...
 
Numeric geompath_lat_at_za (const Numeric &za0, const Numeric &lat0, const Numeric &za)
 geompath_lat_at_za More...
 
Numeric geompath_l_at_r (const Numeric &ppc, const Numeric &r)
 geompath_l_at_r More...
 
Numeric geompath_r_at_l (const Numeric &ppc, const Numeric &l)
 geompath_r_at_l More...
 
Numeric geompath_r_at_lat (const Numeric &ppc, const Numeric &lat0, const Numeric &za0, const Numeric &lat)
 geompath_r_at_lat More...
 
void geompath_from_r1_to_r2 (Vector &r, Vector &lat, Vector &za, Numeric &lstep, const Numeric &ppc, const Numeric &r1, const Numeric &lat1, const Numeric &za1, const Numeric &r2, const bool &tanpoint, const Numeric &lmax)
 geompath_from_r1_to_r2 More...
 
void cart2zaaa (Numeric &za, Numeric &aa, const Numeric &dx, const Numeric &dy, const Numeric &dz)
 cart2zaaa More...
 
void zaaa2cart (Numeric &dx, Numeric &dy, Numeric &dz, const Numeric &za, const Numeric &aa)
 zaaa2cart More...
 
void rotationmat3D (Matrix &R, ConstVectorView vrot, const Numeric &a)
 rotationmat3D More...
 
void map_daa (Numeric &za, Numeric &aa, const Numeric &za0, const Numeric &aa0, const Numeric &aa_grid)
 
Numeric refraction_ppc (const Numeric &r, const Numeric &za, const Numeric &refr_index_air)
 refraction_ppc More...
 
void resolve_lon (Numeric &lon, const Numeric &lon5, const Numeric &lon6)
 resolve_lon More...
 
void find_tanpoint (Index &it, const Ppath ppath)
 find_tanpoint More...
 
Numeric rsurf_at_lat (const Numeric &lat1, const Numeric &lat3, const Numeric &r1, const Numeric &r3, const Numeric &lat)
 rsurf_at_lat More...
 
void plevel_slope_2d (Numeric &c1, ConstVectorView lat_grid, ConstVectorView refellipsoid, ConstVectorView z_surf, const GridPos &gp, const Numeric &za)
 plevel_slope_2d More...
 
void plevel_slope_2d (Numeric &c1, const Numeric &lat1, const Numeric &lat2, const Numeric &r1, const Numeric &r2)
 plevel_slope_2d More...
 
Numeric plevel_angletilt (const Numeric &r, const Numeric &c1)
 plevel_angletilt More...
 
bool is_los_downwards (const Numeric &za, const Numeric &tilt)
 is_los_downwards More...
 
void r_crossing_2d (Numeric &lat, Numeric &l, const Numeric &r_hit, const Numeric &r_start, const Numeric &lat_start, const Numeric &za_start, const Numeric &ppc)
 r_crossing_2d More...
 
Numeric rslope_crossing2d (const Numeric &rp, const Numeric &za, const Numeric &r0, Numeric c1)
 rslope_crossing2d More...
 
void plevel_crossing_2d (Numeric &r, Numeric &lat, Numeric &l, const Numeric &r_start0, const Numeric &lat_start, const Numeric &za_start, const Numeric &ppc, const Numeric &lat1, const Numeric &lat3, const Numeric &r1, const Numeric &r3, const bool &above)
 plevel_crossing_2d More...
 
Numeric rsurf_at_latlon (const Numeric &lat1, const Numeric &lat3, const Numeric &lon5, const Numeric &lon6, const Numeric &r15, const Numeric &r35, const Numeric &r36, const Numeric &r16, const Numeric &lat, const Numeric &lon)
 rsurf_at_latlon More...
 
void plevel_slope_3d (Numeric &c1, Numeric &c2, const Numeric &lat1, const Numeric &lat3, const Numeric &lon5, const Numeric &lon6, const Numeric &r15, const Numeric &r35, const Numeric &r36, const Numeric &r16, const Numeric &lat, const Numeric &lon, const Numeric &aa)
 plevel_slope_3d More...
 
void plevel_slope_3d (Numeric &c1, Numeric &c2, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstVectorView refellipsoid, ConstMatrixView z_surf, const GridPos &gp_lat, const GridPos &gp_lon, const Numeric &aa)
 plevel_slope_3d More...
 
Numeric rslope_crossing3d (const Numeric &rp, const Numeric &za, const Numeric &r0, Numeric c1, Numeric c2)
 rslope_crossing3d More...
 
void r_crossing_3d (Numeric &lat, Numeric &lon, Numeric &l, const Numeric &r_hit, const Numeric &r_start, const Numeric &lat_start, const Numeric &lon_start, const Numeric &za_start, const Numeric &ppc, const Numeric &x, const Numeric &y, const Numeric &z, const Numeric &dx, const Numeric &dy, const Numeric &dz)
 r_crossing_3d More...
 
void ppath_init_structure (Ppath &ppath, const Index &atmosphere_dim, const Index &np)
 ppath_init_structure More...
 
void ppath_set_background (Ppath &ppath, const Index &case_nr)
 ppath_set_background More...
 
Index ppath_what_background (const Ppath &ppath)
 ppath_what_background More...
 
void ppath_copy (Ppath &ppath1, const Ppath &ppath2, const Index &ncopy)
 ppath_copy More...
 
void ppath_append (Ppath &ppath1, const Ppath &ppath2)
 ppath_append More...
 
void ppath_start_1d (Numeric &r_start, Numeric &lat_start, Numeric &za_start, Index &ip, const Ppath &ppath)
 ppath_start_1d More...
 
void ppath_end_1d (Ppath &ppath, ConstVectorView r_v, ConstVectorView lat_v, ConstVectorView za_v, ConstVectorView lstep, ConstVectorView n_v, ConstVectorView ng_v, ConstVectorView z_field, ConstVectorView refellipsoid, const Index &ip, const Index &endface, const Numeric &ppc)
 ppath_end_1d More...
 
void ppath_start_2d (Numeric &r_start, Numeric &lat_start, Numeric &za_start, Index &ip, Index &ilat, Numeric &lat1, Numeric &lat3, Numeric &r1a, Numeric &r3a, Numeric &r3b, Numeric &r1b, Numeric &rsurface1, Numeric &rsurface3, Ppath &ppath, ConstVectorView lat_grid, ConstMatrixView z_field, ConstVectorView refellipsoid, ConstVectorView z_surface)
 ppath_start_2d More...
 
void ppath_end_2d (Ppath &ppath, ConstVectorView r_v, ConstVectorView lat_v, ConstVectorView za_v, ConstVectorView lstep, ConstVectorView n_v, ConstVectorView ng_v, ConstVectorView lat_grid, ConstMatrixView z_field, ConstVectorView refellipsoid, const Index &ip, const Index &ilat, const Index &endface, const Numeric &ppc)
 ppath_end_2d More...
 
void ppath_start_3d (Numeric &r_start, Numeric &lat_start, Numeric &lon_start, Numeric &za_start, Numeric &aa_start, Index &ip, Index &ilat, Index &ilon, Numeric &lat1, Numeric &lat3, Numeric &lon5, Numeric &lon6, Numeric &r15a, Numeric &r35a, Numeric &r36a, Numeric &r16a, Numeric &r15b, Numeric &r35b, Numeric &r36b, Numeric &r16b, Numeric &rsurface15, Numeric &rsurface35, Numeric &rsurface36, Numeric &rsurface16, Ppath &ppath, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, ConstVectorView refellipsoid, ConstMatrixView z_surface)
 ppath_start_3d More...
 
void ppath_end_3d (Ppath &ppath, ConstVectorView r_v, ConstVectorView lat_v, ConstVectorView lon_v, ConstVectorView za_v, ConstVectorView aa_v, ConstVectorView lstep, ConstVectorView n_v, ConstVectorView ng_v, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, ConstVectorView refellipsoid, const Index &ip, const Index &ilat, const Index &ilon, const Index &endface, const Numeric &ppc)
 ppath_end_3d More...
 
void do_gridrange_1d (Vector &r_v, Vector &lat_v, Vector &za_v, Numeric &lstep, Index &endface, const Numeric &r_start0, const Numeric &lat_start, const Numeric &za_start, const Numeric &ppc, const Numeric &lmax, const Numeric &ra, const Numeric &rb, const Numeric &rsurface)
 do_gridrange_1d More...
 
void ppath_step_geom_1d (Ppath &ppath, ConstVectorView z_field, ConstVectorView refellipsoid, const Numeric &z_surface, const Numeric &lmax)
 ppath_step_geom_1d More...
 
void do_gridcell_2d_byltest (Vector &r_v, Vector &lat_v, Vector &za_v, Numeric &lstep, Index &endface, const Numeric &r_start0, const Numeric &lat_start0, const Numeric &za_start, const Numeric &l_start, const Index &icall, const Numeric &ppc, const Numeric &lmax, const Numeric &lat1, const Numeric &lat3, const Numeric &r1a, const Numeric &r3a, const Numeric &r3b, const Numeric &r1b, const Numeric &rsurface1, const Numeric &rsurface3)
 do_gridcell_2d_byltest More...
 
void ppath_step_geom_2d (Ppath &ppath, ConstVectorView lat_grid, ConstMatrixView z_field, ConstVectorView refellipsoid, ConstVectorView z_surface, const Numeric &lmax)
 ppath_step_geom_2d More...
 
void do_gridcell_3d_byltest (Vector &r_v, Vector &lat_v, Vector &lon_v, Vector &za_v, Vector &aa_v, Numeric &lstep, Index &endface, const Numeric &r_start0, const Numeric &lat_start0, const Numeric &lon_start0, const Numeric &za_start, const Numeric &aa_start, const Numeric &l_start, const Index &icall, const Numeric &ppc, const Numeric &lmax, const Numeric &lat1, const Numeric &lat3, const Numeric &lon5, const Numeric &lon6, const Numeric &r15a, const Numeric &r35a, const Numeric &r36a, const Numeric &r16a, const Numeric &r15b, const Numeric &r35b, const Numeric &r36b, const Numeric &r16b, const Numeric &rsurface15, const Numeric &rsurface35, const Numeric &rsurface36, const Numeric &rsurface16)
 do_gridcell_3d_byltest More...
 
void ppath_step_geom_3d (Ppath &ppath, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, ConstVectorView refellipsoid, ConstMatrixView z_surface, const Numeric &lmax)
 ppath_step_geom_3d More...
 
void raytrace_1d_linear_basic (Workspace &ws, Array< Numeric > &r_array, Array< Numeric > &lat_array, Array< Numeric > &za_array, Array< Numeric > &l_array, Array< Numeric > &n_array, Array< Numeric > &ng_array, Index &endface, ConstVectorView p_grid, ConstVectorView refellipsoid, ConstTensor3View z_field, ConstTensor3View t_field, ConstTensor4View vmr_field, ConstVectorView f_grid, const Numeric &lmax, const Agenda &refr_index_air_agenda, const Numeric &lraytrace, const Numeric &rsurface, const Numeric &r1, const Numeric &r3, Numeric r, Numeric lat, Numeric za)
 raytrace_1d_linear_basic More...
 
void ppath_step_refr_1d (Workspace &ws, Ppath &ppath, ConstVectorView p_grid, ConstTensor3View z_field, ConstTensor3View t_field, ConstTensor4View vmr_field, ConstVectorView f_grid, ConstVectorView refellipsoid, const Numeric &z_surface, const Numeric &lmax, const Agenda &refr_index_air_agenda, const String &rtrace_method, const Numeric &lraytrace)
 ppath_step_refr_1d More...
 
void raytrace_2d_linear_basic (Workspace &ws, Array< Numeric > &r_array, Array< Numeric > &lat_array, Array< Numeric > &za_array, Array< Numeric > &l_array, Array< Numeric > &n_array, Array< Numeric > &ng_array, Index &endface, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView refellipsoid, ConstTensor3View z_field, ConstTensor3View t_field, ConstTensor4View vmr_field, ConstVectorView f_grid, const Numeric &lmax, const Agenda &refr_index_air_agenda, const Numeric &lraytrace, const Numeric &lat1, const Numeric &lat3, const Numeric &rsurface1, const Numeric &rsurface3, const Numeric &r1a, const Numeric &r3a, const Numeric &r3b, const Numeric &r1b, Numeric r, Numeric lat, Numeric za)
 raytrace_2d_linear_basic More...
 
void ppath_step_refr_2d (Workspace &ws, Ppath &ppath, ConstVectorView p_grid, ConstVectorView lat_grid, ConstTensor3View z_field, ConstTensor3View t_field, ConstTensor4View vmr_field, ConstVectorView f_grid, ConstVectorView refellipsoid, ConstVectorView z_surface, const Numeric &lmax, const Agenda &refr_index_air_agenda, const String &rtrace_method, const Numeric &lraytrace)
 ppath_step_refr_2d More...
 
void raytrace_3d_linear_basic (Workspace &ws, Array< Numeric > &r_array, Array< Numeric > &lat_array, Array< Numeric > &lon_array, Array< Numeric > &za_array, Array< Numeric > &aa_array, Array< Numeric > &l_array, Array< Numeric > &n_array, Array< Numeric > &ng_array, Index &endface, ConstVectorView refellipsoid, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, ConstTensor3View t_field, ConstTensor4View vmr_field, ConstVectorView f_grid, const Numeric &lmax, const Agenda &refr_index_air_agenda, const Numeric &lraytrace, const Numeric &lat1, const Numeric &lat3, const Numeric &lon5, const Numeric &lon6, const Numeric &rsurface15, const Numeric &rsurface35, const Numeric &rsurface36, const Numeric &rsurface16, const Numeric &r15a, const Numeric &r35a, const Numeric &r36a, const Numeric &r16a, const Numeric &r15b, const Numeric &r35b, const Numeric &r36b, const Numeric &r16b, Numeric r, Numeric lat, Numeric lon, Numeric za, Numeric aa)
 raytrace_3d_linear_basic More...
 
void ppath_step_refr_3d (Workspace &ws, Ppath &ppath, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, ConstTensor3View t_field, ConstTensor4View vmr_field, ConstVectorView f_grid, ConstVectorView refellipsoid, ConstMatrixView z_surface, const Numeric &lmax, const Agenda &refr_index_air_agenda, const String &rtrace_method, const Numeric &lraytrace)
 ppath_step_refr_3d More...
 
void ppath_start_stepping (Ppath &ppath, const Index &atmosphere_dim, ConstVectorView p_grid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstTensor3View z_field, ConstVectorView refellipsoid, ConstMatrixView z_surface, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const bool &ppath_inside_cloudbox_do, ConstVectorView rte_pos, ConstVectorView rte_los, const Verbosity &verbosity)
 ppath_start_stepping More...
 
void ppath_calc (Workspace &ws, Ppath &ppath, const Agenda &ppath_step_agenda, const Index &atmosphere_dim, const Vector &p_grid, const Vector &lat_grid, const Vector &lon_grid, const Tensor3 &t_field, const Tensor3 &z_field, const Tensor4 &vmr_field, const Vector &f_grid, const Vector &refellipsoid, const Matrix &z_surface, const Index &cloudbox_on, const ArrayOfIndex &cloudbox_limits, const Vector &rte_pos, const Vector &rte_los, const Numeric &ppath_lraytrace, const bool &ppath_inside_cloudbox_do, const Verbosity &verbosity)
 ppath_calc More...
 

Variables

const Numeric DEG2RAD
 
const Numeric RAD2DEG
 
const Numeric RTOL = 1e-3
 
const Numeric LATLONTOL = 1e-8
 
const Numeric LACC = 1e-5
 
const Numeric R_NOT_FOUND = -1
 
const Numeric L_NOT_FOUND = 99e99
 
const Numeric LAT_NOT_FOUND = 99e99
 
const Numeric LON_NOT_FOUND = 99e99
 

Detailed Description

Functions releated to calculation of propagation paths.

Author
Patrick Eriksson patri.nosp@m.ck.e.nosp@m.rikss.nosp@m.on@c.nosp@m.halme.nosp@m.rs.s.nosp@m.e
Date
2002-05-02

Functions to determine propagation paths for different atmospheric dimensionalities, with and without refraction.

The term propagation path is here shortened to ppath.

Definition in file ppath.cc.

Function Documentation

◆ cart2zaaa()

void cart2zaaa ( Numeric za,
Numeric aa,
const Numeric dx,
const Numeric dy,
const Numeric dz 
)

cart2zaaa

Converts a cartesian directional vector to zenith and azimuth

This function and the sister function cart2zaaa handles transformation of line-of-sights. This in contrast to the sph/poslos functions that handles positions, or combinations of positions and line-of-sight.

The cartesian coordinate system used for these two functions can be defined as z : za = 0 x : za=90, aa=0 y : za=90, aa=90

Parameters
zaOut: LOS zenith angle at observation position.
aaOut: LOS azimuth angle at observation position.
dxx-part of LOS unit vector.
dyy-part of LOS unit vector.
dzz-part of LOS unit vector.
Author
Patrick Eriksson
Date
2009-10-02

Definition at line 443 of file ppath.cc.

References dx, and RAD2DEG.

Referenced by adjust_los(), map_daa(), and specular_losCalc().

◆ do_gridcell_2d_byltest()

void do_gridcell_2d_byltest ( Vector r_v,
Vector lat_v,
Vector za_v,
Numeric lstep,
Index endface,
const Numeric r_start0,
const Numeric lat_start0,
const Numeric za_start,
const Numeric l_start,
const Index icall,
const Numeric ppc,
const Numeric lmax,
const Numeric lat1,
const Numeric lat3,
const Numeric r1a,
const Numeric r3a,
const Numeric r3b,
const Numeric r1b,
const Numeric rsurface1,
const Numeric rsurface3 
)

do_gridcell_2d_byltest

Works as do_gridcell_3d_byltest, but downscaled to 2D

Author
Patrick Eriksson
Date
2013-08-16

Definition at line 2837 of file ppath.cc.

References abs, ANGTOL, cart2pol(), cart2poslos(), dx, LACC, LATLONTOL, max, poslos2cart(), Vector::resize(), rsurf_at_lat(), and RTOL.

Referenced by ppath_step_geom_2d(), and raytrace_2d_linear_basic().

◆ do_gridcell_3d_byltest()

void do_gridcell_3d_byltest ( Vector r_v,
Vector lat_v,
Vector lon_v,
Vector za_v,
Vector aa_v,
Numeric lstep,
Index endface,
const Numeric r_start0,
const Numeric lat_start0,
const Numeric lon_start0,
const Numeric za_start,
const Numeric aa_start,
const Numeric l_start,
const Index icall,
const Numeric ppc,
const Numeric lmax,
const Numeric lat1,
const Numeric lat3,
const Numeric lon5,
const Numeric lon6,
const Numeric r15a,
const Numeric r35a,
const Numeric r36a,
const Numeric r16a,
const Numeric r15b,
const Numeric r35b,
const Numeric r36b,
const Numeric r16b,
const Numeric rsurface15,
const Numeric rsurface35,
const Numeric rsurface36,
const Numeric rsurface16 
)

do_gridcell_3d_byltest

See ATD for a description of the algorithm.

Author
Patrick Eriksson
Date
2002-11-28

Definition at line 3191 of file ppath.cc.

References abs, ANGTOL, cart2poslos(), cart2sph(), dx, LACC, LATLONTOL, max, POLELAT, poslos2cart(), Vector::resize(), resolve_lon(), rsurf_at_latlon(), and RTOL.

Referenced by ppath_step_geom_3d(), and raytrace_3d_linear_basic().

◆ do_gridrange_1d()

void do_gridrange_1d ( Vector r_v,
Vector lat_v,
Vector za_v,
Numeric lstep,
Index endface,
const Numeric r_start0,
const Numeric lat_start,
const Numeric za_start,
const Numeric ppc,
const Numeric lmax,
const Numeric ra,
const Numeric rb,
const Numeric rsurface 
)

do_gridrange_1d

Calculates the geometrical path through a 1D grid range.

This function works as do_gridcell_2d, but is valid for 1D cases.

The coding of variables and end face is as for do_gridcell_2d, with the exception that end faces 2 and 4 do not exist here.

Parameters
r_vOut: Vector with radius of found path points.
lat_vOut: Vector with latitude of found path points.
za_vOut: Vector with LOS zenith angle at found path points.
lstepOut: Vector with length along the path between points.
endfaceOut: Number coding for exit face.
r_start0Radius of start point.
lat_startLatitude of start point.
za_startLOS zenith angle at start point.
ppcPropagation path constant.
lmaxMaximum allowed length along the path. -1 = no limit.
raRadius of lower pressure level.
rbRadius of upper pressure level (rb > ra);
rsurfaceRadius for the surface.
Author
Patrick Eriksson
Date
2002-12-02

Definition at line 2699 of file ppath.cc.

References geompath_from_r1_to_r2(), and RTOL.

Referenced by ppath_step_geom_1d(), and raytrace_1d_linear_basic().

◆ find_tanpoint()

void find_tanpoint ( Index it,
const Ppath  ppath 
)

find_tanpoint

Identifies the tangent point of a propagation path

The tangent points is defined as the point with the lowest altitude.

The index of the tangent point is determined. If no tangent point is found, the index is set to -1.

Parameters
itOut: Index of tangent point
ppathPropagation path structure.
Author
Patrick Eriksson
Date
2012-04-07

Definition at line 705 of file ppath.cc.

References Ppath::np, and Ppath::pos.

Referenced by defocusing_sat2sat(), TangentPointExtract(), and TangentPointPrint().

◆ geometrical_ppc()

Numeric geometrical_ppc ( const Numeric r,
const Numeric za 
)

geometrical_ppc

Calculates the propagation path constant for pure geometrical calculations.

Both positive and negative zenith angles are handled.

Returns
Path constant.
Parameters
rRadius of the sensor position.
zaZenith angle of the sensor line-of-sight.
Author
Patrick Eriksson
Date
2002-05-17

Definition at line 118 of file ppath.cc.

References abs, and DEG2RAD.

Referenced by ppath_start_stepping(), ppath_step_geom_1d(), ppath_step_geom_2d(), ppath_step_geom_3d(), raytrace_1d_linear_basic(), raytrace_2d_linear_basic(), and raytrace_3d_linear_basic().

◆ geompath_from_r1_to_r2()

void geompath_from_r1_to_r2 ( Vector r,
Vector lat,
Vector za,
Numeric lstep,
const Numeric ppc,
const Numeric r1,
const Numeric lat1,
const Numeric za1,
const Numeric r2,
const bool &  tanpoint,
const Numeric lmax 
)

geompath_from_r1_to_r2

Determines radii, latitudes and zenith angles between two points of a propagation path.

Both start and end point are included in the returned vectors.

Parameters
rOutput: Radius of propagation path points.
latOutput: Latitude of propagation path points.
zaOutput: Zenith angle of propagation path points.
lstepOutput: Distance along the path between the points.
ppcPropagation path constant.
r1Radius for first point.
lat1Latitude for first point.
za1Zenith angle for first point.
r2Radius for second point.
tanpointTrue if there is a tangent point (r-based) between r1 and r2. Otherwise false.
lmaxLength criterion for distance between path points. A negative value means no length criterion.
Author
Patrick Eriksson
Date
2002-07-03

Definition at line 341 of file ppath.cc.

References abs, ANGTOL, geompath_l_at_r(), geompath_lat_at_za(), geompath_r_at_l(), geompath_za_at_r(), max, Vector::resize(), and sign().

Referenced by do_gridcell_2d(), and do_gridrange_1d().

◆ geompath_l_at_r()

Numeric geompath_l_at_r ( const Numeric ppc,
const Numeric r 
)

geompath_l_at_r

Calculates the length from the tangent point for the given radius.

The tangent point is either real or imaginary depending on the zenith angle of the sensor. See geometrical_tangent_radius.

Returns
Length along the path from the tangent point. Always >= 0.
Parameters
ppcPropagation path constant.
rRadius of the point of concern.
Author
Patrick Eriksson
Date
2002-05-20

Definition at line 246 of file ppath.cc.

References RTOL.

Referenced by do_gridcell_3d(), geompath_from_r1_to_r2(), plevel_crossing_2d(), ppath_start_stepping(), r_crossing_2d(), raytrace_1d_linear_basic(), and raytrace_2d_linear_basic().

◆ geompath_lat_at_za()

Numeric geompath_lat_at_za ( const Numeric za0,
const Numeric lat0,
const Numeric za 
)

geompath_lat_at_za

Calculates the latitude for a given zenith angle along a geometrical propagation path.

Positive and negative zenith angles are handled. A positive zenith angle means a movement towards higher latitudes.

Returns
The latitude of the second point.
Parameters
za0The zenith angle of the starting point.
lat0The latitude of the starting point.
zaThe zenith angle of the second point.
Author
Patrick Eriksson
Date
2002-05-17

Definition at line 218 of file ppath.cc.

References abs.

Referenced by geompath_from_r1_to_r2(), ppath_start_stepping(), r_crossing_2d(), raytrace_1d_linear_basic(), and raytrace_2d_linear_basic().

◆ geompath_r_at_l()

Numeric geompath_r_at_l ( const Numeric ppc,
const Numeric l 
)

geompath_r_at_l

Calculates the radius for a distance from the tangent point.

The tangent point is either real or imaginary depending on the zenith angle of the sensor. See geometrical_tangent_radius.

Returns
Radius.
Parameters
ppcPropagation path constant.
lLength from the tangent point (positive or negative).
Author
Patrick Eriksson
Date
2002-05-20

Definition at line 275 of file ppath.cc.

Referenced by geompath_from_r1_to_r2(), raytrace_1d_linear_basic(), and raytrace_2d_linear_basic().

◆ geompath_r_at_lat()

Numeric geompath_r_at_lat ( const Numeric ppc,
const Numeric lat0,
const Numeric za0,
const Numeric lat 
)

geompath_r_at_lat

Calculates the radius for a given latitude.

Returns
Radius at the point of interest.
Parameters
ppcPropagation path constant.
lat0Latitude at some other point of the path.
za0Zenith angle for the point with latitude lat0.
latLatitude of the point of interest.
Author
Patrick Eriksson
Date
2002-06-05

Definition at line 299 of file ppath.cc.

References abs, and geompath_r_at_za().

Referenced by do_gridcell_2d().

◆ geompath_r_at_za()

Numeric geompath_r_at_za ( const Numeric ppc,
const Numeric za 
)

geompath_r_at_za

Calculates the zenith angle for a given radius along a geometrical propagation path.

Both positive and negative zenith angles are handled.

Returns
Radius at the point of interest.
Parameters
ppcPropagation path constant.
zaZenith angle at the point of interest.
Author
Patrick Eriksson
Date
2002-06-05

Definition at line 190 of file ppath.cc.

References abs, and DEG2RAD.

Referenced by geompath_r_at_lat().

◆ geompath_za_at_r()

Numeric geompath_za_at_r ( const Numeric ppc,
const Numeric a_za,
const Numeric r 
)

geompath_za_at_r

Calculates the zenith angle for a given radius along a geometrical propagation path.

For downlooking cases, the two points must be on the same side of the tangent point.

Both positive and negative zenith angles are handled.

Returns
Zenith angle at the point of interest.
Parameters
ppcPropagation path constant.
a_zaA zenith angle along the path on the same side of the tangent point as the point of interest.
rRadius of the point of interest.
Author
Patrick Eriksson
Date
2002-05-17

Definition at line 147 of file ppath.cc.

References abs, RAD2DEG, and RTOL.

Referenced by do_gridcell_3d(), geompath_from_r1_to_r2(), ppath_start_stepping(), r_crossing_2d(), raytrace_1d_linear_basic(), raytrace_2d_linear_basic(), and VectorZtanToZa1D().

◆ is_los_downwards()

bool is_los_downwards ( const Numeric za,
const Numeric tilt 
)

is_los_downwards

Determines if a line-of-sight is downwards compared to the angular tilt of the surface or a pressure level.

For example, this function can be used to determine if the line-of-sight goes into the surface for a starting point exactly on the surface radius.

As the radius of the surface and pressure levels varies as a function of latitude, it is not clear if a zenith angle of 90 is above or below e.g. the surface.

Returns
Boolean that is true if LOS is downwards.
Parameters
zaZenith angle of line-of-sight.
tiltAngular tilt of the surface or the pressure level (as returned by plevel_angletilt)
Author
Patrick Eriksson
Date
2002-06-03

Definition at line 875 of file ppath.cc.

References abs.

Referenced by ppath_start_2d(), ppath_start_3d(), and ppath_start_stepping().

◆ map_daa()

void map_daa ( Numeric za,
Numeric aa,
const Numeric za0,
const Numeric aa0,
const Numeric aa_grid 
)

Maps MBLOCK_AA_GRID values to correct ZA and AA

Sensor LOS azimuth angles and mblock_aa_grid values can not be added in a straightforward way due to properties of the polar coordinate system used to define line-of-sights. This function performs a "mapping" ensuring that the pencil beam directions specified by mblock_za_grid and mblock_aa_grid form a rectangular grid (on the unit sphere) for any za.

za0 and aa0 match the angles of the ARTS WSV sensor_los. aa_grid shall hold values "close" to 0. The limit is here set to 5 degrees.

Parameters
zaOut: Zenith angle matching aa0+aa_grid
aaOut: Azimuth angles matching aa0+aa_grid
za0Zenith angle
aa0Centre azimuth angle
aa_gridMBLOCK_AA_GRID values
Author
Patrick Eriksson
Date
2009-10-02

Definition at line 576 of file ppath.cc.

References abs, cart2zaaa(), mult(), rotationmat3D(), and zaaa2cart().

Referenced by iyb_calc_za_loop_body().

◆ plevel_angletilt()

Numeric plevel_angletilt ( const Numeric r,
const Numeric c1 
)

plevel_angletilt

Calculates the angular tilt of the surface or a pressure level.

Note that the tilt value is a local value. The tilt for a constant slope value, is different for different radii.

Returns
The angular tilt.
Parameters
rThe radius for the level at the point of interest.
c1The radial slope, as returned by e.g. plevel_slope_2d.
Author
Patrick Eriksson
Date
2002-06-03

Definition at line 844 of file ppath.cc.

References RAD2DEG.

Referenced by ppath_start_2d(), ppath_start_3d(), ppath_start_stepping(), and specular_losCalc().

◆ plevel_crossing_2d()

void plevel_crossing_2d ( Numeric r,
Numeric lat,
Numeric l,
const Numeric r_start0,
const Numeric lat_start,
const Numeric za_start,
const Numeric ppc,
const Numeric lat1,
const Numeric lat3,
const Numeric r1,
const Numeric r3,
const bool &  above 
)

plevel_crossing_2d

Handles the crossing with a geometric ppaths step and a atmospheric grid box level for 2D.

That is, we have a part of a pressure level or the planet's surface, extending between two latitudes (lat1 and lat3). The radius at each latitude is given (r1 and r3). The function first of determines if the ppath crosses the level/surface between the two latitudes. If yes, the radius and the latitude of the crossing point are calculated.

If the given path point is on the pressure level (rp=r0), the solution of zero length is rejected.

Parameters
rOut: Radius at crossing.
latOut: Latitude at crossing.
lOut: Length between start and crossing points.
r_start0In: Radius of start point.
lat_startIn: Latitude of start point.
za_startIn: LOS zenith angle at start point.
ppcIn: Propagation path constant.
lat1In: Latitude of lower end.
lat3In: Latitude of upper end.
r1In: Radius at lat1.
r3In: Radius at lat3.
aboveIn: True if ppath start point is above level. In: Otherwise false.
Author
Patrick Eriksson
Date
2012-02-19

Definition at line 1121 of file ppath.cc.

References abs, ANGTOL, geompath_l_at_r(), L_NOT_FOUND, LAT_NOT_FOUND, max, min, plevel_slope_2d(), r_crossing_2d(), R_NOT_FOUND, rslope_crossing2d(), and rsurf_at_lat().

Referenced by do_gridcell_2d().

◆ plevel_slope_2d() [1/2]

void plevel_slope_2d ( Numeric c1,
const Numeric lat1,
const Numeric lat2,
const Numeric r1,
const Numeric r2 
)

plevel_slope_2d

Calculates the radial slope of the surface or a pressure level for 2D.

This function returns the same quantity as the function above, but takes the radius and latitude at two points of the pressure level, instead of vector input. That is, for this function the interesting latitude range is known when calling the function.

Parameters
c1Out: The radial slope [m/degree]
lat1A latitude.
lat2Another latitude.
r1Radius at lat1.
r2Radius at lat2.
Author
Patrick Eriksson
Date
2002-12-21

Definition at line 817 of file ppath.cc.

◆ plevel_slope_2d() [2/2]

void plevel_slope_2d ( Numeric c1,
ConstVectorView  lat_grid,
ConstVectorView  refellipsoid,
ConstVectorView  z_surf,
const GridPos gp,
const Numeric za 
)

plevel_slope_2d

Calculates the radial slope of the surface or a pressure level for 2D.

The radial slope is here the derivative of the radius with respect to the latitude. The unit is accordingly m/degree.

Note that the radius is defined to change linearly between grid points, and the slope is constant between to points of the latitude grid. The radius can inside the grid range be expressed as r = r0(lat0) + c1*(lat-lat0) .

Note also that the slope is always calculated with respect to increasing latitudes, independently of the zenith angle. The zenith angle is only used to determine which grid range that is of interest when the position is exactly on top of a grid point.

Parameters
c1Out: The radial slope [m/degree]
lat_gridThe latitude grid.
refellipsoidAs the WSV with the same name.
z_surfGeometrical altitude of the surface, or the pressure level of interest, for the latitide dimension
gpLatitude grid position for the position of interest
zaLOS zenith angle.
Author
Patrick Eriksson
Date
2002-06-03

Definition at line 782 of file ppath.cc.

References gridpos2gridrange(), and refell2r().

Referenced by plevel_crossing_2d(), ppath_start_2d(), ppath_start_stepping(), and specular_losCalc().

◆ plevel_slope_3d() [1/2]

void plevel_slope_3d ( Numeric c1,
Numeric c2,
const Numeric lat1,
const Numeric lat3,
const Numeric lon5,
const Numeric lon6,
const Numeric r15,
const Numeric r35,
const Numeric r36,
const Numeric r16,
const Numeric lat,
const Numeric lon,
const Numeric aa 
)

plevel_slope_3d

Calculates the radial slope of the surface or a pressure level for 3D.

For 2D the radius can be expressed as r = r0 + c1*dalpha, where alpha is the latitude. The radius is here for 3D expressed as a second order polynomial: r = r0 + c1*dalpha + c2*dalpha^2, where alpha is the angular change (in degrees) along the great circle along the given azimuth angle.

Parameters
c1Out: See above. Unit is m/degree.
c2Out: See above. Unit is m/degree^2.
lat1Lower latitude of grid cell.
lat3Upper latitude of grid cell.
lon5Lower longitude of grid cell.
lon6Upper longitude of grid cell.
r15Radius at crossing of lat1 and lon5.
r35Radius at crossing of lat3 and lon5.
r36Radius at crossing of lat3 and lon6.
r16Radius at crossing of lat1 and lon6.
latLatitude for which slope shall be determined.
lonLongitude for which slope shall be determined.
aaAzimuth angle for which slope shall be determined.
Author
Patrick Eriksson
Date
2002-12-30

Definition at line 1354 of file ppath.cc.

References latlon_at_aa(), resolve_lon(), and rsurf_at_latlon().

Referenced by plevel_crossing_3d(), plevel_slope_3d(), ppath_start_3d(), ppath_start_stepping(), and specular_losCalc().

◆ plevel_slope_3d() [2/2]

void plevel_slope_3d ( Numeric c1,
Numeric c2,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid,
ConstVectorView  refellipsoid,
ConstMatrixView  z_surf,
const GridPos gp_lat,
const GridPos gp_lon,
const Numeric aa 
)

plevel_slope_3d

Calculates the radial slope of the surface or a pressure level for 3D.

For 2D where the radius can be expressed as r = r0 + c1*dalpha, where alpha is the latitude. The radius is here for 3D expressed as a second order polynomial: r = r0 + c1*dalpha + c2*dalpha^2, where alpha is the angular change (in degrees) along the great circle along the given azimuth angle.

For a point exactly on a grid value it is not clear if it is the range below or above that is of interest. The azimuth angle is used to resolve such cases.

Parameters
c1Out: See above. Unit is m/degree.
c2Out: See above. Unit is m/degree^2.
lat_gridThe latitude grid.
lon_gridThe longitude grid.
refellipsoidAs the WSV with the same name.
z_surfGeometrical altitude of the surface, or the pressure level of interest.
gp_latLatitude grid position for the position of interest.
gp_lonLongitude grid position for the position of interest.
aaAzimuth angle.
Author
Patrick Eriksson
Date
2002-06-03

Definition at line 1435 of file ppath.cc.

References abs, gridpos2gridrange(), interp(), interpweights(), is_lon_cyclic(), ConstVectorView::nelem(), plevel_slope_3d(), POLELAT, and refell2r().

◆ ppath_append()

void ppath_append ( Ppath ppath1,
const Ppath ppath2 
)

ppath_append

Combines two Ppath structures.

The function appends a Ppath structure to another structure.

All the data of ppath1 is kept.

The first point in ppath2 is assumed to be the same as the last in ppath1. Only ppath2 fields start_pos, start_los, start_lstep, pos, los, r, lstep, nreal, ngroup, gp_XXX and background are considered.

Parameters
ppath1Output: Ppath structure to be expanded.
ppath2The Ppath structure to include in ppath.
Author
Patrick Eriksson
Date
2002-07-03

Definition at line 1948 of file ppath.cc.

References Ppath::background, Ppath::dim, Ppath::gp_lat, Ppath::gp_lon, Ppath::gp_p, gridpos_copy(), Ppath::los, Ppath::lstep, Ppath::ngroup, Ppath::np, Ppath::nreal, Ppath::pos, ppath_copy(), ppath_init_structure(), ppath_what_background(), Ppath::r, Ppath::start_los, Ppath::start_lstep, and Ppath::start_pos.

◆ ppath_calc()

void ppath_calc ( Workspace ws,
Ppath ppath,
const Agenda ppath_step_agenda,
const Index atmosphere_dim,
const Vector p_grid,
const Vector lat_grid,
const Vector lon_grid,
const Tensor3 t_field,
const Tensor3 z_field,
const Tensor4 vmr_field,
const Vector f_grid,
const Vector refellipsoid,
const Matrix z_surface,
const Index cloudbox_on,
const ArrayOfIndex cloudbox_limits,
const Vector rte_pos,
const Vector rte_los,
const Numeric ppath_lraytrace,
const bool &  ppath_inside_cloudbox_do,
const Verbosity verbosity 
)

ppath_calc

This is the core for the WSM ppathStepByStep.

This function takes mainly the same input as ppathStepByStep (that is, those input arguments are the WSV with the same name).

Parameters
wsCurrent Workspace
ppathOutput: A Ppath structure
ppath_step_agendaAs the WSM with the same name.
atmosphere_dimThe atmospheric dimensionality.
p_gridThe pressure grid.
lat_gridThe latitude grid.
lon_gridThe longitude grid.
t_fieldAs the WSM with the same name.
z_fieldAs the WSM with the same name.
vmr_fieldAs the WSM with the same name.
f_gridAs the WSM with the same name.
refellipsoidAs the WSM with the same name.
z_surfaceSurface altitude.
cloudbox_onFlag to activate the cloud box.
cloudbox_limitsIndex limits of the cloud box.
rte_posThe position of the sensor.
rte_losThe line-of-sight of the sensor.
ppath_lraytraceAs the WSM with the same name.
ppath_inside_cloudbox_doAs the WSM with the same name.
Author
Patrick Eriksson
Date
2003-01-08

Definition at line 5344 of file ppath.cc.

References abs, Ppath::background, chk_rte_los(), chk_rte_pos(), Ppath::constant, Ppath::end_los, Ppath::end_lstep, Ppath::end_pos, fractional_gp(), Ppath::gp_lat, Ppath::gp_lon, Ppath::gp_p, gridpos(), is_gridpos_at_index_i(), joker, Ppath::los, Ppath::lstep, Array< base >::nelem(), ConstVectorView::nelem(), Ppath::ngroup, Ppath::np, Ppath::nreal, Ppath::pos, ppath_copy(), ppath_init_structure(), ppath_set_background(), ppath_start_stepping(), ppath_step_agendaExecute(), ppath_what_background(), Ppath::r, Ppath::start_los, Ppath::start_lstep, and Ppath::start_pos.

Referenced by defocusing_general_sub(), defocusing_sat2sat(), iwp_cloud_opt_pathCalc(), MCIPA(), ppathFromRtePos2(), and ppathStepByStep().

◆ ppath_copy()

void ppath_copy ( Ppath ppath1,
const Ppath ppath2,
const Index ncopy 
)

ppath_copy

Copy the content in ppath2 to ppath1.

The ppath1 structure must be allocated before calling the function. The structure can be allocated to hold more points than found in ppath2. The data of ppath2 is placed in the first positions of ppath1.

Parameters
ppath1Output: Ppath structure.
ppath2The ppath structure to be copied.
ncopyNumber of points in ppath2 to copy. If set to negative, the number is set to ppath2.np.
Author
Patrick Eriksson
Date
2002-07-03

Definition at line 1876 of file ppath.cc.

References Ppath::background, Ppath::constant, Ppath::dim, Ppath::end_los, Ppath::end_lstep, Ppath::end_pos, Ppath::gp_lat, Ppath::gp_lon, Ppath::gp_p, gridpos_copy(), joker, Ppath::los, Ppath::lstep, Ppath::ngroup, Ppath::np, Ppath::nreal, Ppath::pos, Ppath::r, Ppath::start_los, Ppath::start_lstep, and Ppath::start_pos.

Referenced by ppath_append(), ppath_calc(), and ppathFromRtePos2().

◆ ppath_end_1d()

void ppath_end_1d ( Ppath ppath,
ConstVectorView  r_v,
ConstVectorView  lat_v,
ConstVectorView  za_v,
ConstVectorView  lstep,
ConstVectorView  n_v,
ConstVectorView  ng_v,
ConstVectorView  z_field,
ConstVectorView  refellipsoid,
const Index ip,
const Index endface,
const Numeric ppc 
)

ppath_end_1d

Internal help function for 1D path calculations.

The function performs the end part of the calculations, that are common for geometrical and refraction calculations.

See the code for details.

Author
Patrick Eriksson
Date
2002-11-27

Definition at line 2052 of file ppath.cc.

References Ppath::constant, Ppath::gp_p, gridpos_check_fd(), gridpos_force_end_fd(), Ppath::los, Ppath::lstep, Array< base >::nelem(), ConstVectorView::nelem(), Ppath::ngroup, Ppath::nreal, Ppath::pos, ppath_init_structure(), ppath_set_background(), and Ppath::r.

Referenced by ppath_step_geom_1d(), and ppath_step_refr_1d().

◆ ppath_end_2d()

void ppath_end_2d ( Ppath ppath,
ConstVectorView  r_v,
ConstVectorView  lat_v,
ConstVectorView  za_v,
ConstVectorView  lstep,
ConstVectorView  n_v,
ConstVectorView  ng_v,
ConstVectorView  lat_grid,
ConstMatrixView  z_field,
ConstVectorView  refellipsoid,
const Index ip,
const Index ilat,
const Index endface,
const Numeric ppc 
)

ppath_end_2d

Internal help function for 2D path calculations.

The function performs the end part of the calculations, that are common for geometrical and refraction calculations.

See the code for details.

Author
Patrick Eriksson
Date
2002-11-29

Definition at line 2240 of file ppath.cc.

References Ppath::constant, Ppath::gp_lat, Ppath::gp_p, gridpos_check_fd(), gridpos_force_end_fd(), Ppath::los, Ppath::lstep, Array< base >::nelem(), ConstVectorView::nelem(), Ppath::ngroup, Ppath::nreal, ConstMatrixView::nrows(), Ppath::pos, ppath_init_structure(), ppath_set_background(), Ppath::r, refell2r(), and w().

Referenced by ppath_step_geom_2d(), and ppath_step_refr_2d().

◆ ppath_end_3d()

void ppath_end_3d ( Ppath ppath,
ConstVectorView  r_v,
ConstVectorView  lat_v,
ConstVectorView  lon_v,
ConstVectorView  za_v,
ConstVectorView  aa_v,
ConstVectorView  lstep,
ConstVectorView  n_v,
ConstVectorView  ng_v,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid,
ConstTensor3View  z_field,
ConstVectorView  refellipsoid,
const Index ip,
const Index ilat,
const Index ilon,
const Index endface,
const Numeric ppc 
)

ppath_end_3d

Internal help function for 3D path calculations.

The function performs the end part of the calculations, that are common for geometrical and refraction calculations.

See the code for details.

Author
Patrick Eriksson
Date
2002-12-30

Definition at line 2527 of file ppath.cc.

References abs, Ppath::constant, Ppath::gp_lat, Ppath::gp_lon, Ppath::gp_p, gridpos_check_fd(), gridpos_force_end_fd(), Ppath::los, Ppath::lstep, ConstVectorView::nelem(), Ppath::ngroup, Ppath::nreal, POLELAT, Ppath::pos, ppath_init_structure(), ppath_set_background(), Ppath::r, refell2r(), and rsurf_at_latlon().

Referenced by ppath_step_geom_3d(), and ppath_step_refr_3d().

◆ ppath_init_structure()

void ppath_init_structure ( Ppath ppath,
const Index atmosphere_dim,
const Index np 
)

ppath_init_structure

Initiates a Ppath structure to hold the given number of points.

All fields releated with the surface, symmetry and tangent point are set to 0 or empty. The background field is set to background case 0. The constant field is set to -1. The refraction field is set to 0.

The length of the lstep field is set to np-1.

Parameters
ppathOutput: A Ppath structure.
atmosphere_dimThe atmospheric dimensionality.
npNumber of points of the path.
Author
Patrick Eriksson
Date
2002-05-17

Definition at line 1726 of file ppath.cc.

References Ppath::constant, Ppath::dim, Ppath::end_los, Ppath::end_lstep, Ppath::end_pos, Ppath::gp_lat, Ppath::gp_lon, Ppath::gp_p, Ppath::los, Ppath::lstep, max, Ppath::ngroup, Ppath::np, Ppath::nreal, Ppath::pos, ppath_set_background(), Ppath::r, Vector::resize(), Matrix::resize(), Ppath::start_los, Ppath::start_lstep, and Ppath::start_pos.

Referenced by cloud_ppath_update1D(), cloud_ppath_update1D_noseq(), cloud_ppath_update3D(), ppath_append(), ppath_calc(), ppath_end_1d(), ppath_end_2d(), ppath_end_3d(), ppath_start_stepping(), and ppathFromRtePos2().

◆ ppath_set_background()

void ppath_set_background ( Ppath ppath,
const Index case_nr 
)

ppath_set_background

Sets the background field of a Ppath structure.

The different background cases have a number coding to simplify a possible change of the strings and checking of the what case that is valid.

The case numbers are:
0. Unvalid.

  1. Space.
  2. The surface.
  3. The cloud box boundary.
  4. The interior of the cloud box.
Parameters
ppathOutput: A Ppath structure.
case_nrCase number (see above)
Author
Patrick Eriksson
Date
2002-05-17

Definition at line 1790 of file ppath.cc.

References Ppath::background.

Referenced by ppath_calc(), ppath_end_1d(), ppath_end_2d(), ppath_end_3d(), ppath_init_structure(), ppath_start_stepping(), and ppathFromRtePos2().

◆ ppath_start_1d()

void ppath_start_1d ( Numeric r_start,
Numeric lat_start,
Numeric za_start,
Index ip,
const Ppath ppath 
)

ppath_start_1d

Internal help function for 1D path calculations.

The function does the asserts and determined some variables that are common for geometrical and refraction calculations.

See the code for details.

Author
Patrick Eriksson
Date
2002-11-13

Definition at line 2017 of file ppath.cc.

References Ppath::gp_p, gridpos2gridrange(), Ppath::los, Ppath::np, Ppath::pos, and Ppath::r.

Referenced by ppath_step_geom_1d(), and ppath_step_refr_1d().

◆ ppath_start_2d()

void ppath_start_2d ( Numeric r_start,
Numeric lat_start,
Numeric za_start,
Index ip,
Index ilat,
Numeric lat1,
Numeric lat3,
Numeric r1a,
Numeric r3a,
Numeric r3b,
Numeric r1b,
Numeric rsurface1,
Numeric rsurface3,
Ppath ppath,
ConstVectorView  lat_grid,
ConstMatrixView  z_field,
ConstVectorView  refellipsoid,
ConstVectorView  z_surface 
)

ppath_start_2d

Internal help function for 2D path calculations.

The function does the asserts and determined some variables that are common for geometrical and refraction calculations.

See the code for details.

Author
Patrick Eriksson
Date
2002-11-18

Definition at line 2121 of file ppath.cc.

References abs, Ppath::gp_lat, Ppath::gp_p, gridpos2gridrange(), gridpos_force_end_fd(), is_gridpos_at_index_i(), is_los_downwards(), Ppath::los, Ppath::np, plevel_angletilt(), plevel_slope_2d(), Ppath::pos, Ppath::r, refell2r(), rsurf_at_lat(), and RTOL.

Referenced by ppath_step_geom_2d(), and ppath_step_refr_2d().

◆ ppath_start_3d()

void ppath_start_3d ( Numeric r_start,
Numeric lat_start,
Numeric lon_start,
Numeric za_start,
Numeric aa_start,
Index ip,
Index ilat,
Index ilon,
Numeric lat1,
Numeric lat3,
Numeric lon5,
Numeric lon6,
Numeric r15a,
Numeric r35a,
Numeric r36a,
Numeric r16a,
Numeric r15b,
Numeric r35b,
Numeric r36b,
Numeric r16b,
Numeric rsurface15,
Numeric rsurface35,
Numeric rsurface36,
Numeric rsurface16,
Ppath ppath,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid,
ConstTensor3View  z_field,
ConstVectorView  refellipsoid,
ConstMatrixView  z_surface 
)

ppath_start_3d

Internal help function for 3D path calculations.

The function does the asserts and determined some variables that are common for geometrical and refraction calculations.

See the code for details.

Author
Patrick Eriksson
Date
2002-12-30

Definition at line 2353 of file ppath.cc.

References abs, Ppath::gp_lat, Ppath::gp_lon, Ppath::gp_p, gridpos(), gridpos2gridrange(), is_gridpos_at_index_i(), is_los_downwards(), Ppath::los, ConstVectorView::nelem(), Ppath::np, plevel_angletilt(), plevel_slope_3d(), Ppath::pos, Ppath::r, and refell2r().

Referenced by ppath_step_geom_3d(), and ppath_step_refr_3d().

◆ ppath_start_stepping()

void ppath_start_stepping ( Ppath ppath,
const Index atmosphere_dim,
ConstVectorView  p_grid,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid,
ConstTensor3View  z_field,
ConstVectorView  refellipsoid,
ConstMatrixView  z_surface,
const Index cloudbox_on,
const ArrayOfIndex cloudbox_limits,
const bool &  ppath_inside_cloudbox_do,
ConstVectorView  rte_pos,
ConstVectorView  rte_los,
const Verbosity verbosity 
)

ppath_start_stepping

Initiates a Ppath structure for calculation of a path with ppath_step.

The function performs two main tasks. As mentioned above, it initiates a Ppath structure (a), but it also checks that the end point of the path is at an allowed location (b).

(a): The Ppath structure is set to hold the position and LOS of the last point of the path inside the atmosphere. This point is either the sensor position, or the point where the path leaves the model atmosphere. If the path is totally outside the atmosphere, no point is put into the structure. If the (practical) end and start points are identical, such as when the sensor is inside the cloud box, the background field is set.

(b): If it is found that the end point of the path is at an illegal position a detailed error message is given. Not allowed cases are:

  1. The sensor is placed below surface level.
  2. For 2D and 3D, the path leaves the model atmosphere at a latitude or longitude end face.
  3. For 2D and 3D, the path is totally outside the atmosphere and the latitude and longitude of the tangent point is outside the range of the corresponding grids.

All input variables are identical with the WSV with the same name. The output variable is here called ppath for simplicity, but is in fact ppath_step.

Parameters
ppathOutput: A Ppath structure.
atmosphere_dimThe atmospheric dimensionality.
p_gridThe pressure grid.
lat_gridThe latitude grid.
lon_gridThe longitude grid.
z_fieldThe field of geometrical altitudes.
refellipsoidAs the WSV with the same name.
z_surfaceSurface altitude.
cloudbox_onFlag to activate the cloud box.
cloudbox_limitsIndex limits of the cloud box.
ppath_inside_cloudbox_doAs the WSV with the same name.
rte_posThe position of the sensor.
rte_losThe line-of-sight of the sensor.
Author
Patrick Eriksson
Date
2002-05-17

Definition at line 4606 of file ppath.cc.

References abs, cart2poslos(), Ppath::constant, CREATE_OUT1, DEBUG_ONLY, dx, Ppath::end_los, Ppath::end_lstep, Ppath::end_pos, fractional_gp(), geometrical_ppc(), geompath_l_at_r(), geompath_lat_at_za(), geompath_za_at_r(), Ppath::gp_lat, Ppath::gp_lon, Ppath::gp_p, gridpos(), gridpos_check_fd(), gridpos_copy(), interp(), interpweights(), is_los_downwards(), joker, L_NOT_FOUND, LACC, Ppath::los, ConstVectorView::nelem(), Ppath::ngroup, Ppath::nreal, plevel_angletilt(), plevel_slope_2d(), plevel_slope_3d(), Ppath::pos, poslos2cart(), ppath_init_structure(), ppath_set_background(), Ppath::r, r_crossing_2d(), r_crossing_3d(), refell2d(), refell2r(), resolve_lon(), rte_pos2gridpos(), and RTOL.

Referenced by mcPathTraceGeneral(), mcPathTraceIPA(), and ppath_calc().

◆ ppath_step_geom_1d()

void ppath_step_geom_1d ( Ppath ppath,
ConstVectorView  z_field,
ConstVectorView  refellipsoid,
const Numeric z_surface,
const Numeric lmax 
)

ppath_step_geom_1d

Calculates 1D geometrical propagation path steps.

This is the core function to determine 1D propagation path steps by pure geometrical calculations. Path points are included for crossings with the grids, tangent points and points of intersection with the surface. In addition, points are included in the propgation path to ensure that the distance along the path between the points does not exceed the selected maximum length (lmax). If lmax is <= 0, this means that no length criterion shall be applied.

Note that the input variables are here compressed to only hold data for a 1D atmosphere. For example, z_field is z_field(:,0,0).

For more information read the chapter on propagation paths in AUG.

Parameters
ppathOutput: A Ppath structure.
z_fieldGeometrical altitudes corresponding to p_grid.
refellipsoidAs the WSV with the same name.
z_surfaceSurface altitude.
lmaxMaximum allowed length between the path points.
Author
Patrick Eriksson
Date
2002-05-20

Definition at line 2783 of file ppath.cc.

References Ppath::constant, do_gridrange_1d(), geometrical_ppc(), ConstVectorView::nelem(), ppath_end_1d(), and ppath_start_1d().

Referenced by ppath_stepGeometric().

◆ ppath_step_geom_2d()

void ppath_step_geom_2d ( Ppath ppath,
ConstVectorView  lat_grid,
ConstMatrixView  z_field,
ConstVectorView  refellipsoid,
ConstVectorView  z_surface,
const Numeric lmax 
)

ppath_step_geom_2d

Calculates 2D geometrical propagation path steps.

Works as the same function for 1D, despite that some input arguments are of different type.

Parameters
ppathOutput: A Ppath structure.
lat_gridLatitude grid.
z_fieldGeometrical altitudes
refellipsoidAs the WSV with the same name.
z_surfaceSurface altitudes.
lmaxMaximum allowed length between the path points.
Author
Patrick Eriksson
Date
2002-07-03

Definition at line 3136 of file ppath.cc.

References Ppath::constant, do_gridcell_2d_byltest(), geometrical_ppc(), ConstVectorView::nelem(), ppath_end_2d(), and ppath_start_2d().

Referenced by ppath_stepGeometric().

◆ ppath_step_geom_3d()

void ppath_step_geom_3d ( Ppath ppath,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid,
ConstTensor3View  z_field,
ConstVectorView  refellipsoid,
ConstMatrixView  z_surface,
const Numeric lmax 
)

ppath_step_geom_3d

Calculates 3D geometrical propagation path steps.

Works as the same function for 1D despite that some input arguments are of different type.

Parameters
ppathOutput: A Ppath structure.
lat_gridLatitude grid.
lon_gridLongitude grid.
z_fieldGeometrical altitudes
refellipsoidAs the WSV with the same name.
z_surfaceSurface altitudes.
lmaxMaximum allowed length between the path points.
Author
Patrick Eriksson
Date
2002-12-30

Definition at line 3553 of file ppath.cc.

References Ppath::constant, do_gridcell_3d_byltest(), geometrical_ppc(), ConstVectorView::nelem(), ppath_end_3d(), and ppath_start_3d().

Referenced by mcPathTraceGeneral(), and ppath_stepGeometric().

◆ ppath_step_refr_1d()

void ppath_step_refr_1d ( Workspace ws,
Ppath ppath,
ConstVectorView  p_grid,
ConstTensor3View  z_field,
ConstTensor3View  t_field,
ConstTensor4View  vmr_field,
ConstVectorView  f_grid,
ConstVectorView  refellipsoid,
const Numeric z_surface,
const Numeric lmax,
const Agenda refr_index_air_agenda,
const String rtrace_method,
const Numeric lraytrace 
)

ppath_step_refr_1d

Calculates 1D propagation path steps including effects of refraction.

This function works as the function ppath_step_geom_1d but considers also refraction. The upper length of the ray tracing steps is set by the argument lraytrace. This argument controls only the internal calculations. The maximum distance between the path points is still determined by lmax.

Parameters
wsCurrent Workspace
ppathOut: A Ppath structure.
p_gridPressure grid.
z_fieldAs the WSV with the same name.
t_fieldAs the WSV with the same name.
vmr_fieldAs the WSV with the same name.
f_gridAs the WSV with the same name.
refellipsoidAs the WSV with the same name.
z_surfaceSurface altitude (1D).
lmaxMaximum allowed length between the path points.
refr_index_air_agendaThe WSV with the same name.
rtrace_methodString giving which ray tracing method to use. See the function for options.
lraytraceMaximum allowed length for ray tracing steps.
Author
Patrick Eriksson
Date
2002-11-26

Definition at line 3809 of file ppath.cc.

References Ppath::constant, get_refr_index_1d(), joker, Array< base >::nelem(), ppath_end_1d(), ppath_start_1d(), raytrace_1d_linear_basic(), and refraction_ppc().

Referenced by ppath_stepRefractionBasic().

◆ ppath_step_refr_2d()

void ppath_step_refr_2d ( Workspace ws,
Ppath ppath,
ConstVectorView  p_grid,
ConstVectorView  lat_grid,
ConstTensor3View  z_field,
ConstTensor3View  t_field,
ConstTensor4View  vmr_field,
ConstVectorView  f_grid,
ConstVectorView  refellipsoid,
ConstVectorView  z_surface,
const Numeric lmax,
const Agenda refr_index_air_agenda,
const String rtrace_method,
const Numeric lraytrace 
)

ppath_step_refr_2d

Calculates 2D propagation path steps, with refraction, using a simple and fast ray tracing scheme.

Works as the same function for 1D despite that some input arguments are of different type.

Parameters
wsCurrent Workspace
ppathOut: A Ppath structure.
p_gridPressure grid.
lat_gridLatitude grid.
z_fieldAs the WSV with the same name.
t_fieldAs the WSV with the same name.
vmr_fieldAs the WSV with the same name.
f_gridAs the WSV with the same name.
refellipsoidAs the WSV with the same name.
z_surfaceSurface altitudes.
lmaxMaximum allowed length between the path points.
refr_index_air_agendaThe WSV with the same name.
rtrace_methodString giving which ray tracing method to use. See the function for options.
lraytraceMaximum allowed length for ray tracing steps.
Author
Patrick Eriksson
Date
2002-12-02

Definition at line 4121 of file ppath.cc.

References joker, Array< base >::nelem(), ppath_end_2d(), ppath_start_2d(), and raytrace_2d_linear_basic().

Referenced by ppath_stepRefractionBasic().

◆ ppath_step_refr_3d()

void ppath_step_refr_3d ( Workspace ws,
Ppath ppath,
ConstVectorView  p_grid,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid,
ConstTensor3View  z_field,
ConstTensor3View  t_field,
ConstTensor4View  vmr_field,
ConstVectorView  f_grid,
ConstVectorView  refellipsoid,
ConstMatrixView  z_surface,
const Numeric lmax,
const Agenda refr_index_air_agenda,
const String rtrace_method,
const Numeric lraytrace 
)

ppath_step_refr_3d

Calculates 3D propagation path steps, with refraction, using a simple and fast ray tracing scheme.

Works as the same function for 1D despite that some input arguments are of different type.

Parameters
wsCurrent Workspace
ppathOut: A Ppath structure.
p_gridPressure grid.
lat_gridLatitude grid.
lon_gridLongitude grid.
z_fieldGeometrical altitudes.
t_fieldAtmospheric temperatures.
vmr_fieldVMR values.
f_gridAs the WSV with the same name.
refellipsoidAs the WSV with the same name.
z_surfaceSurface altitudes.
lmaxMaximum allowed length between the path points.
refr_index_air_agendaThe WSV with the same name.
rtrace_methodString giving which ray tracing method to use. See the function for options.
lraytraceMaximum allowed length for ray tracing steps.
Author
Patrick Eriksson
Date
2003-01-08

Definition at line 4466 of file ppath.cc.

References Array< base >::nelem(), ppath_end_3d(), ppath_start_3d(), and raytrace_3d_linear_basic().

Referenced by ppath_stepRefractionBasic().

◆ ppath_what_background()

Index ppath_what_background ( const Ppath ppath)

ppath_what_background

Returns the case number for the radiative background.

See further the function ppath_set_background.

Returns
The case number.
Parameters
ppathA Ppath structure.
Author
Patrick Eriksson
Date
2002-05-17

Definition at line 1835 of file ppath.cc.

References Ppath::background.

Referenced by cloud_ppath_update1D(), cloud_ppath_update1D_noseq(), defocusing_general_sub(), defocusing_sat2sat(), fos(), get_iy_of_background(), iwp_cloud_opt_pathCalc(), iyEmissionStandard(), iyRadioLink(), mcPathTraceGeneral(), ppath_append(), ppath_calc(), ppath_stepGeometric(), ppath_stepRefractionBasic(), and ppathFromRtePos2().

◆ r_crossing_2d()

void r_crossing_2d ( Numeric lat,
Numeric l,
const Numeric r_hit,
const Numeric r_start,
const Numeric lat_start,
const Numeric za_start,
const Numeric ppc 
)

r_crossing_2d

Calculates where a 2D LOS crosses the specified radius.

The function only looks for crossings in the forward direction of the given zenith angle (neglecting all solutions giving l <= 0).

For cases with r_start <= r_hit and abs(za) > 90, the tangent point is passed and the returned crossing is on the other side of the tangent point.

LAT_NOT_FOUND and L_NOT_FOUND are returned if no solution is found.

Parameters
rOut: Radius of found crossing.
latOut: Latitude of found crossing.
lOut: Length along the path to the crossing.
r_hitRadius of the level
r_startRadius of start point.
lat_startLatitude of start point.
za_startZenith angle at start point.
ppcPropagation path constant
Author
Patrick Eriksson
Date
2012-02-18

Definition at line 914 of file ppath.cc.

References abs, geompath_l_at_r(), geompath_lat_at_za(), geompath_za_at_r(), L_NOT_FOUND, LAT_NOT_FOUND, and sign().

Referenced by plevel_crossing_2d(), and ppath_start_stepping().

◆ r_crossing_3d()

void r_crossing_3d ( Numeric lat,
Numeric lon,
Numeric l,
const Numeric r_hit,
const Numeric r_start,
const Numeric lat_start,
const Numeric lon_start,
const Numeric za_start,
const Numeric ppc,
const Numeric x,
const Numeric y,
const Numeric z,
const Numeric dx,
const Numeric dy,
const Numeric dz 
)

r_crossing_3d

Calculates where a 3D LOS crosses the specified radius

The solution algorithm is described in ATD. See the chapter on propagation paths.

The function only looks for crossings in the forward direction of the given zenith angle (neglecting all solutions giving l <= 0). Note that the tangent point can be passed.

LAT_NOT_FOUND, LON_NOT_FOUND and L_NOT_FOUND are returned if no solution is found.

Parameters
latOut: Latitude of found crossing.
lonOut: Longitude of found crossing.
lOut: Length along the path to the crossing.
r_hitTarget radius.
r_startRadius of start point.
lat_startLatitude of start point.
lon_startLongitude of start point.
za_startZenith angle at start point.
ppcPropagation path constant
xx-coordinate of start position.
yy-coordinate of start position.
zz-coordinate of start position.
dxx-part of LOS unit vector.
dyy-part of LOS unit vector.
dzz-part of LOS unit vector.
Author
Patrick Eriksson
Date
2002-12-30

Definition at line 1638 of file ppath.cc.

References abs, ANGTOL, dx, L_NOT_FOUND, LAT_NOT_FOUND, LON_NOT_FOUND, max, min, q, and RAD2DEG.

Referenced by plevel_crossing_3d(), and ppath_start_stepping().

◆ raytrace_1d_linear_basic()

void raytrace_1d_linear_basic ( Workspace ws,
Array< Numeric > &  r_array,
Array< Numeric > &  lat_array,
Array< Numeric > &  za_array,
Array< Numeric > &  l_array,
Array< Numeric > &  n_array,
Array< Numeric > &  ng_array,
Index endface,
ConstVectorView  p_grid,
ConstVectorView  refellipsoid,
ConstTensor3View  z_field,
ConstTensor3View  t_field,
ConstTensor4View  vmr_field,
ConstVectorView  f_grid,
const Numeric lmax,
const Agenda refr_index_air_agenda,
const Numeric lraytrace,
const Numeric rsurface,
const Numeric r1,
const Numeric r3,
Numeric  r,
Numeric  lat,
Numeric  za 
)

raytrace_1d_linear_basic

Performs ray tracing for 1D with linear steps.

A geometrical step with length of lraytrace is taken from each point. The zenith angle for the end point of that step is calculated considering the gradient of the refractive index. The length of the last ray tracing step is set to the distance to grid box boundary.

For more information read the chapter on propagation paths in AUG. The algorithm used is described in that part of ATD.

Parameters
wsCurrent Workspace
r_arrayOut: Radius of ray tracing points.
lat_arrayOut: Latitude of ray tracing points.
za_arrayOut: LOS zenith angle at ray tracing points.
l_arrayOut: Distance along the path between ray tracing points.
n_arrayOut: Refractive index at ray tracing points.
endfaceOut: Number coding of exit face.
p_gridThe WSV with the same name.
refellipsoidThe WSV with the same name.
lat_gridThe WSV with the same name.
z_fieldThe WSV with the same name.
t_fieldThe WSV with the same name.
vmr_fieldThe WSV with the same name.
f_gridAs the WSV with the same name.
lmaxAs the WSV ppath_lmax
refr_index_air_agendaThe WSV with the same name.
lraytraceMaximum allowed length for ray tracing steps.
r_surfaceRadius of the surface.
r1Radius of lower pressure level.
r3Radius of upper pressure level (r3 > r1).
rStart radius for ray tracing.
latStart latitude for ray tracing.
zaStart zenith angle for ray tracing.
Author
Patrick Eriksson
Date
2002-12-02

Definition at line 3658 of file ppath.cc.

References DEG2RAD, do_gridrange_1d(), geometrical_ppc(), geompath_l_at_r(), geompath_lat_at_za(), geompath_r_at_l(), geompath_za_at_r(), get_refr_index_1d(), ConstVectorView::nelem(), RAD2DEG, and refr_gradients_1d().

Referenced by ppath_step_refr_1d().

◆ raytrace_2d_linear_basic()

void raytrace_2d_linear_basic ( Workspace ws,
Array< Numeric > &  r_array,
Array< Numeric > &  lat_array,
Array< Numeric > &  za_array,
Array< Numeric > &  l_array,
Array< Numeric > &  n_array,
Array< Numeric > &  ng_array,
Index endface,
ConstVectorView  p_grid,
ConstVectorView  lat_grid,
ConstVectorView  refellipsoid,
ConstTensor3View  z_field,
ConstTensor3View  t_field,
ConstTensor4View  vmr_field,
ConstVectorView  f_grid,
const Numeric lmax,
const Agenda refr_index_air_agenda,
const Numeric lraytrace,
const Numeric lat1,
const Numeric lat3,
const Numeric rsurface1,
const Numeric rsurface3,
const Numeric r1a,
const Numeric r3a,
const Numeric r3b,
const Numeric r1b,
Numeric  r,
Numeric  lat,
Numeric  za 
)

raytrace_2d_linear_basic

Performs ray tracing for 2D with linear steps.

A geometrical step with length of lraytrace is taken from each point. The zenith angle for the end point of that step is calculated considering the gradient of the refractive index. The length of the last ray tracing step is set to the distance to grid box boundary.

For more information read the chapter on propagation paths in AUG. The algorithm used is described in that part of ATD.

Parameters
wsCurrent Workspace
r_arrayOut: Radius of ray tracing points.
lat_arrayOut: Latitude of ray tracing points.
za_arrayOut: LOS zenith angle at ray tracing points.
l_arrayOut: Distance along the path between ray tracing points.
n_arrayOut: Refractive index at ray tracing points.
endfaceOut: Number coding of exit face.
p_gridThe WSV with the same name.
lat_gridThe WSV with the same name.
refellipsoidThe WSV with the same name.
z_fieldThe WSV with the same name.
t_fieldThe WSV with the same name.
vmr_fieldThe WSV with the same name.
f_gridAs the WSV with the same name.
lmaxAs the WSV ppath_lmax
refr_index_air_agendaThe WSV with the same name.
lraytraceMaximum allowed length for ray tracing steps.
lat1Latitude of left end face of the grid cell.
lat3Latitude of right end face of the grid cell.
rsurface1Radius for the surface at lat1.
rsurface3Radius for the surface at lat3.
r1aRadius of lower-left corner of the grid cell.
r3aRadius of lower-right corner of the grid cell.
r3bRadius of upper-right corner of the grid cell.
r1bRadius of upper-left corner of the grid cell.
rStart radius for ray tracing.
latStart latitude for ray tracing.
zaStart zenith angle for ray tracing.
Author
Patrick Eriksson
Date
2002-12-02

Definition at line 3947 of file ppath.cc.

References abs, DEG2RAD, do_gridcell_2d_byltest(), geometrical_ppc(), geompath_l_at_r(), geompath_lat_at_za(), geompath_r_at_l(), geompath_za_at_r(), get_refr_index_2d(), ConstVectorView::nelem(), RAD2DEG, refr_gradients_2d(), and sign().

Referenced by ppath_step_refr_2d().

◆ raytrace_3d_linear_basic()

void raytrace_3d_linear_basic ( Workspace ws,
Array< Numeric > &  r_array,
Array< Numeric > &  lat_array,
Array< Numeric > &  lon_array,
Array< Numeric > &  za_array,
Array< Numeric > &  aa_array,
Array< Numeric > &  l_array,
Array< Numeric > &  n_array,
Array< Numeric > &  ng_array,
Index endface,
ConstVectorView  refellipsoid,
ConstVectorView  p_grid,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid,
ConstTensor3View  z_field,
ConstTensor3View  t_field,
ConstTensor4View  vmr_field,
ConstVectorView  f_grid,
const Numeric lmax,
const Agenda refr_index_air_agenda,
const Numeric lraytrace,
const Numeric lat1,
const Numeric lat3,
const Numeric lon5,
const Numeric lon6,
const Numeric rsurface15,
const Numeric rsurface35,
const Numeric rsurface36,
const Numeric rsurface16,
const Numeric r15a,
const Numeric r35a,
const Numeric r36a,
const Numeric r16a,
const Numeric r15b,
const Numeric r35b,
const Numeric r36b,
const Numeric r16b,
Numeric  r,
Numeric  lat,
Numeric  lon,
Numeric  za,
Numeric  aa 
)

raytrace_3d_linear_basic

Performs ray tracing for 3D with linear steps.

A geometrical step with length of lraytrace is taken from each point. The zenith angle for the end point of that step is calculated considering the gradient of the refractive index. The length of the last ray tracing step is set to the distance to grid box boundary.

For more information read the chapter on propagation paths in AUG. The algorithm used is described in that part of ATD.

Parameters
wsCurrent Workspace
r_arrayOut: Radius of ray tracing points.
lat_arrayOut: Latitude of ray tracing points.
lon_arrayOut: Longitude of ray tracing points.
za_arrayOut: LOS zenith angle at ray tracing points.
aa_arrayOut: LOS azimuth angle at ray tracing points.
l_arrayOut: Distance along the path between ray tracing points.
endfaceOut: Number coding of exit face.
n_arrayOut: Refractive index at ray tracing points.
lmaxAs the WSV ppath_lmax
refr_index_air_agendaThe WSV with the same name.
lraytraceMaximum allowed length for ray tracing steps.
refellipsoidThe WSV with the same name.
p_gridThe WSV with the same name.
lat_gridThe WSV with the same name.
lon_gridThe WSV with the same name.
z_fieldThe WSV with the same name.
t_fieldThe WSV with the same name.
vmr_fieldThe WSV with the same name.
f_gridAs the WSV with the same name.
lat1Latitude of left end face of the grid cell.
lat3Latitude of right end face of the grid cell.
lon5Lower longitude of the grid cell.
lon6Upper longitude of the grid cell.
rsurface15Radius for the surface at lat1 and lon5.
rsurface35Radius for the surface at lat3 and lon5.
rsurface36Radius for the surface at lat3 and lon6.
rsurface16Radius for the surface at lat1 and lon6.
r15aRadius of corner: lower p-level,lat1 and lon5.
r35aRadius of corner: lower p-level,lat3 and lon5.
r36aRadius of corner: lower p-level,lat3 and lon6.
r16aRadius of corner: lower p-level,lat1 and lon6.
r15bRadius of corner: upper p-level,lat1 and lon5.
r35bRadius of corner: upper p-level,lat3 and lon5.
r36bRadius of corner: upper p-level,lat3 and lon6.
r16bRadius of corner: upper p-level,lat1 and lon6.
rOut: Start radius for ray tracing.
latOut: Start latitude for ray tracing.
lonOut: Start longitude for ray tracing.
zaOut: Start zenith angle for ray tracing.
aaOut: Start azimuth angle for ray tracing.
Author
Patrick Eriksson
Date
2003-01-18

Definition at line 4258 of file ppath.cc.

References abs, adjust_los(), ANGTOL, cart2poslos(), DEG2RAD, do_gridcell_3d_byltest(), dx, geometrical_ppc(), get_refr_index_3d(), ConstVectorView::nelem(), poslos2cart(), RAD2DEG, refr_gradients_3d(), and resolve_lon().

Referenced by ppath_step_refr_3d().

◆ refraction_ppc()

Numeric refraction_ppc ( const Numeric r,
const Numeric za,
const Numeric refr_index_air 
)

refraction_ppc

Calculates the propagation path constant for cases with refraction.

Both positive and negative zenith angles are handled.

Returns
Path constant.
Parameters
rRadius.
zaLOS Zenith angle.
refr_index_airRefractive index.
Author
Patrick Eriksson
Date
2002-05-17

Definition at line 639 of file ppath.cc.

References abs, and DEG2RAD.

Referenced by ppath_step_refr_1d().

◆ resolve_lon()

void resolve_lon ( Numeric lon,
const Numeric lon5,
const Numeric lon6 
)

resolve_lon

Resolves which longitude angle that shall be used.

Longitudes are allowed to vary between -360 and 360 degress, while the inverse trigonomtric functions returns values between -180 and 180. This function determines if the longitude shall be shifted -360 or +360 to fit the longitudes set by the user.

The argument lon as input is a value calculated by some inverse trigonometric function. The arguments lon5 and lon6 are the lower and upper limit for the probable range for lon. The longitude lon* will be shifted with -360 or +360 degrees if lon is significantly outside lon5 and lon6. No error is given if it is not possible to obtain a value between lon5 and lon6.

Parameters
lonIn/Out: Longitude, possible shifted when returned.
lon5Lower limit of probable range for lon.
lon6Upper limit of probable range for lon
Author
Patrick Eriksson
Date
2003-01-05

Definition at line 675 of file ppath.cc.

Referenced by do_gridcell_3d(), do_gridcell_3d_byltest(), plevel_crossing_3d(), plevel_slope_3d(), ppath_start_stepping(), and raytrace_3d_linear_basic().

◆ rotationmat3D()

void rotationmat3D ( Matrix R,
ConstVectorView  vrot,
const Numeric a 
)

rotationmat3D

Creates a 3D rotation matrix

Creates a rotation matrix such that R * x, operates on x by rotating x around the origin a radians around line connecting the origin to the point vrot.

The function is based on rotationmat3D.m, by Belechi (the function is found in atmlab).

Parameters
ROut: Rotation matrix
vrotRotation axis
aRotation angle
Author
Bileschi and Patrick Eriksson
Date
2009-10-02

Definition at line 520 of file ppath.cc.

References DEG2RAD, ConstMatrixView::ncols(), ConstVectorView::nelem(), ConstMatrixView::nrows(), and w().

Referenced by map_daa().

◆ rslope_crossing2d()

Numeric rslope_crossing2d ( const Numeric rp,
const Numeric za,
const Numeric r0,
Numeric  c1 
)

rslope_crossing2d

Calculates the angular distance to a crossing with a level having a radial slope.

The function solves the problem for a pressure level, or the planet's surface, where the radius changes linearly as a function of angle. No analytical solution to the original problem has been found. The problem involves sine and cosine of the latitude difference and these functions are replaced with their Taylor expansions where the two first terms are kept. This should be OK for most practical situations (the accuracy should be sufficient for values up to 1 degree?).

The problem and its solution is further described in AUG. See the chapter on propagation paths. The variable names below are the same as in AUG.

Both positive and negative zenith angles are handled.

The function only looks for crossings in the forward direction of the given zenith angle.

If the given path point is on the pressure level (rp=r0), the solution 0 is rejected. The latitude difference is set to 999 if no crossing exists.

The cases c=0, za=0 and za=180 are not allowed.

Returns
The angular distance to the crossing.
Parameters
rpRadius of a point of the path inside the grid cell
zaZenith angle of the path at rp.
r0Radius of the pressure level or the surface at the latitude of rp.
c1Linear slope term, as returned by plevel_slope_2d.
Author
Patrick Eriksson
Date
2002-06-07

Definition at line 992 of file ppath.cc.

References abs, beta, DEG2RAD, dmin, LAT_NOT_FOUND, poly_root_solve(), RAD2DEG, and Matrix::resize().

Referenced by plevel_crossing_2d().

◆ rslope_crossing3d()

Numeric rslope_crossing3d ( const Numeric rp,
const Numeric za,
const Numeric r0,
Numeric  c1,
Numeric  c2 
)

rslope_crossing3d

3D version of rslope_crossing2d.

Returns
The angular distance to the crossing.
Parameters
rpRadius of a point of the path inside the grid cell
zaZenith angle of the path at rp.
r0Radius of the pressure level or the surface at the latitude of rp.
c1Linear slope term, as returned by plevel_slope_3d.
c2Quadratic slope term, as returned by plevel_slope_3d.
Author
Patrick Eriksson
Date
2012-04-24

Definition at line 1511 of file ppath.cc.

References abs, beta, DEG2RAD, dmin, LAT_NOT_FOUND, poly_root_solve(), RAD2DEG, and Matrix::resize().

Referenced by plevel_crossing_3d().

◆ rsurf_at_lat()

Numeric rsurf_at_lat ( const Numeric lat1,
const Numeric lat3,
const Numeric r1,
const Numeric r3,
const Numeric lat 
)

rsurf_at_lat

Determines the radius of a pressure level or the surface given the radius at the corners of a 2D grid cell.

Returns
Radius at the given latitude.
Parameters
lat1Lower latitude of grid cell.
lat3Upper latitude of grid cell.
r1Radius at lat1
r3Radius at lat3
latLatitude for which radius shall be determined.
Author
Patrick Eriksson
Date
2010-03-12

Definition at line 743 of file ppath.cc.

Referenced by do_gridcell_2d_byltest(), plevel_crossing_2d(), and ppath_start_2d().

◆ rsurf_at_latlon()

Numeric rsurf_at_latlon ( const Numeric lat1,
const Numeric lat3,
const Numeric lon5,
const Numeric lon6,
const Numeric r15,
const Numeric r35,
const Numeric r36,
const Numeric r16,
const Numeric lat,
const Numeric lon 
)

rsurf_at_latlon

Determines the radius of a pressure level or the surface given the radius at the corners of a 3D grid cell.

Returns
Radius at the given latitude and longitude.
Parameters
lat1Lower latitude of grid cell.
lat3Upper latitude of grid cell.
lon5Lower longitude of grid cell.
lon6Upper longitude of grid cell.
r15Radius at crossing of lat1 and lon5.
r35Radius at crossing of lat3 and lon5.
r36Radius at crossing of lat3 and lon6.
r16Radius at crossing of lat1 and lon6.
latLatitude for which radius shall be determined.
lonLongitude for which radius shall be determined.
Author
Patrick Eriksson
Date
2002-12-30

Definition at line 1294 of file ppath.cc.

Referenced by do_gridcell_3d_byltest(), plevel_crossing_3d(), plevel_slope_3d(), and ppath_end_3d().

◆ zaaa2cart()

void zaaa2cart ( Numeric dx,
Numeric dy,
Numeric dz,
const Numeric za,
const Numeric aa 
)

zaaa2cart

Converts zenith and azimuth angles to a cartesian unit vector.

This function and the sister function cart2zaaa handles transformation of line-of-sights. This in contrast to the sph/poslos functions that handles positions, or combinations of positions and line-of-sight.

The cartesian coordinate system used for these two functions can be defined as z : za = 0 x : za=90, aa=0 y : za=90, aa=90

Parameters
dxOut: x-part of LOS unit vector.
dyOut: y-part of LOS unit vector.
dzOut: z-part of LOS unit vector.
zaLOS zenith angle at observation position.
aaLOS azimuth angle at observation position.
Author
Patrick Eriksson
Date
2009-10-02

Definition at line 484 of file ppath.cc.

References DEG2RAD, and dx.

Referenced by adjust_los(), map_daa(), propmat_clearskyAddZeeman(), and specular_losCalc().

Variable Documentation

◆ DEG2RAD

◆ L_NOT_FOUND

◆ LACC

const Numeric LACC = 1e-5

◆ LAT_NOT_FOUND

◆ LATLONTOL

const Numeric LATLONTOL = 1e-8

Definition at line 83 of file ppath.cc.

Referenced by do_gridcell_2d_byltest(), and do_gridcell_3d_byltest().

◆ LON_NOT_FOUND

const Numeric LON_NOT_FOUND = 99e99

Definition at line 95 of file ppath.cc.

Referenced by lat_crossing_3d(), plevel_crossing_3d(), and r_crossing_3d().

◆ R_NOT_FOUND

const Numeric R_NOT_FOUND = -1

Definition at line 92 of file ppath.cc.

Referenced by lat_crossing_3d(), lon_crossing_3d(), plevel_crossing_2d(), and plevel_crossing_3d().

◆ RAD2DEG

◆ RTOL