ARTS 2.5.0 (git: 9ee3ac6c)
ppath.h File Reference

Propagation path structure and functions. More...

#include "agenda_class.h"
#include "array.h"
#include "arts.h"
#include "interpolation.h"
#include "matpackI.h"
#include "mystring.h"

Go to the source code of this file.

Classes

struct  Ppath
 The structure to describe a propagation path and releated quantities. More...
 

Typedefs

typedef Array< PpathArrayOfPpath
 An array of propagation paths. More...
 

Functions

void add_za_aa (Numeric &za, Numeric &aa, const Numeric &za0, const Numeric &aa0, const Numeric &dza, const Numeric &daa)
 Adds up zenith and azimuth angles. More...
 
void cart2zaaa (Numeric &za, Numeric &aa, const Numeric &dx, const Numeric &dy, const Numeric &dz)
 Converts a cartesian directional vector to zenith and azimuth. More...
 
void zaaa2cart (Numeric &dx, Numeric &dy, Numeric &dz, const Numeric &za, const Numeric &aa)
 Converts zenith and azimuth angles to a cartesian unit vector. More...
 
void enu2zaaa (Numeric &za, Numeric &aa, const Numeric &de, const Numeric &dn, const Numeric &du)
 Converts ENU unit vector vector to zenith and azimuth. More...
 
void zaaa2enu (Numeric &de, Numeric &dn, Numeric &du, const Numeric &za, const Numeric &aa)
 Converts zenith and azimuth angles to ENU unit vector. More...
 
void diff_za_aa (Numeric &dza, Numeric &daa, const Numeric &za0, const Numeric &aa0, const Numeric &za, const Numeric &aa)
 Takes the difference of zenith and azimuth angles. More...
 
void error_if_limb_ppath (const Ppath &ppath)
 Throws an error if ppath altitudes not are strictly increasing or decreasing. More...
 
void find_tanpoint (Index &it, const Ppath &ppath)
 Identifies the tangent point of a propagation path. More...
 
Index first_pos_before_altitude (const Ppath &p, const Numeric &alt)
 Determines ppath position just below an altitude. More...
 
Numeric geometrical_ppc (const Numeric &r, const Numeric &za)
 Calculates the propagation path constant for pure geometrical calculations. More...
 
Numeric geompath_lat_at_za (const Numeric &za0, const Numeric &lat0, const Numeric &za)
 Calculates the latitude for a given zenith angle along a geometrical propagation path. More...
 
Numeric geompath_l_at_r (const Numeric &ppc, const Numeric &r)
 Calculates the length from the tangent point for the given radius. More...
 
Numeric geompath_r_at_l (const Numeric &ppc, const Numeric &l)
 Calculates the radius for a distance from the tangent point. More...
 
Numeric geompath_za_at_r (const Numeric &ppc, const Numeric &a_za, const Numeric &r)
 Calculates the zenith angle for a given radius along a geometrical propagation path. More...
 
bool is_los_downwards (const Numeric &za, const Numeric &tilt)
 Determines if a line-of-sight is downwards compared to the angular tilt of the surface or a pressure level. More...
 
Numeric plevel_angletilt (const Numeric &r, const Numeric &c)
 Calculates the angular tilt of the surface or a pressure level. More...
 
void plevel_slope_2d (Numeric &c1, ConstVectorView lat_grid, ConstVectorView refellipsoid, ConstVectorView z_surf, const GridPos &gp, const Numeric &za)
 Calculates the radial slope of the surface or a pressure level for 2D. 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)
 Calculates the radial slope of the surface or a pressure level for 3D. 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 &z_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_lmax, const Numeric &ppath_lraytrace, const bool &ppath_inside_cloudbox_do, const Verbosity &verbosity)
 This is the core for the WSM ppathStepByStep. More...
 
void ppath_copy (Ppath &ppath1, const Ppath &ppath2, const Index &ncopy)
 Copy the content in ppath2 to ppath1. More...
 
