ARTS  2.4.0(git:4fb77825)
m_geodetic.cc
Go to the documentation of this file.
1 /* Copyright (C) 2012
2  Patrick Eriksson <Patrick.Eriksson@chalmers.se>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License as published by the
6  Free Software Foundation; either version 2, or (at your option) any
7  later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17  USA. */
18 
19 /*===========================================================================
20  === File description
21  ===========================================================================*/
22 
34 /*===========================================================================
35  === External declarations
36  ===========================================================================*/
37 
38 #include <cmath>
39 #include <stdexcept>
40 #include "arts.h"
41 #include "check_input.h"
42 #include "geodetic.h"
43 #include "matpackI.h"
44 #include "messages.h"
45 
46 extern const Numeric DEG2RAD;
47 
48 /*===========================================================================
49  === The functions (in alphabetical order)
50  ===========================================================================*/
51 
52 /* Workspace method: Doxygen documentation will be auto-generated */
54  const Numeric& latitude,
55  const Numeric& azimuth,
56  const Verbosity&) {
57  if (refellipsoid.nelem() != 2)
58  throw runtime_error("Input *refellispoid must be a vector of length 2*.");
59 
60  if (refellipsoid[1] > 0) {
61  const Numeric e2 = refellipsoid[1] * refellipsoid[1];
62  const Numeric a = 1 - e2 * pow(sin(DEG2RAD * latitude), 2.0);
63 
64  const Numeric rn = 1 / sqrt(a);
65  const Numeric rm = (1 - e2) * (rn / a);
66 
67  const Numeric v = DEG2RAD * azimuth;
68 
69  refellipsoid[0] =
70  refellipsoid[0] / (pow(cos(v), 2.0) / rm + pow(sin(v), 2.0) / rn);
71  refellipsoid[1] = 0;
72  }
73 }
74 
75 /* Workspace method: Doxygen documentation will be auto-generated */
77  const Numeric& orbitinc,
78  const Verbosity&) {
79  if (refellipsoid.nelem() != 2)
80  throw runtime_error("Input *refellispoid must be a vector of length 2*.");
81  chk_if_in_range("orbitinc", orbitinc, 0, 180);
82 
83  // Radius at maximum latitude
84  const Numeric rp = refell2r(refellipsoid, orbitinc);
85 
86  // New eccentricity
87  refellipsoid[1] = sqrt(1 - pow(rp / refellipsoid[0], 2.0));
88 }
89 
90 /* Workspace method: Doxygen documentation will be auto-generated */
92  const Numeric& re,
93  const Numeric& e,
94  const Verbosity&) {
95  refellipsoid.resize(2);
96 
97  refellipsoid[0] = re;
98  refellipsoid[1] = e;
99 }
sqrt
Numeric sqrt(const Rational r)
Square root.
Definition: rational.h:620
refellipsoidForAzimuth
void refellipsoidForAzimuth(Vector &refellipsoid, const Numeric &latitude, const Numeric &azimuth, const Verbosity &)
WORKSPACE METHOD: refellipsoidForAzimuth.
Definition: m_geodetic.cc:53
matpackI.h
Implementation of Matrix, Vector, and such stuff.
pow
Numeric pow(const Rational base, Numeric exp)
Power of.
Definition: rational.h:628
messages.h
Declarations having to do with the four output streams.
refellipsoidSet
void refellipsoidSet(Vector &refellipsoid, const Numeric &re, const Numeric &e, const Verbosity &)
WORKSPACE METHOD: refellipsoidSet.
Definition: m_geodetic.cc:91
refellipsoidOrbitPlane
void refellipsoidOrbitPlane(Vector &refellipsoid, const Numeric &orbitinc, const Verbosity &)
WORKSPACE METHOD: refellipsoidOrbitPlane.
Definition: m_geodetic.cc:76
Numeric
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:33
Verbosity
Definition: messages.h:49
geodetic.h
ARTS::Var::refellipsoid
Vector refellipsoid(Workspace &ws) noexcept
Definition: autoarts.h:5519
DEG2RAD
const Numeric DEG2RAD
chk_if_in_range
void chk_if_in_range(const String &x_name, const Index &x, const Index &x_low, const Index &x_high)
chk_if_in_range
Definition: check_input.cc:89
check_input.h
Vector
The Vector class.
Definition: matpackI.h:860
refell2r
Numeric refell2r(ConstVectorView refellipsoid, const Numeric &lat)
refell2r
Definition: geodetic.cc:1135
arts.h
The global header file for ARTS.