calc_sun 1.2.8 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/README.rdoc +14 -6
- data/calc_sun.gemspec +5 -3
- data/ext/calc_sun/calc_sun.c +431 -124
- data/lib/calc_sun/version.rb +1 -1
- metadata +6 -4
- metadata.gz.sig +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 17ba770fc7f7e5fba650d574db11d2f821628647
|
4
|
+
data.tar.gz: b2d518e421c8f5c4db7bfd9509f9e664c85f07ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d901c66a7f59225201d44e0f110812a0f7dc799a68ff1684af2ff0a6e559effaeb8d308ea1c175215252ed4f99c9bcd235f426217c77bf20f3af55422c2548ea
|
7
|
+
data.tar.gz: 8b3d353868169de3fac48059028292444fdd5a2d4d4d3766578d02093db431c14661421b5fcd47d0280aa70f4e620fd894ac9c5ee97aa2d65ffc2a4a8e810330
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/README.rdoc
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Home :: https://rubygems.org/gems/calc_sun
|
7
7
|
Code :: https://github.com/DouglasAllen/calc_sun
|
8
|
-
RDoc :: http://www.rubydoc.info/gems/calc_sun/
|
8
|
+
RDoc :: http://www.rubydoc.info/gems/calc_sun/1.2.9
|
9
9
|
Issues :: https://github.com/DouglasAllen/calc_sun/issues
|
10
10
|
|
11
11
|
|
@@ -31,7 +31,7 @@ since version 1.2.6
|
|
31
31
|
or make a batchfile to start your envirnment with 'run devkitvars'
|
32
32
|
cd to calc_sun dir
|
33
33
|
$> gem build calc_sun.gemspec
|
34
|
-
$> gem install calc_sun-1.2.
|
34
|
+
$> gem install calc_sun-1.2.9.gem -l
|
35
35
|
|
36
36
|
=== DEVELOPERS:
|
37
37
|
|
@@ -66,11 +66,19 @@ and generate the RDoc.
|
|
66
66
|
|
67
67
|
# set the date with set_date as date is just an ivar
|
68
68
|
day = cs.set_datetime('2003-10-17 12:30:30')
|
69
|
-
puts day
|
69
|
+
puts day.httpdate
|
70
70
|
|
71
|
-
puts "Sun rise: #{cs.rise(day.
|
72
|
-
puts "Sun noon: #{cs.noon(day.
|
73
|
-
puts "Sun set: #{cs.set(day.
|
71
|
+
puts "Sun rise: #{cs.rise(day.jd, lat, lon).httpdate}"
|
72
|
+
puts "Sun noon: #{cs.noon(day.jd, lat, lon).httpdate}"
|
73
|
+
puts "Sun set: #{cs.set(day.jd, lat, lon).httpdate}"
|
74
|
+
|
75
|
+
puts "Sun AJD rise: #{cs.rise_jd(day.jd, lat, lon)}"
|
76
|
+
puts "Sun AJD noon: #{cs.noon_jd(day.jd, lat, lon)}"
|
77
|
+
puts "Sun AJD set: #{cs.set_jd(day.jd, lat, lon)}"
|
78
|
+
|
79
|
+
puts "Sun azimuth rise: #{cs.rise_az(day.jd, lat, lon)}"
|
80
|
+
puts "Sun azimuth noon: #{cs.noon_az(day.jd, lat, lon)}"
|
81
|
+
puts "Sun azimuth set: #{cs.set_az(day.jd, lat, lon)}"
|
74
82
|
|
75
83
|
=== LICENSE:
|
76
84
|
|
data/calc_sun.gemspec
CHANGED
@@ -9,11 +9,13 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.author = 'Douglas Allen'
|
10
10
|
spec.email = ['kb9agt@gmail.com']
|
11
11
|
spec.summary = 'Calculates Sun Times ea. rise, noon, set'
|
12
|
-
spec.description = '
|
13
|
-
|
12
|
+
spec.description = 'Given a Julian Day Number of day,
|
13
|
+
latitude decimal, and
|
14
|
+
longitude decimal in the calls to instance methods
|
14
15
|
rise(jd, lat, lon),
|
15
16
|
noon(jd, lat, lon), and
|
16
|
-
set(jd, lat, lon)
|
17
|
+
set(jd, lat, lon)
|
18
|
+
see source code for more details'
|
17
19
|
spec.homepage = 'https://github.com/DouglasAllen/calc_sun'
|
18
20
|
spec.license = 'MIT'
|
19
21
|
require 'English'
|
data/ext/calc_sun/calc_sun.c
CHANGED
@@ -16,7 +16,9 @@
|
|
16
16
|
# define INV360 1.0 / 360.0
|
17
17
|
# define DJ00 2451545.0L
|
18
18
|
# define RND12 1000000000000.0L
|
19
|
-
|
19
|
+
/* macro for normalizing
|
20
|
+
* angles into 0-2pie range
|
21
|
+
*/
|
20
22
|
static inline double
|
21
23
|
anp(double angle){
|
22
24
|
double w = fmod(angle, M2PI);
|
@@ -28,7 +30,7 @@ anp(double angle){
|
|
28
30
|
* call-seq:
|
29
31
|
* initialize()
|
30
32
|
*
|
31
|
-
* Create CalcSun class Ruby object.
|
33
|
+
* Create CalcSun class instance Ruby object.
|
32
34
|
*
|
33
35
|
*/
|
34
36
|
static VALUE t_init(VALUE self){
|
@@ -36,9 +38,14 @@ static VALUE t_init(VALUE self){
|
|
36
38
|
}
|
37
39
|
/*
|
38
40
|
* call-seq:
|
39
|
-
* date('yyyy-mm-
|
41
|
+
* date('yyyy-mm-ddT00:00:00+/-zoneoffset')
|
42
|
+
* or
|
43
|
+
* date('20010203T040506+0700')
|
44
|
+
* or
|
45
|
+
* date('3rd Feb 2001 04:05:06 PM')
|
40
46
|
*
|
41
|
-
*
|
47
|
+
* given a string representing date time
|
48
|
+
* convert to DateTime object.
|
42
49
|
*
|
43
50
|
*/
|
44
51
|
static VALUE func_set_datetime(VALUE self, VALUE vdatetime){
|
@@ -50,7 +57,8 @@ static VALUE func_set_datetime(VALUE self, VALUE vdatetime){
|
|
50
57
|
* call-seq:
|
51
58
|
* ajd2dt(ajd)
|
52
59
|
*
|
53
|
-
*
|
60
|
+
* give Astronomical Julian Day Number
|
61
|
+
* convert to DateTime object.
|
54
62
|
*
|
55
63
|
*/
|
56
64
|
static VALUE func_ajd_2_datetime(VALUE self, VALUE vajd){
|
@@ -64,7 +72,8 @@ static VALUE func_ajd_2_datetime(VALUE self, VALUE vajd){
|
|
64
72
|
* call-seq:
|
65
73
|
* ajd(date)
|
66
74
|
*
|
67
|
-
*
|
75
|
+
* given Date or DateTime object
|
76
|
+
* convert to Astronomical Julian Day Number.
|
68
77
|
*
|
69
78
|
*/
|
70
79
|
static VALUE func_get_ajd(VALUE self, VALUE vdatetime){
|
@@ -75,7 +84,8 @@ static VALUE func_get_ajd(VALUE self, VALUE vdatetime){
|
|
75
84
|
* call-seq:
|
76
85
|
* jd(date)
|
77
86
|
*
|
78
|
-
*
|
87
|
+
* given Date or DateTime object
|
88
|
+
* convert to JD number.
|
79
89
|
*
|
80
90
|
*/
|
81
91
|
static VALUE func_get_jd(VALUE self, VALUE vdatetime){
|
@@ -85,10 +95,10 @@ static VALUE func_get_jd(VALUE self, VALUE vdatetime){
|
|
85
95
|
|
86
96
|
/*
|
87
97
|
* call-seq:
|
88
|
-
* mean_anomaly(
|
98
|
+
* mean_anomaly(ajd)
|
89
99
|
*
|
90
|
-
*
|
91
|
-
*
|
100
|
+
* given an Astronomical Julian Day Number
|
101
|
+
* returns Mean Anomaly of Sun in radians.
|
92
102
|
*
|
93
103
|
*/
|
94
104
|
static VALUE func_mean_anomaly(VALUE self, VALUE vajd){
|
@@ -102,7 +112,14 @@ static VALUE func_mean_anomaly(VALUE self, VALUE vajd){
|
|
102
112
|
t * (1.0 / -313315926.8929504))))) * D2R, M2PI);
|
103
113
|
return DBL2NUM(roundf(vma * RND12) / RND12);
|
104
114
|
}
|
105
|
-
|
115
|
+
/*
|
116
|
+
* call-seq:
|
117
|
+
* eccentricity(ajd)
|
118
|
+
*
|
119
|
+
* given an Astronomical Julian Day Number
|
120
|
+
* returns Eccentriciy of Earth Orbit around Sun.
|
121
|
+
*
|
122
|
+
*/
|
106
123
|
static VALUE func_eccentricity(VALUE self, VALUE vajd){
|
107
124
|
double jd = NUM2DBL(vajd);
|
108
125
|
double d = jd - DJ00;
|
@@ -113,21 +130,12 @@ static VALUE func_eccentricity(VALUE self, VALUE vajd){
|
|
113
130
|
}
|
114
131
|
|
115
132
|
/*
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
double vesqr = ve * ve;
|
123
|
-
double vesqr54 = 5.0 / 4.0 * vesqr;
|
124
|
-
double vecube12 = (vesqr * ve) / 12.0;
|
125
|
-
double veoc =
|
126
|
-
ve2 * sin(vma) +
|
127
|
-
vesqr54 * sin(2 * vma) +
|
128
|
-
vecube12 * (13.0 * sin(3 * vma) - 3.0 * sin(vma));
|
129
|
-
return DBL2NUM(roundf(veoc * RND12) / RND12);
|
130
|
-
}
|
133
|
+
* call-seq:
|
134
|
+
* equation_of_center(ajd)
|
135
|
+
*
|
136
|
+
* given an Astronomical Julian Day Number
|
137
|
+
* returns Equation of Center in radians.
|
138
|
+
*
|
131
139
|
*/
|
132
140
|
|
133
141
|
static VALUE func_equation_of_center(VALUE self, VALUE vajd){
|
@@ -149,7 +157,14 @@ static VALUE func_equation_of_center(VALUE self, VALUE vajd){
|
|
149
157
|
double veoc = eoe * (sin1a * 8.0 + eoe * (sin2b + eoe * (ad3 + eoe * (ad4 + eoe * ad5))));
|
150
158
|
return DBL2NUM(roundf(veoc * RND12) / RND12);
|
151
159
|
}
|
152
|
-
|
160
|
+
/*
|
161
|
+
* call-seq:
|
162
|
+
* true_anomaly(ajd)
|
163
|
+
*
|
164
|
+
* given an Astronomical Julian Day Number
|
165
|
+
* returns True Anomaly of Sun in radians.
|
166
|
+
*
|
167
|
+
*/
|
153
168
|
static VALUE func_true_anomaly(VALUE self, VALUE vajd){
|
154
169
|
double vma =
|
155
170
|
NUM2DBL(func_mean_anomaly(self, vajd));
|
@@ -158,7 +173,14 @@ static VALUE func_true_anomaly(VALUE self, VALUE vajd){
|
|
158
173
|
double vta = vma + veoc;
|
159
174
|
return DBL2NUM(roundf(vta * RND12) / RND12);
|
160
175
|
}
|
161
|
-
|
176
|
+
/*
|
177
|
+
* call-seq:
|
178
|
+
* mean_longitude(ajd)
|
179
|
+
*
|
180
|
+
* given an Astronomical Julian Day Number
|
181
|
+
* returns Mean Longitude of Sun in radians.
|
182
|
+
*
|
183
|
+
*/
|
162
184
|
static VALUE func_mean_longitude(VALUE self, VALUE vajd){
|
163
185
|
double jd = NUM2DBL(vajd);
|
164
186
|
double d = jd - DJ00;
|
@@ -169,7 +191,14 @@ static VALUE func_mean_longitude(VALUE self, VALUE vajd){
|
|
169
191
|
) * D2R, M2PI);
|
170
192
|
return DBL2NUM(roundf(vml * RND12) / RND12);
|
171
193
|
}
|
172
|
-
|
194
|
+
/*
|
195
|
+
* call-seq:
|
196
|
+
* eccentric_anomaly(ajd)
|
197
|
+
*
|
198
|
+
* given an Astronomical Julian Day Number
|
199
|
+
* returns Eccentric Anomaly of Sun in radians.
|
200
|
+
*
|
201
|
+
*/
|
173
202
|
static VALUE func_eccentric_anomaly(VALUE self, VALUE vajd){
|
174
203
|
double ve =
|
175
204
|
NUM2DBL(func_eccentricity(self, vajd));
|
@@ -179,7 +208,14 @@ static VALUE func_eccentric_anomaly(VALUE self, VALUE vajd){
|
|
179
208
|
vml + ve * sin(vml) * (1.0 + ve * cos(vml));
|
180
209
|
return DBL2NUM(roundf(vea * RND12) / RND12);
|
181
210
|
}
|
182
|
-
|
211
|
+
/*
|
212
|
+
* call-seq:
|
213
|
+
* obliquity_of_ecliptic(ajd)
|
214
|
+
*
|
215
|
+
* given an Astronomical Julian Day Number
|
216
|
+
* returns Earth Tilt (Obliquity) in radians.
|
217
|
+
*
|
218
|
+
*/
|
183
219
|
static VALUE func_obliquity_of_ecliptic(VALUE self, VALUE vajd){
|
184
220
|
double jd = NUM2DBL(vajd);
|
185
221
|
double d = jd - DJ00;
|
@@ -187,18 +223,30 @@ static VALUE func_obliquity_of_ecliptic(VALUE self, VALUE vajd){
|
|
187
223
|
(23.439291 - 3.563E-7 * d) * D2R;
|
188
224
|
return DBL2NUM(roundf(vooe * RND12) / RND12);
|
189
225
|
}
|
190
|
-
|
226
|
+
/*
|
227
|
+
* call-seq:
|
228
|
+
* longitude_of_perihelion(ajd)
|
229
|
+
*
|
230
|
+
* given an Astronomical Julian Day Number
|
231
|
+
* returns Longitude of Sun at Perihelion in radians.
|
232
|
+
*
|
233
|
+
*
|
234
|
+
*/
|
191
235
|
static VALUE func_longitude_of_perihelion(VALUE self, VALUE vajd){
|
192
|
-
double
|
193
|
-
double
|
194
|
-
double vlop =
|
195
|
-
fmod(
|
196
|
-
(282.9404 +
|
197
|
-
4.70935e-05 * d
|
198
|
-
) * D2R, M2PI);
|
236
|
+
double vml = NUM2DBL(func_mean_longitude(self, vajd));
|
237
|
+
double vma = NUM2DBL(func_mean_anomaly(self, vajd));
|
238
|
+
double vlop = anp(vml - vma);
|
199
239
|
return DBL2NUM(roundf(vlop * RND12) / RND12);
|
200
240
|
}
|
201
|
-
|
241
|
+
/*
|
242
|
+
* call-seq:
|
243
|
+
* xv(ajd)
|
244
|
+
*
|
245
|
+
* given an Astronomical Julian Day Number
|
246
|
+
* returns X component of Radius Vector in radians.
|
247
|
+
*
|
248
|
+
*
|
249
|
+
*/
|
202
250
|
static VALUE func_xv(VALUE self, VALUE vajd){
|
203
251
|
double vea =
|
204
252
|
NUM2DBL(func_eccentric_anomaly(self, vajd));
|
@@ -207,7 +255,15 @@ static VALUE func_xv(VALUE self, VALUE vajd){
|
|
207
255
|
double vxv = cos(vea) - ve;
|
208
256
|
return DBL2NUM(roundf(vxv * RND12) / RND12);
|
209
257
|
}
|
210
|
-
|
258
|
+
/*
|
259
|
+
* call-seq:
|
260
|
+
* xv(ajd)
|
261
|
+
*
|
262
|
+
* given an Astronomical Julian Day Number
|
263
|
+
* returns Y component of Radius Vector in radians.
|
264
|
+
*
|
265
|
+
*
|
266
|
+
*/
|
211
267
|
static VALUE func_yv(VALUE self, VALUE vajd){
|
212
268
|
double vea =
|
213
269
|
NUM2DBL(func_eccentric_anomaly(self, vajd));
|
@@ -217,34 +273,44 @@ static VALUE func_yv(VALUE self, VALUE vajd){
|
|
217
273
|
sqrt(1.0 - ve * ve) * sin(vea);
|
218
274
|
return DBL2NUM(roundf(vyv * RND12) / RND12);
|
219
275
|
}
|
220
|
-
|
276
|
+
/*
|
277
|
+
* call-seq:
|
278
|
+
* true_anomaly1(ajd)
|
279
|
+
*
|
280
|
+
* given an Astronomical Julian Day Number
|
281
|
+
* returns True Anomaly of Sun in radians.
|
282
|
+
*
|
283
|
+
*/
|
221
284
|
static VALUE func_true_anomaly1(VALUE self, VALUE vajd){
|
222
285
|
double xv = NUM2DBL(func_xv(self, vajd));
|
223
286
|
double yv = NUM2DBL(func_yv(self, vajd));
|
224
287
|
double vta = anp(atan2(yv, xv));
|
225
288
|
return DBL2NUM(roundf(vta * RND12) / RND12);
|
226
289
|
}
|
227
|
-
|
290
|
+
/*
|
291
|
+
* call-seq:
|
292
|
+
* true_longitude1(ajd)
|
293
|
+
*
|
294
|
+
* given an Astronomical Julian Day Number
|
295
|
+
* returns True Longitude of Sun in radians.
|
296
|
+
*
|
297
|
+
*/
|
228
298
|
static VALUE func_true_longitude(VALUE self, VALUE vajd){
|
229
|
-
double
|
230
|
-
NUM2DBL(
|
231
|
-
double
|
232
|
-
NUM2DBL(
|
233
|
-
double vtl =
|
234
|
-
fmod(vta + vlop, M2PI);
|
299
|
+
double vml =
|
300
|
+
NUM2DBL(func_mean_longitude(self, vajd));
|
301
|
+
double veoc =
|
302
|
+
NUM2DBL(func_equation_of_center(self, vajd));
|
303
|
+
double vtl = anp(vml + veoc);
|
235
304
|
return DBL2NUM(roundf(vtl * RND12) / RND12);
|
236
305
|
}
|
237
|
-
|
238
306
|
/*
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
}
|
307
|
+
* call-seq:
|
308
|
+
* mean_sidereal_time(ajd)
|
309
|
+
*
|
310
|
+
* given an Astronomical Julian Day Number
|
311
|
+
* returns Greenwich Mean Sidereal Time in hours.
|
312
|
+
*
|
246
313
|
*/
|
247
|
-
|
248
314
|
static VALUE func_mean_sidetime(VALUE self, VALUE vajd){
|
249
315
|
double ajd = NUM2DBL(vajd);
|
250
316
|
long double sidereal;
|
@@ -260,7 +326,14 @@ static VALUE func_mean_sidetime(VALUE self, VALUE vajd){
|
|
260
326
|
/* change to hours */
|
261
327
|
return DBL2NUM(fmod(roundf((sidereal / 15.0) * RND12) / RND12, 24.0));
|
262
328
|
}
|
263
|
-
|
329
|
+
/*
|
330
|
+
* call-seq:
|
331
|
+
* gmsa0(ajd)
|
332
|
+
*
|
333
|
+
* given an Astronomical Julian Day Number
|
334
|
+
* returns Greenwich Mean Sidereal Time at midnight as angle.
|
335
|
+
*
|
336
|
+
*/
|
264
337
|
static VALUE func_gmsa0(VALUE self, VALUE vajd){
|
265
338
|
double msa0;
|
266
339
|
double ajd0 = NUM2DBL(vajd);
|
@@ -276,7 +349,14 @@ static VALUE func_gmsa0(VALUE self, VALUE vajd){
|
|
276
349
|
NUM2DBL(func_mean_sidetime(self, DBL2NUM(ajd0))) * 15;
|
277
350
|
return DBL2NUM(roundf(msa0 * RND12) / RND12);
|
278
351
|
}
|
279
|
-
|
352
|
+
/*
|
353
|
+
* call-seq:
|
354
|
+
* gmsa(ajd)
|
355
|
+
*
|
356
|
+
* given an Astronomical Julian Day Number
|
357
|
+
* returns Greenwich Mean Sidereal Time as angle.
|
358
|
+
*
|
359
|
+
*/
|
280
360
|
static VALUE func_gmsa(VALUE self, VALUE vajd){
|
281
361
|
double ajd = NUM2DBL(vajd) - 0.5;
|
282
362
|
double ajdt = fmod(ajd, 1.0);
|
@@ -285,18 +365,39 @@ static VALUE func_gmsa(VALUE self, VALUE vajd){
|
|
285
365
|
double msa = anp(msar0 + vtr) * R2D;
|
286
366
|
return DBL2NUM(roundf(msa * RND12) / RND12);
|
287
367
|
}
|
288
|
-
|
368
|
+
/*
|
369
|
+
* call-seq:
|
370
|
+
* gmst0(ajd)
|
371
|
+
*
|
372
|
+
* given an Astronomical Julian Day Number
|
373
|
+
* returns Greenwich Mean Sidereal Time at midnight in hours.
|
374
|
+
*
|
375
|
+
*/
|
289
376
|
static VALUE func_gmst0(VALUE self, VALUE vajd){
|
290
377
|
double era0 =
|
291
378
|
NUM2DBL(func_gmsa0(self, vajd)) / 15.0;
|
292
379
|
return DBL2NUM(roundf(era0 * RND12) / RND12);
|
293
380
|
}
|
294
|
-
|
381
|
+
/*
|
382
|
+
* call-seq:
|
383
|
+
* gmst(ajd)
|
384
|
+
*
|
385
|
+
* given an Astronomical Julian Day Number
|
386
|
+
* returns Greenwich Mean Sidereal Time in hours.
|
387
|
+
*
|
388
|
+
*/
|
295
389
|
static VALUE func_gmst(VALUE self, VALUE vajd){
|
296
390
|
double vmst = NUM2DBL(func_gmsa(self, vajd)) / 15.0;
|
297
391
|
return DBL2NUM(roundf(vmst * RND12) / RND12);
|
298
392
|
}
|
299
|
-
|
393
|
+
/*
|
394
|
+
* call-seq:
|
395
|
+
* radius_vector(ajd)
|
396
|
+
*
|
397
|
+
* given an Astronomical Julian Day Number
|
398
|
+
* returns radius vector.
|
399
|
+
*
|
400
|
+
*/
|
300
401
|
static VALUE func_rv(VALUE self, VALUE vajd){
|
301
402
|
double vxv =
|
302
403
|
NUM2DBL(func_xv(self, vajd));
|
@@ -306,7 +407,14 @@ static VALUE func_rv(VALUE self, VALUE vajd){
|
|
306
407
|
sqrt(vxv * vxv + vyv * vyv);
|
307
408
|
return DBL2NUM(roundf(vrv * RND12) / RND12);
|
308
409
|
}
|
309
|
-
|
410
|
+
/*
|
411
|
+
* call-seq:
|
412
|
+
* ecliptic_x(ajd)
|
413
|
+
*
|
414
|
+
* given an Astronomical Julian Day Number
|
415
|
+
* returns ecliptic x component.
|
416
|
+
*
|
417
|
+
*/
|
310
418
|
static VALUE func_ecliptic_x(VALUE self, VALUE vajd){
|
311
419
|
double vrv =
|
312
420
|
NUM2DBL(func_rv(self, vajd));
|
@@ -315,7 +423,14 @@ static VALUE func_ecliptic_x(VALUE self, VALUE vajd){
|
|
315
423
|
double vex = vrv * cos(vtl);
|
316
424
|
return DBL2NUM(roundf(vex * RND12) / RND12);
|
317
425
|
}
|
318
|
-
|
426
|
+
/*
|
427
|
+
* call-seq:
|
428
|
+
* ecliptic_y(ajd)
|
429
|
+
*
|
430
|
+
* given an Astronomical Julian Day Number
|
431
|
+
* returns ecliptic y component.
|
432
|
+
*
|
433
|
+
*/
|
319
434
|
static VALUE func_ecliptic_y(VALUE self, VALUE vajd){
|
320
435
|
double vrv =
|
321
436
|
NUM2DBL(func_rv(self, vajd));
|
@@ -324,7 +439,14 @@ static VALUE func_ecliptic_y(VALUE self, VALUE vajd){
|
|
324
439
|
double vey = vrv * sin(vtl);
|
325
440
|
return DBL2NUM(roundf(vey * RND12) / RND12);
|
326
441
|
}
|
327
|
-
|
442
|
+
/*
|
443
|
+
* call-seq:
|
444
|
+
* right_ascension(ajd)
|
445
|
+
*
|
446
|
+
* given an Astronomical Julian Day Number
|
447
|
+
* returns Right Ascension of Sun in hours.
|
448
|
+
*
|
449
|
+
*/
|
328
450
|
static VALUE func_right_ascension(VALUE self, VALUE vajd){
|
329
451
|
double vey =
|
330
452
|
NUM2DBL(func_ecliptic_y(self, vajd));
|
@@ -336,7 +458,14 @@ static VALUE func_right_ascension(VALUE self, VALUE vajd){
|
|
336
458
|
fmod(atan2(vey * cos(vooe), vex) + M2PI, M2PI);
|
337
459
|
return DBL2NUM(fmod(roundf((vra * R2D / 15.0) * RND12) / RND12, 24.0));
|
338
460
|
}
|
339
|
-
|
461
|
+
/*
|
462
|
+
* call-seq:
|
463
|
+
* gha(ajd)
|
464
|
+
*
|
465
|
+
* given an Astronomical Julian Day Number
|
466
|
+
* returns Greenwich Hour Angle in degrees.
|
467
|
+
*
|
468
|
+
*/
|
340
469
|
static VALUE func_gha(VALUE self, VALUE vajd){
|
341
470
|
double gmsa =
|
342
471
|
NUM2DBL(func_mean_sidetime(self, vajd)) * 15 * D2R;
|
@@ -345,7 +474,14 @@ static VALUE func_gha(VALUE self, VALUE vajd){
|
|
345
474
|
double gha = anp(gmsa - ra);
|
346
475
|
return DBL2NUM(roundf(gha * R2D * RND12) / RND12);
|
347
476
|
}
|
348
|
-
|
477
|
+
/*
|
478
|
+
* call-seq:
|
479
|
+
* declination(ajd)
|
480
|
+
*
|
481
|
+
* given an Astronomical Julian Day Number
|
482
|
+
* returns Declination of Sun in degrees.
|
483
|
+
*
|
484
|
+
*/
|
349
485
|
static VALUE func_declination(VALUE self, VALUE vajd){
|
350
486
|
double vex =
|
351
487
|
NUM2DBL(func_ecliptic_x(self, vajd));
|
@@ -358,13 +494,29 @@ static VALUE func_declination(VALUE self, VALUE vajd){
|
|
358
494
|
double vdec = atan2(vz, ver);
|
359
495
|
return DBL2NUM(roundf((vdec * R2D) * RND12) / RND12);
|
360
496
|
}
|
361
|
-
|
497
|
+
/*
|
498
|
+
* call-seq:
|
499
|
+
* local_sidereal_time(ajd, lon)
|
500
|
+
*
|
501
|
+
* given an Astronomical Julian Day Number and
|
502
|
+
* local Longitude,
|
503
|
+
* returns Local Mean Sidereal Time in hours.
|
504
|
+
*
|
505
|
+
*/
|
362
506
|
static VALUE func_local_sidetime(VALUE self, VALUE vajd, VALUE vlon){
|
363
507
|
double vst = NUM2DBL(func_mean_sidetime(self, vajd));
|
364
508
|
double vlst = vst + NUM2DBL(vlon) / 15.0 ;
|
365
509
|
return DBL2NUM(fmod(roundf(vlst * RND12) / RND12, 24.0));
|
366
510
|
}
|
367
|
-
|
511
|
+
/*
|
512
|
+
* call-seq:
|
513
|
+
* daylight_time(ajd, lat)
|
514
|
+
*
|
515
|
+
* given an Astronomical Julian Day Number and
|
516
|
+
* local Latitude,
|
517
|
+
* returns Hours of Day Light.
|
518
|
+
*
|
519
|
+
*/
|
368
520
|
static VALUE func_dlt(VALUE self, VALUE vajd, VALUE vlat){
|
369
521
|
double jd = floor(NUM2DBL(vajd));
|
370
522
|
double vsin_alt = sin(-0.8333 * D2R);
|
@@ -387,77 +539,152 @@ static VALUE func_dlt(VALUE self, VALUE vajd, VALUE vlat){
|
|
387
539
|
double vdlt = vdla / 15.0 * 2.0;
|
388
540
|
return DBL2NUM(roundf(vdlt * RND12) / RND12);
|
389
541
|
}
|
390
|
-
|
542
|
+
/*
|
543
|
+
* call-seq:
|
544
|
+
* diurnal_arc(ajd, lat)
|
545
|
+
*
|
546
|
+
* given an Astronomical Julian Day Number and
|
547
|
+
* local Latitude,
|
548
|
+
* returns Hours from Noon or half Day Light Time.
|
549
|
+
*
|
550
|
+
*/
|
391
551
|
static VALUE func_diurnal_arc(VALUE self, VALUE vajd, VALUE vlat){
|
392
552
|
double jd = floor(NUM2DBL(vajd));
|
393
553
|
double dlt = NUM2DBL(func_dlt(self, DBL2NUM(jd), vlat));
|
394
554
|
double da = dlt / 2.0;
|
395
555
|
return DBL2NUM(roundf(da * RND12) / RND12);
|
396
556
|
}
|
397
|
-
|
557
|
+
/*
|
558
|
+
* call-seq:
|
559
|
+
* t_south(ajd, lon)
|
560
|
+
*
|
561
|
+
* given an Astronomical Julian Day Number and
|
562
|
+
* local Longitude,
|
563
|
+
* returns Time in Hours when Sun transits local meridian.
|
564
|
+
*
|
565
|
+
*/
|
398
566
|
static VALUE func_t_south(VALUE self, VALUE vajd, VALUE vlon){
|
399
567
|
double jd = floor(NUM2DBL(vajd));
|
400
568
|
double lst = NUM2DBL(func_local_sidetime(self, DBL2NUM(jd), vlon));
|
401
569
|
double ra = NUM2DBL(func_right_ascension(self, DBL2NUM(jd)));
|
402
570
|
double vx = lst - ra;
|
403
571
|
double vt = vx - 24.0 * floor(vx * INV24 + 0.5);
|
404
|
-
//printf("%f", jd);
|
405
572
|
return DBL2NUM(fmod(roundf((12.0 - vt) * RND12) / RND12, 24.0));
|
406
|
-
//return DBL2NUM(fmod(-vx, 24.0));
|
407
|
-
//return DBL2NUM(lst - ra);
|
408
573
|
}
|
409
|
-
|
574
|
+
/*
|
575
|
+
* call-seq:
|
576
|
+
* t_rise(ajd, lat, lon)
|
577
|
+
*
|
578
|
+
* given an Astronomical Julian Day Number and
|
579
|
+
* local Latitude and Longitude,
|
580
|
+
* returns Time in Hours when Sun rises.
|
581
|
+
*
|
582
|
+
*/
|
410
583
|
static VALUE func_t_rise(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
411
584
|
double ts = NUM2DBL(func_t_south(self, vajd, vlon));
|
412
585
|
double da = NUM2DBL(func_diurnal_arc(self, vajd, vlat));
|
413
586
|
return DBL2NUM(fmod(roundf((ts - da) * RND12) / RND12, 24.0));
|
414
587
|
}
|
415
|
-
|
588
|
+
/*
|
589
|
+
* call-seq:
|
590
|
+
* t_mid_day(ajd, lat, lon)
|
591
|
+
*
|
592
|
+
* given an Astronomical Julian Day Number and
|
593
|
+
* local Latitude and Longitude,
|
594
|
+
* returns Time in Hours when Sun transits local meridian.
|
595
|
+
*
|
596
|
+
*/
|
416
597
|
static VALUE func_t_mid_day(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
417
598
|
double ts = NUM2DBL(func_t_south(self, vajd, vlon));
|
418
599
|
return DBL2NUM(fmod(roundf(ts * RND12) / RND12, 24.0));
|
419
600
|
}
|
420
|
-
|
601
|
+
/*
|
602
|
+
* call-seq:
|
603
|
+
* t_set(ajd, lat, lon)
|
604
|
+
*
|
605
|
+
* given an Astronomical Julian Day Number and
|
606
|
+
* local Latitude and Longitude,
|
607
|
+
* returns Time in Hours when Sun sets.
|
608
|
+
*
|
609
|
+
*/
|
421
610
|
static VALUE func_t_set(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
422
611
|
double ts = NUM2DBL(func_t_south(self, vajd, vlon));
|
423
612
|
double da = NUM2DBL(func_diurnal_arc(self, vajd, vlat));
|
424
613
|
return DBL2NUM(roundf(fmod((ts + da), 24.0) * RND12) / RND12);
|
425
614
|
}
|
426
|
-
|
615
|
+
/*
|
616
|
+
* call-seq:
|
617
|
+
* rise(ajd. lat, lon)
|
618
|
+
*
|
619
|
+
* given an Astronomical Julian Day Number and
|
620
|
+
* local Latitude and Longitude,
|
621
|
+
* returns a Ruby DateTime object when Sun rises.
|
622
|
+
*
|
623
|
+
*/
|
427
624
|
static VALUE func_rise(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
428
625
|
double rt = NUM2DBL(func_t_rise(self, vajd, vlat, vlon));
|
429
626
|
double ajd = NUM2DBL(vajd);
|
430
627
|
double rtajd = floor(ajd) - 0.5 + rt / 24.0;
|
431
628
|
VALUE vrt = DBL2NUM(rtajd);
|
432
|
-
//VALUE date = rb_sprintf("Sun rises: %2.0f:%02.0f UTC\n",
|
433
|
-
//floor(rt), floor(fmod(rt, 1) * 60.0));
|
434
629
|
return func_ajd_2_datetime(self, vrt);
|
435
630
|
}
|
436
|
-
|
631
|
+
/*
|
632
|
+
* call-seq:
|
633
|
+
* rise_jd(ajd, lat, lon)
|
634
|
+
*
|
635
|
+
* given an Astronomical Julian Day Number and
|
636
|
+
* local Latitude and Longitude,
|
637
|
+
* returns a Astronomical Julian Day Number when Sun rises.
|
638
|
+
*
|
639
|
+
*/
|
437
640
|
static VALUE func_rise_jd(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
438
641
|
double rt = NUM2DBL(func_t_rise(self, vajd, vlat, vlon));
|
439
642
|
double ajd = NUM2DBL(vajd);
|
440
643
|
double rtajd = floor(ajd) - 0.5 + rt / 24.0;
|
441
644
|
return DBL2NUM(rtajd);
|
442
645
|
}
|
443
|
-
|
646
|
+
/*
|
647
|
+
* call-seq:
|
648
|
+
* noon(ajd, lat, lon)
|
649
|
+
*
|
650
|
+
* given an Astronomical Julian Day Number and
|
651
|
+
* local Latitude and Longitude,
|
652
|
+
* returns a Ruby DateTime object when Sun transits
|
653
|
+
* local meridian.
|
654
|
+
*
|
655
|
+
*/
|
444
656
|
static VALUE func_noon(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
445
657
|
double nt = NUM2DBL(func_t_south(self, vajd, vlon));
|
446
658
|
double ajd = NUM2DBL(vajd);
|
447
659
|
double ntajd = floor(ajd) - 0.5 + nt / 24.0;
|
448
660
|
VALUE vnt = DBL2NUM(ntajd);
|
449
|
-
//VALUE date = rb_sprintf("Sun noon: %2.0f:%02.0f UTC\n",
|
450
|
-
//floor(nt), floor(fmod(nt, 1.0) * 60.0));
|
451
661
|
return func_ajd_2_datetime(self, vnt);
|
452
662
|
}
|
453
|
-
|
663
|
+
/*
|
664
|
+
* call-seq:
|
665
|
+
* noon_jd(ajd, lat, lon)
|
666
|
+
*
|
667
|
+
* given an Astronomical Julian Day Number and
|
668
|
+
* local Latitude and Longitude,
|
669
|
+
* returns a Astronomical Julian Day Number when Sun
|
670
|
+
* transits local meridian.
|
671
|
+
*
|
672
|
+
*/
|
454
673
|
static VALUE func_noon_jd(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
455
674
|
double nt = NUM2DBL(func_t_south(self, vajd, vlon));
|
456
675
|
double ajd = NUM2DBL(vajd);
|
457
676
|
double ntajd = floor(ajd) - 0.5 + nt / 24.0;
|
458
677
|
return DBL2NUM(ntajd);
|
459
678
|
}
|
460
|
-
|
679
|
+
/*
|
680
|
+
* call-seq:
|
681
|
+
* set(ajd, lat, lon)
|
682
|
+
*
|
683
|
+
* given an Astronomical Julian Day Number and
|
684
|
+
* local Latitude and Longitude,
|
685
|
+
* returns a Ruby DateTime object when Sun sets.
|
686
|
+
*
|
687
|
+
*/
|
461
688
|
static VALUE func_set(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
462
689
|
VALUE vst;
|
463
690
|
double stajd;
|
@@ -473,7 +700,15 @@ static VALUE func_set(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
|
473
700
|
//floor(st), floor(fmod(st, 1.0) * 60.0));
|
474
701
|
return func_ajd_2_datetime(self, vst);
|
475
702
|
}
|
476
|
-
|
703
|
+
/*
|
704
|
+
* call-seq:
|
705
|
+
* set_jd(ajd, lat, lon)
|
706
|
+
*
|
707
|
+
* given an Astronomical Julian Day Number and
|
708
|
+
* local Latitude and Longitude,
|
709
|
+
* returns a Astronomical Julian Day Number when Sun sets.
|
710
|
+
*
|
711
|
+
*/
|
477
712
|
static VALUE func_set_jd(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
478
713
|
double stajd;
|
479
714
|
double st = NUM2DBL(func_t_set(self, vajd, vlat, vlon));
|
@@ -485,38 +720,49 @@ static VALUE func_set_jd(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
|
485
720
|
stajd = floor(ajd) - 0.5 + st / 24.0;
|
486
721
|
return DBL2NUM(stajd);
|
487
722
|
}
|
488
|
-
|
489
|
-
|
490
|
-
static inline double
|
491
|
-
days_since_2000_Jan_0(int year, int month, int day, double hours){
|
492
|
-
double days_till_J2000;
|
493
|
-
days_till_J2000 = 367 * year - (7 * (
|
494
|
-
year + (month + 9) / 12) / 4) + 275 * month / 9 + day - 730531.5 + hours / 24;
|
495
|
-
return(days_till_J2000);
|
496
|
-
}
|
723
|
+
/*
|
724
|
+
* macro for days since JD 2000
|
497
725
|
*/
|
498
|
-
|
499
726
|
#define days_since_2000_Jan_0(y,m,d) \
|
500
727
|
(367L * (y) - ((7 * ((y) + (((m) + 9) / 12))) / 4) + ((275 * (m)) /9) + (d) - 730531.5L)
|
501
|
-
|
728
|
+
/*
|
729
|
+
* call-seq:
|
730
|
+
* jd2000_dif(ajd)
|
731
|
+
*
|
732
|
+
* given an Astronomical Julian Day Number
|
733
|
+
* returns the number of days and decimal time
|
734
|
+
* since JD 2000.
|
735
|
+
*
|
736
|
+
*/
|
502
737
|
static VALUE func_jd_from_2000(VALUE self, VALUE vajd){
|
503
|
-
/*VALUE vdatetime = func_ajd_2_datetime(self, vajd);
|
504
|
-
int year = NUM2INT(rb_funcall(vdatetime, rb_intern("year"), 0));
|
505
|
-
int month = NUM2INT(rb_funcall(vdatetime, rb_intern("month"), 0));
|
506
|
-
int day = NUM2INT(rb_funcall(vdatetime, rb_intern("day"), 0));
|
507
|
-
double days = days_since_2000_Jan_0(year, month, day);*/
|
508
738
|
double ajd = NUM2DBL(vajd);
|
509
739
|
double days = ajd - 2451545.0;
|
510
740
|
return INT2NUM(days);
|
511
741
|
}
|
512
|
-
|
742
|
+
/*
|
743
|
+
* call-seq:
|
744
|
+
* jd2000_dif_lon(ajd, lon)
|
745
|
+
*
|
746
|
+
* given an Astronomical Julian Day Number and
|
747
|
+
* local Longitude,
|
748
|
+
* returns the number of days and decimal time
|
749
|
+
* since JD 2000.
|
750
|
+
*
|
751
|
+
*/
|
513
752
|
static VALUE func_days_from_2000(VALUE self, VALUE vajd, VALUE vlon){
|
514
753
|
double jd = NUM2DBL(vajd);
|
515
754
|
double lon = NUM2DBL(vlon);
|
516
755
|
double days = jd - DJ00 - lon / 360;
|
517
756
|
return DBL2NUM(roundf(days * RND12) / RND12);
|
518
757
|
}
|
519
|
-
|
758
|
+
/*
|
759
|
+
* call-seq:
|
760
|
+
* eot(ajd)
|
761
|
+
*
|
762
|
+
* given an Astronomical Julian Day Number
|
763
|
+
* returns equation of time in degrees
|
764
|
+
*
|
765
|
+
*/
|
520
766
|
static VALUE func_eot(VALUE self, VALUE vajd){
|
521
767
|
double ma =
|
522
768
|
NUM2DBL(func_mean_anomaly(self, vajd));
|
@@ -528,23 +774,57 @@ static VALUE func_eot(VALUE self, VALUE vajd){
|
|
528
774
|
NUM2DBL(func_right_ascension(self, vajd));
|
529
775
|
return DBL2NUM(roundf(anp(ma - ta + tl - ra) * R2D * RND12) / RND12 );
|
530
776
|
}
|
531
|
-
|
777
|
+
/*
|
778
|
+
* call-seq:
|
779
|
+
* eot_jd(ajd)
|
780
|
+
*
|
781
|
+
* given an Astronomical Julian Day Number
|
782
|
+
* returns equation of time as time of a fractional
|
783
|
+
* day for easy Julian Number work
|
784
|
+
*
|
785
|
+
*/
|
786
|
+
static VALUE func_eot_jd(VALUE self, VALUE vajd){
|
787
|
+
double veot =
|
788
|
+
NUM2DBL(func_eot(self, vajd));
|
789
|
+
double jdeot = veot / 360.0;
|
790
|
+
return DBL2NUM(roundf(jdeot * RND12) / RND12);
|
791
|
+
}
|
792
|
+
/*
|
793
|
+
* call-seq:
|
794
|
+
* eot_min(ajd)
|
795
|
+
*
|
796
|
+
* given an Astronomical Julian Day Number
|
797
|
+
* returns equation of time in minutes
|
798
|
+
*
|
799
|
+
*/
|
532
800
|
static VALUE func_eot_min(VALUE self, VALUE vajd){
|
533
801
|
double eot = NUM2DBL(func_eot(self, vajd));
|
534
802
|
return DBL2NUM(roundf((eot / 15 * 60) * RND12) / RND12);
|
535
803
|
}
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
804
|
+
/*
|
805
|
+
* call-seq:
|
806
|
+
* lha(ajd, lon)
|
807
|
+
*
|
808
|
+
* given an Astronomical Julian Day Number and
|
809
|
+
* local Longitude,
|
810
|
+
* returns Local Hour Angle in degrees.
|
811
|
+
*
|
812
|
+
*/
|
541
813
|
static VALUE func_lha(VALUE self, VALUE vajd, VALUE vlon){
|
542
814
|
double lon = NUM2DBL(vlon) * D2R;
|
543
815
|
double gha = NUM2DBL(func_gha(self, vajd)) * D2R;
|
544
816
|
double lha = anp(gha + lon) * R2D;
|
545
817
|
return DBL2NUM(roundf(lha * RND12) / RND12);
|
546
818
|
}
|
547
|
-
|
819
|
+
/*
|
820
|
+
* call-seq:
|
821
|
+
* altitude(ajd, lat, lon)
|
822
|
+
*
|
823
|
+
* given an Astronomical Julian Day Number and
|
824
|
+
* local Latitude and Longitude,
|
825
|
+
* returns the Altitude of the Sun in degrees.
|
826
|
+
*
|
827
|
+
*/
|
548
828
|
static VALUE func_altitude(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
549
829
|
double lat = NUM2DBL(vlat) * D2R;
|
550
830
|
double delta = NUM2DBL(func_declination(self, vajd)) * D2R;
|
@@ -554,7 +834,15 @@ static VALUE func_altitude(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
|
554
834
|
cos(lat) * cos(delta) * cos(lha)) * R2D;
|
555
835
|
return DBL2NUM(roundf(alt * RND12) / RND12);
|
556
836
|
}
|
557
|
-
|
837
|
+
/*
|
838
|
+
* call-seq:
|
839
|
+
* azimuth(ajd, lat, lon)
|
840
|
+
*
|
841
|
+
* given an Astronomical Julian Day Number and
|
842
|
+
* local Latitude and Longitude,
|
843
|
+
* returns the Azimuth of the Sun in degrees.
|
844
|
+
*
|
845
|
+
*/
|
558
846
|
static VALUE func_azimuth(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
559
847
|
double lat = NUM2DBL(vlat) * D2R;
|
560
848
|
double delta = NUM2DBL(func_declination(self, vajd)) * D2R;
|
@@ -565,30 +853,50 @@ static VALUE func_azimuth(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
|
565
853
|
tan(delta) * cos(lat)) * R2D + 180.0;
|
566
854
|
return DBL2NUM(roundf(az * RND12) / RND12);
|
567
855
|
}
|
568
|
-
|
856
|
+
/*
|
857
|
+
* call-seq:
|
858
|
+
* rise_az(ajd, lat, lon)
|
859
|
+
*
|
860
|
+
* given an Astronomical Julian Day Number and
|
861
|
+
* local Latitude and Longitude,
|
862
|
+
* returns the Azimuth of the Sun rise in degrees.
|
863
|
+
*
|
864
|
+
*/
|
569
865
|
static VALUE func_rise_az(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
570
866
|
double rjd = NUM2DBL(func_rise_jd(self, vajd, vlat, vlon));
|
571
867
|
double raz = NUM2DBL(func_azimuth(self, DBL2NUM(rjd), vlat, vlon));
|
572
868
|
return DBL2NUM(raz);
|
573
869
|
}
|
574
|
-
|
870
|
+
/*
|
871
|
+
* call-seq:
|
872
|
+
* noon_az(ajd, lat, lon)
|
873
|
+
*
|
874
|
+
* given an Astronomical Julian Day Number and
|
875
|
+
* local Latitude and Longitude,
|
876
|
+
* returns the Azimuth of the Sun at transit in degrees.
|
877
|
+
* Note : should be very close to 180 degrees.
|
878
|
+
*
|
879
|
+
*/
|
575
880
|
static VALUE func_noon_az(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
576
881
|
double njd = NUM2DBL(func_noon_jd(self, vajd, vlat, vlon));
|
577
882
|
double naz = NUM2DBL(func_azimuth(self, DBL2NUM(njd), vlat, vlon));
|
578
883
|
return DBL2NUM(naz);
|
579
884
|
}
|
580
|
-
|
885
|
+
/*
|
886
|
+
* call-seq:
|
887
|
+
* set_az(ajd, lat, lon)
|
888
|
+
*
|
889
|
+
* given an Astronomical Julian Day Number and
|
890
|
+
* local Latitude and Longitude,
|
891
|
+
* returns the Azimuth of the Sun set in degrees.
|
892
|
+
*
|
893
|
+
*/
|
581
894
|
static VALUE func_set_az(VALUE self, VALUE vajd, VALUE vlat, VALUE vlon){
|
582
895
|
double sjd = NUM2DBL(func_set_jd(self, vajd, vlat, vlon));
|
583
896
|
double saz = NUM2DBL(func_azimuth(self, DBL2NUM(sjd), vlat, vlon));
|
584
897
|
return DBL2NUM(saz);
|
585
898
|
}
|
586
899
|
|
587
|
-
static VALUE func_rev12(VALUE self, VALUE vx){
|
588
|
-
double x = NUM2DBL(vx);
|
589
|
-
return DBL2NUM(x - 24.0 * floor(x * INV24 + 0.5));
|
590
|
-
}
|
591
|
-
|
592
900
|
void Init_calc_sun(void){
|
593
901
|
VALUE cCalcSun = rb_define_class("CalcSun", rb_cObject);
|
594
902
|
rb_require("date");
|
@@ -609,9 +917,10 @@ void Init_calc_sun(void){
|
|
609
917
|
rb_define_method(cCalcSun, "eccentric_anomaly", func_eccentric_anomaly, 1);
|
610
918
|
rb_define_method(cCalcSun, "ecliptic_x", func_ecliptic_x, 1);
|
611
919
|
rb_define_method(cCalcSun, "ecliptic_y", func_ecliptic_y, 1);
|
920
|
+
rb_define_method(cCalcSun, "eot", func_eot, 1);
|
921
|
+
rb_define_method(cCalcSun, "eot_jd", func_eot_jd, 1);
|
612
922
|
rb_define_method(cCalcSun, "eot_min", func_eot_min, 1);
|
613
923
|
rb_define_method(cCalcSun, "equation_of_center", func_equation_of_center, 1);
|
614
|
-
rb_define_method(cCalcSun, "equation_of_time", func_eot, 1);
|
615
924
|
rb_define_method(cCalcSun, "gha", func_gha, 1);
|
616
925
|
rb_define_method(cCalcSun, "gmsa0", func_gmsa0, 1);
|
617
926
|
rb_define_method(cCalcSun, "gmsa", func_gmsa, 1);
|
@@ -626,13 +935,11 @@ void Init_calc_sun(void){
|
|
626
935
|
rb_define_method(cCalcSun, "mean_anomaly", func_mean_anomaly, 1);
|
627
936
|
rb_define_method(cCalcSun, "mean_longitude", func_mean_longitude, 1);
|
628
937
|
rb_define_method(cCalcSun, "mean_sidereal_time", func_mean_sidetime, 1);
|
629
|
-
rb_define_method(cCalcSun, "min_to_s", func_min_to_s, 1);
|
630
938
|
rb_define_method(cCalcSun, "noon", func_noon, 3);
|
631
939
|
rb_define_method(cCalcSun, "noon_jd", func_noon_jd, 3);
|
632
940
|
rb_define_method(cCalcSun, "noon_az", func_noon_az, 3);
|
633
941
|
rb_define_method(cCalcSun, "obliquity_of_ecliptic", func_obliquity_of_ecliptic, 1);
|
634
942
|
rb_define_method(cCalcSun, "radius_vector", func_rv, 1);
|
635
|
-
rb_define_method(cCalcSun, "reverse_12", func_rev12, 1);
|
636
943
|
rb_define_method(cCalcSun, "right_ascension", func_right_ascension, 1);
|
637
944
|
rb_define_method(cCalcSun, "rise", func_rise, 3);
|
638
945
|
rb_define_method(cCalcSun, "rise_jd", func_rise_jd, 3);
|
data/lib/calc_sun/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calc_sun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Douglas Allen
|
@@ -30,14 +30,16 @@ cert_chain:
|
|
30
30
|
J4L8DCnzZFU8ARwINSdPvhk8WzXpVgErPQezTziVg7gAtBjqdJO5qVlAiOp+z7m2
|
31
31
|
gT57pae1qMGtqvMp
|
32
32
|
-----END CERTIFICATE-----
|
33
|
-
date: 2017-04-
|
33
|
+
date: 2017-04-07 00:00:00.000000000 Z
|
34
34
|
dependencies: []
|
35
35
|
description: |-
|
36
|
-
|
37
|
-
|
36
|
+
Given a Julian Day Number of day,
|
37
|
+
latitude decimal, and
|
38
|
+
longitude decimal in the calls to instance methods
|
38
39
|
rise(jd, lat, lon),
|
39
40
|
noon(jd, lat, lon), and
|
40
41
|
set(jd, lat, lon)
|
42
|
+
see source code for more details
|
41
43
|
email:
|
42
44
|
- kb9agt@gmail.com
|
43
45
|
executables: []
|
metadata.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
�
|
1
|
+
y���'�2�^����e����8J<�2�itd�E��$9���l��K�QnX'�w�$�B�ᦀ�TzEDF�"Kc�J
|
2
|
+
�/p�5�{f|Z�]dQ7�}�mv�G'��c.$P�O��Vq��3�Q�_���'�3)R����lW_
|
3
|
+
Q��:5�
|