void ppath_init_structure (Ppath &ppath, const Index &atmosphere_dim, const Index &np)
 Initiates a Ppath structure to hold the given number of points. More...
 
void ppath_set_background (Ppath &ppath, const Index &case_nr)
 Sets the background field of a Ppath structure. 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 &outside_cloudbox, ConstVectorView rte_pos, ConstVectorView rte_los, const Verbosity &verbosity)
 Initiates a Ppath structure for calculation of a path with ppath_step. More...
 
void ppath_step_geom_1d (Ppath &ppath, ConstVectorView z_field, ConstVectorView refellipsoid, const Numeric &z_surface, const Numeric &lmax)
 Calculates 1D geometrical propagation path steps. More...
 
void ppath_step_geom_2d (Ppath &ppath, ConstVectorView lat_grid, ConstMatrixView z_field, ConstVectorView refellipsoid, ConstVectorView z_surface, const Numeric &lmax)
 Calculates 2D geometrical propagation path steps. 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)
 Calculates 3D geometrical propagation path steps. 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_agenda, const String &rtrace_method, const Numeric &lraytrace)
 Calculates 1D propagation path steps including effects of refraction. 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_agenda, const String &rtrace_method, const Numeric &lraytrace)
 Calculates 2D propagation path steps, with refraction, using a simple and fast ray tracing scheme. 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_agenda, const String &rtrace_method, const Numeric &lraytrace)
 Calculates 3D propagation path steps, with refraction, using a simple and fast ray tracing scheme. More...
 
Index ppath_what_background (const Ppath &ppath)
 Returns the case number for the radiative background. More...
 
void resolve_lon (Numeric &lon, const Numeric &lon5, const Numeric &lon6)
 Resolves which longitude angle that shall be used. More...
 

Variables

const Numeric POLELAT = 90 - 1e-8
 Size of north and south poles. More...
 
const Numeric ANGTOL = 1e-6
 Width of zenith and nadir directions. More...
 

Detailed Description

Propagation path structure and functions.

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

This file contains the definition of the Ppath structure and the functions in ppath.cc that are of interest elsewhere.

Definition in file ppath.h.

Typedef Documentation

◆ ArrayOfPpath

An array of propagation paths.

Definition at line 90 of file ppath.h.

Function Documentation

◆ add_za_aa()

void add_za_aa ( Numeric za,
Numeric aa,
const Numeric za0,
const Numeric aa0,
const Numeric dza,
const Numeric daa 
)

Adds up zenith and azimuth angles.

Adds (dza,daa) to (za0,aa0), assuming that a unit changes in za and aa are equal where (dza,daa)=(0,0).

Parameters
[out]zaEnd zenith angle
[out]aaEnd azimuth angle
[in]za0Start zenith angle
[in]aa0Start azimuth angle
[in]dzaChange in zenith angle
[in]daaChange in azimuth angle
Author
Patrick Eriksson
Date
2018-12-19

Definition at line 391 of file ppath.cc.

References u, and zaaa2cart().

Referenced by AddZaAa(), iyb_calc_body(), and Test().

◆ cart2zaaa()

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

Converts a cartesian directional vector to zenith and azimuth.

This function and the sister function cart2zaaa handle 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
[out]zaLOS zenith angle at observation position.
[out]aaLOS azimuth angle at observation position.
[in]dxx-part of LOS unit vector.
[in]dyy-part of LOS unit vector.
[in]dzz-part of LOS unit vector.
Author
Patrick Eriksson
Date
2009-10-02

Definition at line 299 of file ppath.cc.

References ARTS_ASSERT, dx, RAD2DEG, and sqrt().

Referenced by adjust_los(), and specular_losCalc().

◆ diff_za_aa()

void diff_za_aa ( Numeric dza,
Numeric daa,
const Numeric za0,
const Numeric aa0,
const Numeric za,
const Numeric aa 
)

