ARTS 2.5.11 (git: 6827797f)
geodetic.cc File Reference
#include "geodetic.h"
#include <cmath>
#include <stdexcept>
#include "arts_conversions.h"
#include "math_funcs.h"
#include "ppath.h"

Go to the source code of this file.

Functions

void cart2pol (Numeric &r, Numeric &lat, const Numeric &x, const Numeric &z, const Numeric &lat0, const Numeric &za0)
 cart2pol
 
void cart2poslos (Numeric &r, Numeric &lat, Numeric &za, const Numeric &x, const Numeric &z, const Numeric &dx, const Numeric &dz, const Numeric &ppc, const Numeric &lat0, const Numeric &za0)
 cart2poslos
 
void distance2D (Numeric &l, const Numeric &r1, const Numeric &lat1, const Numeric &r2, const Numeric &lat2)
 distance2D
 
void line_circle_intersect (Numeric &x, Numeric &z, const Numeric &xl, const Numeric &zl, const Numeric &dx, const Numeric &dz, const Numeric &xc, const Numeric &zc, const Numeric &r)
 geomtanpoint2d
 
void pol2cart (Numeric &x, Numeric &z, const Numeric &r, const Numeric &lat)
 pol2cart
 
void poslos2cart (Numeric &x, Numeric &z, Numeric &dx, Numeric &dz, const Numeric &r, const Numeric &lat, const Numeric &za)
 poslos2cart
 
void cart2poslos (Numeric &r, Numeric &lat, Numeric &lon, Numeric &za, Numeric &aa, const Numeric &x, const Numeric &y, const Numeric &z, const Numeric &dx, const Numeric &dy, const Numeric &dz, const Numeric &ppc, const Numeric &x0, const Numeric &y0, const Numeric &z0, const Numeric &lat0, const Numeric &lon0, const Numeric &za0, const Numeric &aa0)
 cart2poslos
 
void cart2poslos_plain (Numeric &r, Numeric &lat, Numeric &lon, Numeric &za, Numeric &aa, const Numeric &x, const Numeric &y, const Numeric &z, const Numeric &dx, const Numeric &dy, const Numeric &dz)
 
void cart2sph (Numeric &r, Numeric &lat, Numeric &lon, const Numeric &x, const Numeric &y, const Numeric &z, const Numeric &lat0, const Numeric &lon0, const Numeric &za0, const Numeric &aa0)
 cart2sph
 
void cart2sph_plain (Numeric &r, Numeric &lat, Numeric &lon, const Numeric &x, const Numeric &y, const Numeric &z)
 
void distance3D (Numeric &l, const Numeric &r1, const Numeric &lat1, const Numeric &lon1, const Numeric &r2, const Numeric &lat2, const Numeric &lon2)
 distance3D
 
void geompath_tanpos_3d (Numeric &r_tan, Numeric &lat_tan, Numeric &lon_tan, Numeric &l_tan, const Numeric &r, const Numeric &lat, const Numeric &lon, const Numeric &za, const Numeric &aa, const Numeric &ppc)
 geompath_tanpos_3d
 
void line_refellipsoid_intersect (Numeric &l, const Vector &refellipsoid, const Numeric &x, const Numeric &y, const Numeric &z, const Numeric &dx, const Numeric &dy, const Numeric &dz)
 geomtanpoint
 
void line_sphere_intersect (Numeric &x, Numeric &y, Numeric &z, const Numeric &xl, const Numeric &yl, const Numeric &zl, const Numeric &dx, const Numeric &dy, const Numeric &dz, const Numeric &xc, const Numeric &yc, const Numeric &zc, const Numeric &r)
 line_sphere_intersect
 
void latlon_at_aa (Numeric &lat2, Numeric &lon2, const Numeric &lat1, const Numeric &lon1, const Numeric &aa, const Numeric &ddeg)
 latlon_at_aa
 
void los2xyz (Numeric &za, Numeric &aa, const Numeric &r1, const Numeric &lat1, const Numeric &lon1, const Numeric &x1, const Numeric &y1, const Numeric &z1, const Numeric &x2, const Numeric &y2, const Numeric &z2)
 los2xyz
 
void poslos2cart (Numeric &x, Numeric &y, Numeric &z, Numeric &dx, Numeric &dy, Numeric &dz, const Numeric &r, const Numeric &lat, const Numeric &lon, const Numeric &za, const Numeric &aa)
 poslos2cart
 
