ARTS  2.2.66
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 
21 /*===========================================================================
22  === File description
23  ===========================================================================*/
24 
39 /*===========================================================================
40  === External declarations
41  ===========================================================================*/
42 
43 #include <cmath>
44 #include <stdexcept>
45 #include "arts.h"
46 #include "check_input.h"
47 #include "geodetic.h"
48 #include "matpackI.h"
49 #include "messages.h"
50 
51 
52 extern const Numeric DEG2RAD;
53 
54 
55 /*===========================================================================
56  === The functions (in alphabetical order)
57  ===========================================================================*/
58 
59 /* Workspace method: Doxygen documentation will be auto-generated */
61  Vector& refellipsoid,
62  const Numeric& latitude,
63  const Numeric& azimuth,
64  const Verbosity& )
65 {
66  if( refellipsoid.nelem() != 2 )
67  throw runtime_error( "Input *refellispoid must be a vector of length 2*." );
68 
69  if( refellipsoid[1] > 0 )
70  {
71  const Numeric e2 = refellipsoid[1] * refellipsoid[1];
72  const Numeric a = 1 - e2 * pow( sin( DEG2RAD*latitude ), 2.0 );
73 
74  const Numeric rn = 1 / sqrt( a );
75  const Numeric rm = ( 1 - e2 ) * ( rn / a );
76 
77  const Numeric v = DEG2RAD * azimuth;
78 
79  refellipsoid[0] = refellipsoid[0] / ( pow(cos(v),2.0)/rm +
80  pow(sin(v),2.0)/rn );
81  refellipsoid[1] = 0;
82  }
83 }
84 
85 
86 
87 /* Workspace method: Doxygen documentation will be auto-generated */
89  Vector& refellipsoid,
90  const Numeric& orbitinc,
91  const Verbosity& )
92 {
93  if( refellipsoid.nelem() != 2 )
94  throw runtime_error( "Input *refellispoid must be a vector of length 2*." );
95  chk_if_in_range( "orbitinc", orbitinc, 0, 180 );
96 
97  // Radius at maximum latitude
98  const Numeric rp = refell2r( refellipsoid, orbitinc );
99 
100  // New eccentricity
101  refellipsoid[1] = sqrt( 1 - pow( rp/refellipsoid[0], 2.0 ) );
102 }
103 
104 
105 
106 /* Workspace method: Doxygen documentation will be auto-generated */
108  Vector& refellipsoid,
109  const Numeric& re,
110  const Numeric& e,
111  const Verbosity& )
112 {
113  refellipsoid.resize(2);
114 
115  refellipsoid[0] = re;
116  refellipsoid[1] = e;
117 }
118 
119 
void refellipsoidForAzimuth(Vector &refellipsoid, const Numeric &latitude, const Numeric &azimuth, const Verbosity &)
WORKSPACE METHOD: refellipsoidForAzimuth.
Definition: m_geodetic.cc:60
Declarations having to do with the four output streams.
void refellipsoidOrbitPlane(Vector &refellipsoid, const Numeric &orbitinc, const Verbosity &)
WORKSPACE METHOD: refellipsoidOrbitPlane.
Definition: m_geodetic.cc:88
The Vector class.
Definition: matpackI.h:556
Index nelem() const
Returns the number of elements.
Definition: matpackI.cc:180
const Numeric DEG2RAD
The global header file for ARTS.
NUMERIC Numeric
The type to use for all floating point numbers.
Definition: matpack.h:29
void refellipsoidSet(Vector &refellipsoid, const Numeric &re, const Numeric &e, const Verbosity &)
WORKSPACE METHOD: refellipsoidSet.
Definition: m_geodetic.cc:107
Numeric refell2r(ConstVectorView refellipsoid, const Numeric &lat)
refell2r
Definition: geodetic.cc:1199
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:101
void resize(Index n)
Assignment operator from VectorView.
Definition: matpackI.cc:798