Takes the difference of zenith and azimuth angles.

Takes the difference between a set of angles (za,aa) and a reference direction (za0,aa0). That is, this function is the "inverse" of add_za_aa.

Parameters
[out]dzaChange in zenith angle
[out]daaChange in azimuth angle
[in]za0Zenith angle of reference direction
[in]aa0Azimuth angle of reference direction
[in]zaZenith angle of second direction
[in]aaAzimuth angle of second direction
Author
Patrick Eriksson
Date
2018-12-19

Definition at line 429 of file ppath.cc.

References ARTS_ASSERT, u, and zaaa2cart().

Referenced by DiffZaAa(), and Test().

◆ enu2zaaa()

void enu2zaaa ( Numeric za,
Numeric aa,
const Numeric de,
const Numeric dn,
const Numeric du 
)

Converts ENU unit vector vector to zenith and azimuth.

This function and the sister function enu2zaaa handles transformation of line-of-sights, from and to ENU (east-north-up). The ENU vector is normalised to have length 1.

Parameters
[out]zaLOS zenith angle at observation position.
[out]aaLOS azimuth angle at observation position.
[in]dee-part of LOS unit vector.
[in]dnn-part of LOS unit vector.
[in]duu-part of LOS unit vector.
Author
Patrick Eriksson
Date
2020-09-17

Definition at line 326 of file ppath.cc.

References RAD2DEG.

◆ error_if_limb_ppath()

void error_if_limb_ppath ( const Ppath ppath)

Throws an error if ppath altitudes not are strictly increasing or decreasing.

Parameters
[in]ppathPropagation path structure.
Author
Patrick Eriksson
Date
2018-03-07

Definition at line 540 of file ppath.cc.

References ARTS_USER_ERROR_IF, Ppath::np, Ppath::pos, and sign().

Referenced by iyIndependentBeamApproximation(), and yRadar().

◆ find_tanpoint()

void find_tanpoint ( Index it,
const Ppath ppath 
)

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
[out]itIndex of tangent point
[in]ppathPropagation path structure.
Author
Patrick Eriksson
Date
2012-04-07

Definition at line 510 of file ppath.cc.

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

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

◆ first_pos_before_altitude()

Index first_pos_before_altitude ( const Ppath p,
const Numeric alt 
)

Determines ppath position just below an altitude.

Returns -1 if the selected altitude is not passed.

Parameters
[in]ppathPropagation path structure.
[in]altAltitude
Returns
Index of found altitude
Author
Richard Larsson
Date
20??-??-??

Definition at line 522 of file ppath.cc.

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

Referenced by ppathCalcFromAltitude().

◆ geometrical_ppc()

Numeric geometrical_ppc ( const Numeric r,
const Numeric za 
)

Calculates the propagation path constant for pure geometrical calculations.

Both positive and negative zenith angles are handled.

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

Definition at line 96 of file ppath.cc.

References abs, ARTS_ASSERT, 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_l_at_r()

Numeric geompath_l_at_r ( const Numeric ppc,
const Numeric 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.

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

Definition at line 158 of file ppath.cc.

References ARTS_ASSERT, RTOL, and sqrt().

Referenced by cart2poslos(), geompath_from_r1_to_r2(), 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 
)

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.

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

Definition at line 148 of file ppath.cc.

References abs, and ARTS_ASSERT.

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 
)

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.

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

Definition at line 169 of file ppath.cc.

References ARTS_ASSERT, Interpolation::l(), and sqrt().

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

◆ geompath_za_at_r()

Numeric geompath_za_at_r ( const Numeric ppc,
const Numeric a_za,
const Numeric 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.

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

Definition at line 103 of file ppath.cc.

References abs, ARTS_ASSERT, RAD2DEG, and RTOL.

Referenced by 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 
)

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.

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

Definition at line 622 of file ppath.cc.

References abs, and ARTS_ASSERT.