Numeric pos2refell_r (const Index &atmosphere_dim, ConstVectorView refellipsoid, ConstVectorView lat_grid, ConstVectorView lon_grid, ConstVectorView rte_pos)
 pos2refell_r
 
Numeric refell2r (ConstVectorView refellipsoid, const Numeric &lat)
 refell2r
 
Numeric refell2d (ConstVectorView refellipsoid, ConstVectorView lat_grid, const GridPos gp)
 refell2d
 
Numeric sphdist (const Numeric &lat1, const Numeric &lon1, const Numeric &lat2, const Numeric &lon2)
 sphdist
 
void sph2cart (Numeric &x, Numeric &y, Numeric &z, const Numeric &r, const Numeric &lat, const Numeric &lon)
 sph2cart
 
void lon_shiftgrid (Vector &longrid_out, ConstVectorView longrid_in, const Numeric lon)
 lon_shiftgrid
 
void cycle_lat_lon (Numeric &lat, Numeric &lon)
 Cyclic latitude longitude coordinates.
 
void cart2geodetic (Numeric &h, Numeric &lat, Numeric &lon, const Numeric &x, const Numeric &y, const Numeric &z, const Vector &refellipsoid)
 Conversion from cartesian to geodetic coordinates.
 
void geodetic2cart (Numeric &x, Numeric &y, Numeric &z, const Numeric &h, const Numeric &lat, const Numeric &lon, const Vector &refellipsoid)
 Conversion from geodetic to cartesian coordinates.
 
void geodeticposlos2cart (Numeric &x, Numeric &y, Numeric &z, Numeric &dx, Numeric &dy, Numeric &dz, const Numeric &h, const Numeric &lat, const Numeric &lon, const Numeric &za, const Numeric &aa, const Vector &refellipsoid)
 geodeticposlos2cart
 
void cart2geodeticposlos (Numeric &h, Numeric &lat, Numeric &lon, Numeric &za, Numeric &aa, const Numeric &x, const Numeric &y, const Numeric &z, const Numeric &dx, const Numeric &dy, const Numeric &dz, const Vector &refellipsoid)
 cart2geodeticposlos
 

Variables

constexpr Numeric DEG2RAD =Conversion::deg2rad(1)
 
constexpr Numeric RAD2DEG =Conversion::rad2deg(1)
 

Detailed Description

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
2012-02-06

This file contains functions associated with the reference ellipsoid, conversion between latitudes and similar stuff.

Definition in file geodetic.cc.

Function Documentation

◆ cart2geodetic()

void cart2geodetic ( Numeric &  h,
Numeric &  lat,
Numeric &  lon,
const Numeric &  x,
const Numeric &  y,
const Numeric &  z,
const Vector &  refellipsoid 
)

Conversion from cartesian to geodetic coordinates.

Definition at line 1457 of file geodetic.cc.

References cart2sph_plain(), and RAD2DEG.

Referenced by cart2geodeticposlos().

◆ cart2geodeticposlos()

void cart2geodeticposlos ( Numeric &  h,
Numeric &  lat,
Numeric &  lon,
Numeric &  za,
Numeric &  aa,
const Numeric &  x,
const Numeric &  y,
const Numeric &  z,
const Numeric &  dx,
const Numeric &  dy,
const Numeric &  dz,
const Vector &  refellipsoid 
)

cart2geodeticposlos

The inverse of geodeticposlos2cart.

Parameters
hOut: Geodetic altitude.
latOut: Geodetic latitude
lonOut: Longitude
zaOut: LOS zenith angle
aaOut: LOS azimuth angle
xx-coordinate
yy-coordinate
zz-coordinate
dxx-part of LOS unit vector.
dyy-part of LOS unit vector.
dzz-part of LOS unit vector.
Author
Patrick Eriksson
Date
2020-09-17

Definition at line 1621 of file geodetic.cc.

References cart2geodetic(), DEG2RAD, and enu2zaaa().

Referenced by y_geoToGeodetic().

◆ cart2pol()

void cart2pol ( Numeric &  r,
Numeric &  lat,
const Numeric &  x,
const Numeric &  z,
const Numeric &  lat0,
const Numeric &  za0 
)

cart2pol

The inverse of pol2cart.

A 2D version of cart2sph

