Loading...
Searching...
No Matches
src
radar
Sun.h
1
/*
2
3
MIT License
4
5
Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
6
7
Permission is hereby granted, free of charge, to any person obtaining a copy
8
of this software and associated documentation files (the "Software"), to deal
9
in the Software without restriction, including without limitation the rights
10
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
copies of the Software, and to permit persons to whom the Software is
12
furnished to do so, subject to the following conditions:
13
14
The above copyright notice and this permission notice shall be included in all
15
copies or substantial portions of the Software.
16
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
SOFTWARE.
24
25
*/
26
/*
27
Part of Rack development has been done in the BALTRAD projects part-financed
28
by the European Union (European Regional Development Fund and European
29
Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30
*/
31
32
#ifndef RACK_SUN_H
33
#define RACK_SUN_H
34
35
36
#include <string>
37
38
#include <drain/util/Units.h>
39
40
41
/*
42
* 2001 (C) Harri.Hohti@fmi.fi
43
* Original formulae from: Jean Meeus: Astronomical Formulae for Calculators (1980)
44
*/
45
46
namespace
rack
{
47
48
struct
Equatorial
{
49
double
RA;
50
double
dec;
51
};
52
53
54
struct
Geographical
{
55
double
lat;
56
double
lon;
57
};
58
59
struct
Horizontal
{
60
double
azm;
61
double
elev;
62
};
63
64
65
//class Sun : public Geographical, public Equatorial, public Horizontal {
66
class
Sun
:
public
Horizontal
{
67
68
public
:
69
70
Sun
(
const
std::string &
datestr
=
"197001010000"
,
double
lon=0.0,
double
lat=0.0){
71
setStarTime(
datestr
);
72
setLocation(lon, lat);
73
};
74
76
83
static
84
void
getSunPos
(
const
std::string &
datestr
,
double
lonDeg
,
double
latDeg
,
double
&
azmRad
,
double
&
elevRad
);
85
86
87
88
inline
89
void
setStarTime(
const
std::string &
datestr
){
90
91
double
jDate
= JDate(
datestr
.c_str());
92
93
/* Tähtiaika radiaaneina auringon tuntikulman laskentaa varten */
94
starTime = Sidereal_GW(
jDate
) * 15.0 * drain::DEG2RAD;
95
Solar_coords(
jDate
, equ);
96
97
}
98
99
100
/* Lasketaan auringon horisontaalikoordinaatit paikan ja ajan funktiona */
101
inline
102
void
setLocation(
double
lon,
double
lat){
103
104
/* Lasketaan auringon horisontaalikoordinaatit paikan ja ajan funktiona */
105
geo.lat = lat;
106
geo.lon = lon;
107
Solar_pos(starTime, geo, equ, *
this
);
108
}
109
110
Geographical
geo;
111
112
113
private
:
114
115
/* Tähtiaika radiaaneina auringon tuntikulman laskentaa varten */
116
double
starTime;
117
118
Equatorial
equ;
119
120
//static double DEG_TO_RAD,RAD_TO_DEG;
121
122
/*
123
typedef struct { double RA;
124
double Dec;
125
} Equatorial;
126
128
typedef struct {
129
double A;
130
double h;
131
} Horizontal;
132
134
typedef struct {
135
double lat;
136
double lon;
137
} Geographical;
138
*/
139
140
// Equatorial equ;
141
142
// Geographical geo;
143
144
/* Julian date */
145
static
double
JDate(
const
char
*
datestr
);
146
147
/* 0-meridian astronomic time */
148
static
double
Sidereal_GW(
double
JD
);
149
150
/* equatoriali coords */
151
//static Equatorial Solar_coords(double JD);
152
static
153
void
Solar_coords(
double
JD
,
Equatorial
& equ);
154
155
/* Horizontal coords without refraction */
156
/* Auringon horisontaalikoordinaatit (ei refraktiota) */
157
static
158
//Horizontal Solar_pos(double Sd0,
159
void
Solar_pos(
double
Sd0
,
const
Geographical
& geo,
const
Equatorial
& equ,
Horizontal
&
hor
);
160
161
162
};
163
164
}
// rack::
165
166
#endif
/* RACK_H_ */
167
168
// Rack
rack::DataSet
A map of radar data, indexed by quantity code (DBZH, VRAD, etc).
Definition
Data.h:1293
rack::Sun
Definition
Sun.h:66
rack::Sun::getSunPos
static void getSunPos(const std::string &datestr, double lonDeg, double latDeg, double &azmRad, double &elevRad)
Returns the sun azimuth and elevation angle at a given time in a geographical position.
Definition
Sun.cpp:49
rack
Definition
AltitudeOp.cpp:42
rack::Equatorial
Definition
Sun.h:48
rack::Geographical
Definition
Sun.h:54
rack::Horizontal
Definition
Sun.h:59
Generated by
1.9.8