Referenced by ppath_start_2d(), and ppath_start_stepping().

◆ plevel_angletilt()

Numeric plevel_angletilt ( const Numeric r,
const Numeric c 
)

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.

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

Definition at line 616 of file ppath.cc.

References RAD2DEG.

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

◆ plevel_slope_2d()

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

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
[out]c1The radial slope [m/degree]
[in]lat_gridThe latitude grid.
[in]refellipsoidAs the WSV with the same name.
[in]z_surfGeometrical altitude of the surface, or the pressure level of interest, for the latitide dimension
[in]gpLatitude grid position for the position of interest
[in]zaLOS zenith angle.
Author
Patrick Eriksson
Date
2002-06-03

Definition at line 579 of file ppath.cc.

References gridpos2gridrange(), and refell2r().

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

◆ plevel_slope_3d()

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 
)

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
[out]c1See above. Unit is m/degree.
[out]c2See above. Unit is m/degree^2.
[in]lat1Lower latitude of grid cell.
[in]lat3Upper latitude of grid cell.
[in]lon5Lower longitude of grid cell.
[in]lon6Upper longitude of grid cell.
[in]r15Radius at crossing of lat1 and lon5.
[in]r35Radius at crossing of lat3 and lon5.
[in]r36Radius at crossing of lat3 and lon6.
[in]r16Radius at crossing of lat1 and lon6.
[in]latLatitude for which slope shall be determined.
[in]lonLongitude for which slope shall be determined.
[in]aaAzimuth angle for which slope shall be determined.
Author
Patrick Eriksson
Date
2002-12-30

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
[out]c1See above. Unit is m/degree.
[out]c2See above. Unit is m/degree^2.
[in]lat_gridThe latitude grid.
[in]lon_gridThe longitude grid.
[in]refellipsoidAs the WSV with the same name.
[in]z_surfGeometrical altitude of the surface, or the pressure level of interest.
[in]gp_latLatitude grid position for the position of interest.
[in]gp_lonLongitude grid position for the position of interest.
[in]aaAzimuth angle.
Author
Patrick Eriksson
Date
2002-06-03

Definition at line 1145 of file ppath.cc.

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

◆ 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 z_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_lmax,
const Numeric ppath_lraytrace,
const bool &  ppath_inside_cloudbox_do,
const Verbosity verbosity 
)

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
[in]wsCurrent Workspace
[in]ppathOutput: A Ppath structure
[in]ppath_step_agendaAs the WSM with the same name.
[in]atmosphere_dimThe atmospheric dimensionality.
[in]p_gridThe pressure grid.
[in]lat_gridThe latitude grid.
[in]lon_gridThe longitude grid.
[in]z_fieldAs the WSM with the same name.
[in]f_gridAs the WSM with the same name.
[in]refellipsoidAs the WSM with the same name.
[in]z_surfaceSurface altitude.
[in]cloudbox_onFlag to activate the cloud box.
[in]cloudbox_limitsIndex limits of the cloud box.
[in]rte_posThe position of the sensor.
[in]rte_losThe line-of-sight of the sensor.
[in]ppath_lmaxAs the WSM with the same name.
[in]ppath_lraytraceAs the WSM with the same name.
[in]ppath_inside_cloudbox_doAs the WSM with the same name.
Author
Patrick Eriksson
Date
2003-01-08

Definition at line 5175 of file ppath.cc.

References abs, ARTS_ASSERT, ARTS_USER_ERROR, ARTS_USER_ERROR_IF, 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(), ppathFromRtePos2(), and ppathStepByStep().

◆ ppath_copy()

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

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
[in]ppath1Output: Ppath structure.
[in]ppath2The ppath structure to be copied.
[in]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 1496 of file ppath.cc.

References ARTS_ASSERT, 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_init_structure()

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

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

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
[in]ppathOutput: A Ppath structure.
[in]atmosphere_dimThe atmospheric dimensionality.
[in]npNumber of points of the path.
Author
Patrick Eriksson
Date
2002-05-17