Parameters
rOut: Radius of position.
latOut: Latitude of position.
xx-coordinate of position.
zz-coordinate of position.
lat0Original latitude.
za0Original zenith angle.
Author
Patrick Eriksson
Date
2012-03-20

Definition at line 57 of file geodetic.cc.

References ANGTOL, and RAD2DEG.

Referenced by defocusing_general_sub(), and do_gridcell_2d_byltest().

◆ cart2poslos() [1/2]

void cart2poslos ( Numeric &  r,
Numeric &  lat,
Numeric &  lon,
Numeric &  za,
Numeric &  aa,
const Numeric &  x,
const Numeric &  y,
const Numeric &  z,
const Numeric &  dx,
const Numeric &  dy,
const Numeric &  dz,
const Numeric &  ppc,
const Numeric &  x0,
const Numeric &  y0,
const Numeric &  z0,
const Numeric &  lat0,
const Numeric &  lon0,
const Numeric &  za0,
const Numeric &  aa0 
)

cart2poslos

The inverse of poslos2cart.

Beside the cartesian coordinates (x,y,z,dx,dy,dz), the function takes as input information about the original position and LOS. The later data are used to improve the accuracy. For example, for zenith and nadir cases it is ensured that the latitude and longitude are not changed. This makes the function slower, but accuarcy is favoured as zenith, nadir, north and south line-of-sights are especially tricky as they can go along a grid box boundary and the smallest rounding error can move the path from one grid box to the neighbouring one.

Parameters
rOut: Radius of observation position.
latOut: Latitude of observation position.
lonOut: Longitude of observation position.
zaOut: LOS zenith angle at observation position.
aaOut: LOS azimuth angle at observation position.
xx-coordinate of observation position.
yy-coordinate of observation position.
zz-coordinate of observation position.
dxx-part of LOS unit vector.
dyy-part of LOS unit vector.
dzz-part of LOS unit vector.
ppcPropagation path constant (r*sin(za))
lat0Original latitude.
lon0Original longitude.
za0Original zenith angle.
aa0Original azimuth angle.
Author
Patrick Eriksson
Date
2002-12-30

Definition at line 404 of file geodetic.cc.

References ANGTOL, DEG2RAD, geompath_l_at_r(), POLELAT, and RAD2DEG.

◆ cart2poslos() [2/2]

void cart2poslos ( Numeric &  r,
Numeric &  lat,
Numeric &  za,
const Numeric &  x,
const Numeric &  z,
const Numeric &  dx,
const Numeric &  dz,
const Numeric &  ppc,
const Numeric &  lat0,
const Numeric &  za0 
)

cart2poslos

2D version of the 3D cart2poslos.

Parameters
rOut: Radius of observation position.
latOut: Latitude of observation position.
zaOut: LOS zenith angle at observation position.
xx-coordinate of observation position.
zz-coordinate of observation position.
dxx-part of LOS unit vector.
dzz-part of LOS unit vector.
ppcPropagation path constant (r*sin(za))
lat0Original latitude.
za0Original zenith angle.
Author
Patrick Eriksson
Date
2012-03-21

Definition at line 96 of file geodetic.cc.

References ANGTOL, DEG2RAD, and RAD2DEG.

Referenced by do_gridcell_2d_byltest(), do_gridcell_3d_byltest(), ppath_start_stepping(), and raytrace_3d_linear_basic().

◆ cart2poslos_plain()

void cart2poslos_plain ( Numeric &  r,
Numeric &  lat,
Numeric &  lon,
Numeric &  za,
Numeric &  aa,
const Numeric &  x,
const Numeric &  y,
const Numeric &  z,
const Numeric &  dx,
const Numeric &  dy,
const Numeric &  dz 
)

◆ cart2sph()

void cart2sph ( Numeric &  r,
Numeric &  lat,
Numeric &  lon,
const Numeric &  x,
const Numeric &  y,
const Numeric &  z,
const Numeric &  lat0,
const Numeric &  lon0,
const Numeric &  za0,
const Numeric &  aa0 
)

cart2sph

The inverse of sph2cart.

For definition of lat0, lon0, za0 and aa0, see cart2poslos.