Definition at line 1409 of file ppath.cc.

References ARTS_ASSERT, 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(), ppathFromRtePos2(), and ppathPlaneParallel().

◆ ppath_set_background()

void ppath_set_background ( Ppath ppath,
const Index case_nr 
)

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
[in]ppathOutput: A Ppath structure.
[in]case_nrCase number (see above)
Author
Patrick Eriksson
Date
2002-05-17

Definition at line 1450 of file ppath.cc.

References ARTS_USER_ERROR, and Ppath::background.

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

◆ 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 &  outside_cloudbox,
ConstVectorView  rte_pos,
ConstVectorView  rte_los,
const Verbosity verbosity 
)

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

Definition at line 4476 of file ppath.cc.

References abs, ARTS_ASSERT, ARTS_USER_ERROR_IF, 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 mcPathTraceRadar(), 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 
)

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
[in]ppathOutput: A Ppath structure.
[in]z_fieldGeometrical altitudes corresponding to p_grid.
[in]refellipsoidAs the WSV with the same name.
[in]z_surfaceSurface altitude.
[in]lmaxMaximum allowed length between the path points.
Author
Patrick Eriksson
Date
2002-05-20

Definition at line 2353 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 
)

Calculates 2D geometrical propagation path steps.

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

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

Definition at line 2717 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 
)

Calculates 3D geometrical propagation path steps.

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

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

Definition at line 3251 of file ppath.cc.

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

Referenced by 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_agenda,
const String rtrace_method,
const Numeric lraytrace 
)

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
[in,out]wsCurrent Workspace
[out]ppathA Ppath structure.
[in]p_gridPressure grid.
[in]z_fieldAs the WSV with the same name.
[in]t_fieldAs the WSV with the same name.
[in]vmr_fieldAs the WSV with the same name.
[in]f_gridAs the WSV with the same name.
[in]refellipsoidAs the WSV with the same name.
[in]z_surfaceSurface altitude (1D).
[in]lmaxMaximum allowed length between the path points.
[in]refr_index_air_agendaThe WSV with the same name.
[in]rtrace_methodString giving which ray tracing method to use. See the function for options.
[in]lraytraceMaximum allowed length for ray tracing steps.
Author
Patrick Eriksson
Date
2002-11-26

Definition at line 3557 of file ppath.cc.

References ARTS_ASSERT, 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_agenda,
const String rtrace_method,
const Numeric lraytrace 
)

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
[in,out]wsCurrent Workspace
[out]ppathA Ppath structure.
[in]p_gridPressure grid.
[in]lat_gridLatitude grid.
[in]z_fieldAs the WSV with the same name.
[in]t_fieldAs the WSV with the same name.
[in]vmr_fieldAs the WSV with the same name.
[in]f_gridAs the WSV with the same name.
[in]refellipsoidAs the WSV with the same name.
[in]z_surfaceSurface altitudes.
[in]lmaxMaximum allowed length between the path points.
[in]refr_index_air_agendaThe WSV with the same name.
[in]rtrace_methodString giving which ray tracing method to use. See the function for options.
[in]lraytraceMaximum allowed length for ray tracing steps.
Author
Patrick Eriksson
Date
2002-12-02

Definition at line 3901 of file ppath.cc.

References ARTS_ASSERT, 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_agenda,
const String rtrace_method,
const Numeric lraytrace 
)

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
[in,out]wsCurrent Workspace
[out]ppathA Ppath structure.
[in]p_gridPressure grid.
[in]lat_gridLatitude grid.
[in]lon_gridLongitude grid.
[in]z_fieldGeometrical altitudes.
[in]t_fieldAtmospheric temperatures.
[in]vmr_fieldVMR values.
[in]f_gridAs the WSV with the same name.
[in]refellipsoidAs the WSV with the same name.
[in]z_surfaceSurface altitudes.
[in]lmaxMaximum allowed length between the path points.
[in]refr_index_air_agendaThe WSV with the same name.
[in]rtrace_methodString giving which ray tracing method to use. See the function for options.
[in]lraytraceMaximum allowed length for ray tracing steps.
Author
Patrick Eriksson
Date
2003-01-08