Parameters
rOut: Radius of observation position.
latOut: Latitude of observation position.
lonOut: Longitude of observation position.
xx-coordinate of observation position.
yy-coordinate of observation position.
zz-coordinate of observation position.
lat0Original latitude.
lon0Original longitude.
za0Original zenith angle.
aa0Original azimuth angle.
Author
Patrick Eriksson
Date
2002-12-30

Definition at line 585 of file geodetic.cc.

References ANGTOL, POLELAT, and RAD2DEG.

Referenced by defocusing_general_sub(), do_gridcell_3d_byltest(), geompath_tanpos_3d(), and sunsAddSingleFromGridAtLocation().

◆ cart2sph_plain()

void cart2sph_plain ( Numeric &  r,
Numeric &  lat,
Numeric &  lon,
const Numeric &  x,
const Numeric &  y,
const Numeric &  z 
)

Definition at line 624 of file geodetic.cc.

References RAD2DEG.

Referenced by cart2geodetic(), cart2poslos_plain(), sensor_poslosFromECEF(), and sensor_poslosFromGeodetic().

◆ cycle_lat_lon()

void cycle_lat_lon ( Numeric &  lat,
Numeric &  lon 
)

Cyclic latitude longitude coordinates.

Definition at line 1415 of file geodetic.cc.

References ARTS_USER_ERROR_IF.

Referenced by TelsemAtlas::calc_cellnum_nearest_neighbor().

◆ distance2D()

void distance2D ( Numeric &  l,
const Numeric &  r1,
const Numeric &  lat1,
const Numeric &  r2,
const Numeric &  lat2 
)

distance2D

The distance between two 2D points.

The two latitudes can deviate with max 180 degrees.

Parameters
lOut: The distance
r1Radius of position 1
lat1Latitude of position 1
r2Radius of position 2
lat2Latitude of position 2
Author
Patrick Eriksson
Date
2012-03-20

Definition at line 165 of file geodetic.cc.

References ARTS_ASSERT, and pol2cart().

Referenced by defocusing_general().

◆ distance3D()

void distance3D ( Numeric &  l,
const Numeric &  r1,
const Numeric &  lat1,
const Numeric &  lon1,
const Numeric &  r2,
const Numeric &  lat2,
const Numeric &  lon2 
)

distance3D

The distance between two 3D points.

Parameters
lOut: The distance
r1Radius of position 1
lat1Latitude of position 1
lon1Longitude of position 1
r2Radius of position 2
lat2Latitude of position 2
lon2Longitude of position 2
Author
Patrick Eriksson
Date
2012-03-20

Definition at line 652 of file geodetic.cc.

References sph2cart().

Referenced by defocusing_general(), DisortCalc(), DisortCalcIrradiance(), DisortCalcWithARTSSurface(), and get_direct_radiation().

◆ geodetic2cart()

void geodetic2cart ( Numeric &  x,
Numeric &  y,
Numeric &  z,
const Numeric &  h,
const Numeric &  lat,
const Numeric &  lon,
const Vector &  refellipsoid 
)

Conversion from geodetic to cartesian coordinates.

Definition at line 1504 of file geodetic.cc.

References a, DEG2RAD, and sph2cart().

Referenced by geodeticposlos2cart(), and sensor_poslosFromGeodetic().

◆ geodeticposlos2cart()

void geodeticposlos2cart ( Numeric &  x,
Numeric &  y,
Numeric &  z,
Numeric &  dx,
Numeric &  dy,
Numeric &  dz,
const Numeric &  h,
const Numeric &  lat,
const Numeric &  lon,
const Numeric &  za,
const Numeric &  aa,
const Vector &  refellipsoid 
)

geodeticposlos2cart

As poslos2cart but starts with geodetic position and LOS.

Parameters
xOut: x-coordinate of observation position.
yOut: y-coordinate of observation position.
zOut: z-coordinate of observation position.
dxOut: x-part of LOS unit vector.
dyOut: y-part of LOS unit vector.
dzOut: z-part of LOS unit vector.
hGeodetic altitude of observation position.
latGeodetic latitude of observation position.
lonLongitude of observation position.
zaLOS zenith angle at observation position.
aaLOS azimuth angle at observation position.
Author
Patrick Eriksson
Date
2020-09-17

Definition at line 1549 of file geodetic.cc.

References ARTS_ASSERT, DEG2RAD, geodetic2cart(), POLELAT, sign(), and zaaa2enu().

Referenced by sensor_poslosFromGeodetic().