Definition at line 4316 of file ppath.cc.

References ARTS_ASSERT, 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)

Returns the case number for the radiative background.

See further the function ppath_set_background.

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

Definition at line 1476 of file ppath.cc.

References ARTS_USER_ERROR, and Ppath::background.

Referenced by defocusing_general_sub(), defocusing_sat2sat(), get_iy_of_background(), iyEmissionStandard(), iyHybrid(), iyRadarSingleScat(), iyTransmissionStandard(), mcPathTraceRadar(), ppath_append(), ppath_calc(), ppath_stepGeometric(), ppath_stepRefractionBasic(), and ppathFromRtePos2().

◆ resolve_lon()

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

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
[in,out]lonLongitude, possible shifted when returned.
[in]lon5Lower limit of probable range for lon.
[in]lon6Upper limit of probable range for lon
Author
Patrick Eriksson
Date
2003-01-05

Definition at line 500 of file ppath.cc.

References ARTS_ASSERT.

Referenced by do_gridcell_3d_byltest(), ppath_start_stepping(), raytrace_3d_linear_basic(), surf_radius_at_l(), and surfaceFastem().

◆ zaaa2cart()

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

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
[out]dxx-part of LOS unit vector.
[out]dyy-part of LOS unit vector.
[out]dzz-part of LOS unit vector.
[in]zaLOS zenith angle at observation position.
[in]aaLOS azimuth angle at observation position.
Author
Patrick Eriksson
Date
2009-10-02

Definition at line 312 of file ppath.cc.

References DEG2RAD, and dx.

Referenced by add_za_aa(), adjust_los(), diff_za_aa(), and specular_losCalc().

◆ zaaa2enu()

void zaaa2enu ( Numeric de,
Numeric dn,
Numeric du,
const Numeric za,
const Numeric aa 
)

Converts zenith and azimuth angles to ENU unit vector.

This function and the sister function enu2zaaa handles transformation of line-of-sights, from and to ENU (east-north-up). The ENU vector is normalised to have length 1.

Parameters
[out]dee-part of LOS unit vector.
[out]dnn-part of LOS unit vector.
[out]duu-part of LOS unit vector.
[in]zaLOS zenith angle at observation position.
[in]aaLOS azimuth angle at observation position.
Author
Patrick Eriksson
Date
2020-09-17

Definition at line 335 of file ppath.cc.

References DEG2RAD.

Variable Documentation

◆ ANGTOL

const Numeric ANGTOL = 1e-6

Width of zenith and nadir directions.

This variable defines how much zenith and azimuth angles can deviate from 0, 90 and 180 degrees, but still be treated to be 0, 90 or 180. For example, an azimuth angle of 180-0.999*ANGTOL will be treated as a strictly southward observation. However, the angles are not allowed to go outside their defined range. This means, for example, that values above 180 are never allowed.

Definition at line 108 of file ppath.h.

Referenced by cart2pol(), cart2poslos(), cart2sph(), do_gridcell_2d_byltest(), do_gridcell_3d_byltest(), geompath_from_r1_to_r2(), plevel_crossing_2d(), r_crossing_3d(), and raytrace_3d_linear_basic().

◆ POLELAT

const Numeric POLELAT = 90 - 1e-8

Size of north and south poles.

Latitudes with an absolute value > POLELAT are considered to be on the south or north pole for 3D.

Definition at line 97 of file ppath.h.

Referenced by cart2poslos(), cart2sph(), do_gridcell_3d_byltest(), plevel_slope_3d(), poslos2cart(), and ppath_end_3d().