◆ geompath_tanpos_3d()

void geompath_tanpos_3d ( Numeric &  r_tan,
Numeric &  lat_tan,
Numeric &  lon_tan,
Numeric &  l_tan,
const Numeric &  r,
const Numeric &  lat,
const Numeric &  lon,
const Numeric &  za,
const Numeric &  aa,
const Numeric &  ppc 
)

geompath_tanpos_3d

Position of the tangent point for 3D cases.

The zenith angle must be >= 90.

Parameters
r_tanOut: Radius of tangent point.
lat_tanOut: Latitude of tangent point.
lon_tanOut: Longitude of tangent point.
l_tanOut: Distance along path to the tangent point.
rRadius of observation position.
latLatitude of observation position.
lonLongitude of observation position.
zaLOS zenith angle at observation position.
aaLOS azimuth angle at observation position.
ppcGeometrical propagation path constant.
Author
Patrick Eriksson
Date
2002-12-31

Definition at line 689 of file geodetic.cc.

References ARTS_ASSERT, cart2sph(), and poslos2cart().

◆ latlon_at_aa()

void latlon_at_aa ( Numeric &  lat2,
Numeric &  lon2,
const Numeric &  lat1,
const Numeric &  lon1,
const Numeric &  aa,
const Numeric &  ddeg 
)

latlon_at_aa

Destination point given distance and bearing from start point

Calculates the latitude and longitide, given a position, an azimuth angle and an angular distance.

Parameters
lat2Latitude of end position.
lon2Longitude of end position.
lat1Latitude of start position.
lon1Longitude of start position.
aaAzimuth/bearing at start point.
ddegAngular distance (in degrees).
Author
Patrick Eriksson
Date
2012-04-23

Definition at line 996 of file geodetic.cc.

References DEG2RAD, and RAD2DEG.

Referenced by plevel_slope_3d().

◆ line_circle_intersect()

void line_circle_intersect ( Numeric &  x,
Numeric &  z,
const Numeric &  xl,
const Numeric &  zl,
const Numeric &  dx,
const Numeric &  dz,
const Numeric &  xc,
const Numeric &  zc,
const Numeric &  r 
)

geomtanpoint2d

Position of the tangent point for 3D cases.

Calculates the 3D geometrical tangent point for arbitrary reference ellipsiod. That is, a spherical planet is not assumed. The tangent point is thus defined as the point closest to the ellipsoid (not as the ppoint with za=90).

Geocentric coordinates are used for both sensor and tangent point positions.

The algorithm used for non-spherical cases is derived by Nick Lloyd at University of Saskatchewan, Canada (nick..nosp@m.lloy.nosp@m.d@usa.nosp@m.sk.c.nosp@m.a), and is part of the operational code for both OSIRIS and SMR on-board- the Odin satellite.

The zenith angle must be >= 90.

Parameters
r_tanOut: Radius of tangent point.
lat_tanOut: Latitude of tangent point.
lon_tanOut: Longitude of tangent point.
rRadius of observation position.
latLatitude of observation position.
lonLongitude of observation position.
zaLOS zenith angle at observation position.
aaLOS azimuth angle at observation position.
Author
Patrick Eriksson
Date
2012-02-12 line_circle_intersect

Find the intersection between a line and a circle

Parameters
xOut: X-coordinate of intersection
zOut: Z-coordinate of intersection
xlA x-coordinate on the line
zlA z-coordinate on the line
dxX-component of line direction vector
dzZ-component of line direction vector
xcX-coordinate of sphere origo
zcZ-coordinate of sphere origo
rRadius of sphere
Author
Patrick Eriksson
Date
2012-03-30

Definition at line 261 of file geodetic.cc.

References a, ARTS_ASSERT, b, c, d, and min().

◆ line_refellipsoid_intersect()

void line_refellipsoid_intersect ( Numeric &  l,
const Vector &  refellipsoid,
const Numeric &  x,
const Numeric &  y,
const Numeric &  z,
const Numeric &  dx,
const Numeric &  dy,
const Numeric &  dz 
)

geomtanpoint

Position of the tangent point for 3D cases.

Calculates the 3D geometrical tangent point for arbitrary reference ellipsiod. That is, a spherical planet is not assumed. The tangent point is thus defined as the point closest to the ellipsoid (not as the ppoint with za=90).

Geocentric coordinates are used for both sensor and tangent point positions.

The algorithm used for non-spherical cases is derived by Nick Lloyd at University of Saskatchewan, Canada (nick..nosp@m.lloy.nosp@m.d@usa.nosp@m.sk.c.nosp@m.a), and is part of the operational code for both OSIRIS and SMR on-board- the Odin satellite.

The zenith angle must be >= 90.

Parameters
r_tanOut: Radius of tangent point.
lat_tanOut: Latitude of tangent point.
lon_tanOut: Longitude of tangent point.
rRadius of observation position.
latLatitude of observation position.
lonLongitude of observation position.
zaLOS zenith angle at observation position.
aaLOS azimuth angle at observation position.
Author
Patrick Eriksson
Date
2012-02-12 line_refellipsoid_intersect

Find the intersection between a line and the reference ellipsoid

A negative distance is returned if there is no intersection.

If you the zenith angle and the reference ellipsoid is spherical, use the function geompath_l_at_r instead.

Parameters
lOut: Distance to intersection
refellVector defining reference ellipsoid
xlA x-coordinate on the line
ylA y-coordinate on the line
zlA z-coordinate on the line
dxX-component of line direction vector
dyY-component of line direction vector
dzZ-component of line direction vector
Author
Patrick Eriksson
Date
2012-03-30

Definition at line 857 of file geodetic.cc.

References a, b, and c.

Referenced by IntersectionGeometricalWithAltitude().

◆ line_sphere_intersect()

void line_sphere_intersect ( Numeric &  x,
Numeric &  y,
Numeric &  z,
const Numeric &  xl,
const Numeric &  yl,
const Numeric &  zl,
const Numeric &  dx,
const Numeric &  dy,
const Numeric &  dz,
const Numeric &  xc,
const Numeric &  yc,
const Numeric &  zc,
const Numeric &  r 
)

line_sphere_intersect

Find the intersection between a line and a sphere

Parameters
xOut: X-coordinate of intersection
yOut: Y-coordinate of intersection
zOut: Z-coordinate of intersection
xlA x-coordinate on the line
ylA y-coordinate on the line
zlA z-coordinate on the line
dxX-component of line direction vector
dyY-component of line direction vector
dzZ-component of line direction vector
xcX-coordinate of sphere origo
ycY-coordinate of sphere origo
zcZ-coordinate of sphere origo
rRadius of sphere
Author
Patrick Eriksson
Date
2012-03-30

Definition at line 936 of file geodetic.cc.

References a, ARTS_ASSERT, b, c, d, and min().

◆ lon_shiftgrid()

void lon_shiftgrid ( Vector &  longrid_out,
ConstVectorView  longrid_in,
const Numeric  lon 
)

lon_shiftgrid

Shifting longitude grid by +/- 360 to the same region as a given longitude.

Longitudes are allowed to be in [-360,360], but only covering at maximum 360 degrees at once. Different variables might be specified in different spaces of the allowed range. lon_shiftgrid shifts the longitude grid to the same space as the lon value. However, no check is done that lon is indeed within the range of longrid_out (only same region).

Parameters
longrid_outOut: shifted longitude grid.
longrid_inOriginal longitude grid.
lonA longitude value.
Author
Jana Mendrok
Date
2012-06-28

Definition at line 1391 of file geodetic.cc.

Referenced by InterpGriddedField2ToPosition(), InterpSurfaceTypeMask(), surface_complex_refr_indexFromGriddedField5(), surface_reflectivityFromGriddedField6(), and surface_scalar_reflectivityFromGriddedField4().

◆ los2xyz()

void los2xyz ( Numeric &  za,
Numeric &  aa,
const Numeric &  r1,
const Numeric &  lat1,
const Numeric &  lon1,
const Numeric &  x1,
const Numeric &  y1,
const Numeric &  z1,
const Numeric &  x2,
const Numeric &  y2,
const Numeric &  z2 
)

los2xyz

Line-of-sight to another position given in cartesian coordinates.

Calculates the zenith and azimuth angle for the geomrical path from position 1 to position 2.

Parameters
zaOut: LOS zenith angle at position 1.
aaOut: LOS azimuth angle at position 1.
rRadius of position 1.
latLatitude of position 1.
lonLongitude of position 1.
x1x-coordinate of position 1.
y1y-coordinate of position 1.
z1z-coordinate of position 1.
x2x-coordinate of position 2.
y2y-coordinate of position 2.
z2z-coordinate of position 2.
Author
Patrick Eriksson
Date
2012-03-26

Definition at line 1042 of file geodetic.cc.

References DEG2RAD, and RAD2DEG.

◆ pol2cart()

void pol2cart ( Numeric &  x,
Numeric &  z,
const Numeric &  r,
const Numeric &  lat 
)

pol2cart

Conversion from polar to cartesian coordinates.

The cartesian coordinate system is defined such as the x-axis goes along lat=0 and lon=0 and z-axis goes along lat=90.

Parameters
xOut: x position.
zOut: z position.
rRadius.
latLatitude.
Author
Patrick Eriksson
Date
2012-03-20

Definition at line 314 of file geodetic.cc.

References ARTS_ASSERT, and DEG2RAD.

Referenced by distance2D().

◆ pos2refell_r()

Numeric pos2refell_r ( const Index &  atmosphere_dim,
ConstVectorView  refellipsoid,
ConstVectorView  lat_grid,
ConstVectorView  lon_grid,
ConstVectorView  rte_pos 
)

pos2refell_r

Extracts the reference ellipsoid for the specified position.

The reference ellipsoid radius is defined slightly differently inside and outside of the model atmosphere. See refell2r. This function takes care of all those aspects.

If you know the latitude grid position of rte_pos, it is faster to use refell2d*.

Returns
Ellispoid radius
Parameters
atmosphere_dimIn: As the WSV with same name.
refellipsoidIn: As the WSV with same name.
lat_gridIn: As the WSV with same name.
lon_gridIn: As the WSV with same name.
rte_posIn: As the WSV with same name.
Author
Patrick Eriksson
Date
2012-03-27

Definition at line 1194 of file geodetic.cc.

References ARTS_ASSERT, gridpos(), last(), refell2d(), and refell2r().

Referenced by get_direct_radiation(), get_sun_ppaths(), and IntersectionGeometricalWithAltitude().

◆ poslos2cart() [1/2]

void poslos2cart ( Numeric &  x,
Numeric &  y,
Numeric &  z,
Numeric &  dx,
Numeric &  dy,
Numeric &  dz,
const Numeric &  r,
const Numeric &  lat,
const Numeric &  lon,
const Numeric &  za,
const Numeric &  aa 
)

poslos2cart

Conversion from position and LOS to cartesian coordinates

A position (in geographical coordinates) and LOS are converted to a cartesian position and a viewing vector. The viewing direction is the the vector [dx,dy,dz]. This vector is normalised (it has length 1).

See the user guide for definition on the zenith and azimuth angles.

Parameters
xOut: x-coordinate of observation position.
yOut: y-coordinate of observation position.
zOut: z-coordinate of observation position.
dxOut: x-part of LOS unit vector.
dyOut: y-part of LOS unit vector.
dzOut: z-part of LOS unit vector.
rRadius of observation position.
latLatitude of observation position.
lonLongitude of observation position.
zaLOS zenith angle at observation position.
aaLOS azimuth angle at observation position.
Author
Patrick Eriksson
Date
2002-12-30

Definition at line 1110 of file geodetic.cc.

References ARTS_ASSERT, DEG2RAD, POLELAT, and sign().

◆ poslos2cart() [2/2]

void poslos2cart ( Numeric &  x,
Numeric &  z,
Numeric &  dx,
Numeric &  dz,
const Numeric &  r,
const Numeric &  lat,
const Numeric &  za 
)

poslos2cart

2D version of poslos2cart

Parameters
xOut: x-coordinate of observation position.
zOut: z-coordinate of observation position.
dxOut: x-part of LOS unit vector.
dzOut: z-part of LOS unit vector.
rRadius of observation position.
latLatitude of observation position.
zaLOS zenith angle at observation position.
Author
Patrick Eriksson
Date
2012-03-20

Definition at line 338 of file geodetic.cc.

References ARTS_ASSERT, and DEG2RAD.

Referenced by defocusing_general_sub(), do_gridcell_2d_byltest(), do_gridcell_3d_byltest(), geompath_tanpos_3d(), get_sun_radiation(), IntersectionGeometricalWithAltitude(), ppath_start_stepping(), raytrace_3d_linear_basic(), sunsAddSingleFromGridAtLocation(), and y_geoToGeodetic().

◆ refell2d()

Numeric refell2d ( ConstVectorView  refellipsoid,
ConstVectorView  lat_grid,
const GridPos  gp 
)

refell2d

Reference ellipsoid radius for points inside 2D and 3D atmospheres.

To be consistent with the ppath calculations, the ellipsoid radius shall be treated to vary linear between the latitude grid points. This function performs this operation. The latitude position is specified by its grid position (gp).

Returns
Ellispoid radius
Parameters
refellipsoidIn: As the WSV with same name.
lat_gridIn: As the WSV with same name.
gpIn: Latitude grid position.
Author
Patrick Eriksson
Date
2012-02-09

Definition at line 1287 of file geodetic.cc.

References GridPos::fd, GridPos::idx, and refell2r().

Referenced by get_refr_index_2d(), get_refr_index_3d(), pos2refell_r(), ppath_start_stepping(), and specular_losCalc().

◆ refell2r()

Numeric refell2r ( ConstVectorView  refellipsoid,
const Numeric &  lat 
)

refell2r

Reference ellipsoid radius, directly from refellipsoid.

Gives the distance from the Earth's centre and the reference ellipsoid as a function of geoCENTRIC latitude.

For 1D, extract r directly as refellipsoid[0] to save time.

This is the basic function to calculate the reference ellipsoid radius. However, inside the atmosphere this radius is just used at the positions of the lat_grid. A linear interpolation is applied between these points. This is handled by other functions. For 2D and 3D and the grid position is known, use refell2d. The function pos2refell_r handles all this in a general way (but not always the fastest option).

Returns
Ellispoid radius
Parameters
refellipsoidIn: As the WSV with same name.
latitudeIn: A geoecentric latitude.
Author
Patrick Eriksson
Date
2012-02-07

Definition at line 1248 of file geodetic.cc.

References ARTS_ASSERT, b, c, DEG2RAD, and v.

Referenced by cloud_ppath_update3D(), defocusing_general(), DisortCalc(), DisortCalcIrradiance(), DisortCalcWithARTSSurface(), get_direct_radiation(), get_sun_radiation(), plevel_slope_2d(), plevel_slope_3d(), pos2refell_r(), ppath_end_2d(), ppath_end_3d(), ppath_start_2d(), ppath_start_3d(), ppath_start_stepping(), refell2d(), refellipsoidOrbitPlane(), sensor_poslosFromECEF(), sensor_poslosFromGeodetic(), sunsAddSingleFromGridAtLocation(), and y_geoToGeodetic().

◆ sph2cart()

void sph2cart ( Numeric &  x,
Numeric &  y,
Numeric &  z,
const Numeric &  r,
const Numeric &  lat,
const Numeric &  lon 
)

sph2cart

Conversion from spherical to cartesian coordinates.

The cartesian coordinate system is defined such as the x-axis goes along lat=0 and lon=0, the z-axis goes along lat=0 and lon=90, and z-axis goes along lat=90.

Parameters
xOut: x position.
yOut: y position.
zOut: z position.
rRadius.
latLatitude.
lonLongitude.
Author
Patrick Eriksson
Date
2002-12-17

Definition at line 1349 of file geodetic.cc.

References ARTS_ASSERT, and DEG2RAD.

Referenced by distance3D(), geodetic2cart(), and get_sun_radiation().

◆ sphdist()

Numeric sphdist ( const Numeric &  lat1,
const Numeric &  lon1,
const Numeric &  lat2,
const Numeric &  lon2 
)

sphdist

The distance between two geograpgical positions

"As-the-crow-flies" angular distance between two points, specified by their latitude and longitude.

Note that angular distance is returned. The distance in length varies with altitude.

Returns
Angular distance (in degrees)
Parameters
lat1Latitude of position 1.
lon1Longitude of position 1.
lat2Latitude of position 2.
lon2Longitude of position 2.
Author
Patrick Eriksson
Date
2012-04-05

Definition at line 1318 of file geodetic.cc.

References a, DEG2RAD, and RAD2DEG.

Referenced by bending_angle1d(), surfaceTelsem(), and telsemStandalone().

Variable Documentation

◆ DEG2RAD

◆ RAD2DEG

constexpr Numeric RAD2DEG =Conversion::rad2deg(1)
inlineconstexpr