sweph 2.10.3-5 → 2.10.3-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/index.d.ts +115 -20
- package/index.mjs +5 -0
- package/package.json +2 -2
- package/prebuilds/darwin-arm64/sweph.node +0 -0
- package/prebuilds/linux-arm64/sweph.node +0 -0
- package/prebuilds/linux-x64/sweph.node +0 -0
- package/prebuilds/win32-x64/sweph.node +0 -0
- package/src/functions/deg_midp.cpp +19 -0
- package/src/functions/difrad2n.cpp +19 -0
- package/src/functions/fixstar.cpp +1 -1
- package/src/functions/fixstar2.cpp +1 -1
- package/src/functions/fixstar2_ut.cpp +1 -1
- package/src/functions/fixstar_ut.cpp +1 -1
- package/src/functions/helio_cross.cpp +1 -1
- package/src/functions/helio_cross_ut.cpp +1 -1
- package/src/functions/lun_occult_when_loc.cpp +2 -2
- package/src/functions/pheno.cpp +1 -1
- package/src/functions/pheno_ut.cpp +1 -1
- package/src/functions/rad_midp.cpp +19 -0
- package/src/functions/set_interpolate_nut.cpp +14 -0
- package/src/functions/set_lapse_rate.cpp +14 -0
- package/src/functions/sol_eclipse_how.cpp +1 -1
- package/src/functions/sol_eclipse_when_glob.cpp +1 -1
- package/src/functions/sol_eclipse_when_loc.cpp +1 -1
- package/src/functions/sol_eclipse_where.cpp +1 -1
- package/src/functions/vis_limit_mag.cpp +1 -1
- package/src/sweph.cpp +5 -0
- package/src/sweph.h +6 -1
package/README.md
CHANGED
|
@@ -38,8 +38,8 @@ This library is version locked to the Swiss Ephemeris in addition to its own rev
|
|
|
38
38
|
|
|
39
39
|
Updates to this library will be released under new revisions, while updates to Swiss Ephemeris will be released under matching SemVer versions.
|
|
40
40
|
|
|
41
|
-
**Current Version: 2.10.3-
|
|
42
|
-
**Equivalent to Swiss Ephemeris version: 2.10.
|
|
41
|
+
**Current Version: 2.10.3-7**
|
|
42
|
+
**Equivalent to Swiss Ephemeris version: 2.10.03 revision 7**
|
|
43
43
|
|
|
44
44
|
## Documentation
|
|
45
45
|
|
|
@@ -49,7 +49,7 @@ This library is fully typed and documented via intellisense. To access its docum
|
|
|
49
49
|
|
|
50
50
|
## Ephemeris files
|
|
51
51
|
|
|
52
|
-
Ephemeris files are required to enable high precision calculations for planets and asteroids. This library does not include any ephemeris files by default, but you can download them from the official Swiss Ephemeris Github repository (main planets only) or the official Astrodienst
|
|
52
|
+
Ephemeris files are required to enable high precision calculations for planets and asteroids. This library does not include any ephemeris files by default, but you can download them from the official Swiss Ephemeris Github repository (main planets only) or the official Astrodienst Dropbox folder (all files):
|
|
53
53
|
|
|
54
54
|
* Swiss Ephemeris Github: [https://github.com/aloistr/swisseph/tree/master/ephe](https://github.com/aloistr/swisseph/tree/master/ephe)
|
|
55
55
|
* Astrodienst Dropbox [https://www.dropbox.com/scl/fo/y3naz62gy6f6qfrhquu7u/h?rlkey=ejltdhb262zglm7eo6yfj2940&dl=0](https://www.dropbox.com/scl/fo/y3naz62gy6f6qfrhquu7u/h?rlkey=ejltdhb262zglm7eo6yfj2940&dl=0)
|
|
@@ -82,10 +82,10 @@ If you find any inaccuracy or bug in this library, or if you find an upstream up
|
|
|
82
82
|
|
|
83
83
|
* While worker_threads are supported, the underlying C library is single threaded and contains process-wide settings. Functions such as `set_ephe_path()` or `set_sid_mode()` will affect the entire process, including all worker_threads. While you can still use worker_threads as long as you don't change settings from other threads in the middle of calculations, true thread-safe multithreading can only be achieved using child_process.
|
|
84
84
|
|
|
85
|
-
* This library is a C/C++ add-on designed for Node.JS only, it will not work in browsers, other JS engines or in any other environment that does not support native C/C++ add-ons made with Node's N-API.
|
|
85
|
+
* This library is a C/C++ add-on designed for Node.JS only, it will not work in browsers, other JS engines or in any other environment that does not support native C/C++ add-ons made with Node's N-API. Prebuilt binaries are included for supported platforms. If no matching prebuild is available for the target system, installation falls back to a native build and requires the necessary build tools, such as `python`, `make` and `gcc` on Linux, `xcode` on Mac, `visual c++ build tools` on Windows, and/or other equivalent solutions.
|
|
86
86
|
|
|
87
87
|
## Copyright
|
|
88
88
|
|
|
89
|
-
Copyright © 2021-
|
|
89
|
+
Copyright © 2021-2026, Timotej Valentin Rojko
|
|
90
90
|
|
|
91
|
-
This library is offered free of charge for any type of use, including commercial use
|
|
91
|
+
This library is offered free of charge for any type of use, including commercial use. If you rely on it in personal or commercial projects, consider sponsoring the project to help fund maintenance, updates, and support.
|
package/index.d.ts
CHANGED
|
@@ -898,7 +898,7 @@ declare module "sweph" {
|
|
|
898
898
|
/**
|
|
899
899
|
* First time object is visible:number, according to VR in JD
|
|
900
900
|
*/
|
|
901
|
-
|
|
901
|
+
TfirstVR: number,
|
|
902
902
|
/**
|
|
903
903
|
* optimum time the object is visible:number, according to VR in JD
|
|
904
904
|
*/
|
|
@@ -1118,15 +1118,15 @@ declare module "sweph" {
|
|
|
1118
1118
|
*/
|
|
1119
1119
|
equasc: number,
|
|
1120
1120
|
/**
|
|
1121
|
-
* Longitude of
|
|
1121
|
+
* Longitude of the Co-ascendant (W. Koch)
|
|
1122
1122
|
*/
|
|
1123
1123
|
coasc1: number,
|
|
1124
1124
|
/**
|
|
1125
|
-
* Longitude of
|
|
1125
|
+
* Longitude of the Co-ascendant (M. Munkasey)
|
|
1126
1126
|
*/
|
|
1127
1127
|
coasc2: number,
|
|
1128
1128
|
/**
|
|
1129
|
-
* Longitude of
|
|
1129
|
+
* Longitude of the Polar Ascendant (M. Munkasey)
|
|
1130
1130
|
*/
|
|
1131
1131
|
polasc: number
|
|
1132
1132
|
]
|
|
@@ -1204,15 +1204,15 @@ declare module "sweph" {
|
|
|
1204
1204
|
*/
|
|
1205
1205
|
equasc_speed: number,
|
|
1206
1206
|
/**
|
|
1207
|
-
* Momentary speed of
|
|
1207
|
+
* Momentary speed of the Co-ascendant (W. Koch)
|
|
1208
1208
|
*/
|
|
1209
1209
|
coasc1_speed: number,
|
|
1210
1210
|
/**
|
|
1211
|
-
* Momentary speed of
|
|
1211
|
+
* Momentary speed of the Co-ascendant (M. Munkasey)
|
|
1212
1212
|
*/
|
|
1213
1213
|
coasc2_speed: number,
|
|
1214
1214
|
/**
|
|
1215
|
-
* Momentary speed of
|
|
1215
|
+
* Momentary speed of the Polar Ascendant (M. Munkasey)
|
|
1216
1216
|
*/
|
|
1217
1217
|
polasc_speed: number
|
|
1218
1218
|
]
|
|
@@ -1734,7 +1734,11 @@ declare module "sweph" {
|
|
|
1734
1734
|
/**
|
|
1735
1735
|
* Apparent magnitude
|
|
1736
1736
|
*/
|
|
1737
|
-
magnitude: number
|
|
1737
|
+
magnitude: number,
|
|
1738
|
+
/**
|
|
1739
|
+
* Geocentric horizontal parallax (Moon only)
|
|
1740
|
+
*/
|
|
1741
|
+
parallax: number
|
|
1738
1742
|
]
|
|
1739
1743
|
|
|
1740
1744
|
export type RefracExtendedData = [
|
|
@@ -2100,7 +2104,7 @@ declare module "sweph" {
|
|
|
2100
2104
|
* ```
|
|
2101
2105
|
* ### Example
|
|
2102
2106
|
* ```
|
|
2103
|
-
* const time = cs2timestr(2345464, ":", true); // "
|
|
2107
|
+
* const time = cs2timestr(2345464, ":", true); // "06:30:55"
|
|
2104
2108
|
* ```
|
|
2105
2109
|
*
|
|
2106
2110
|
*/
|
|
@@ -2246,7 +2250,8 @@ declare module "sweph" {
|
|
|
2246
2250
|
* ```
|
|
2247
2251
|
* ### Example
|
|
2248
2252
|
* ```
|
|
2249
|
-
* const
|
|
2253
|
+
* const result = deltat_ex(2431232, constants.SEFLG_MOSEPH);
|
|
2254
|
+
* console.log(result.data); // 0.0003093125751840641
|
|
2250
2255
|
* ```
|
|
2251
2256
|
*
|
|
2252
2257
|
*/
|
|
@@ -2265,7 +2270,7 @@ declare module "sweph" {
|
|
|
2265
2270
|
* ```
|
|
2266
2271
|
* ### Example
|
|
2267
2272
|
* ```
|
|
2268
|
-
* const deltaT = deltat(2431232); // 0.
|
|
2273
|
+
* const deltaT = deltat(2431232); // 0.0003093386847061279
|
|
2269
2274
|
* ```
|
|
2270
2275
|
*
|
|
2271
2276
|
*/
|
|
@@ -2331,6 +2336,66 @@ declare module "sweph" {
|
|
|
2331
2336
|
*/
|
|
2332
2337
|
export function difdeg2n(deg1: number, deg2: number): number;
|
|
2333
2338
|
|
|
2339
|
+
/**
|
|
2340
|
+
* ### Description
|
|
2341
|
+
* Arc distance between two points in radians normalized to the range -PI to PI
|
|
2342
|
+
* ### Params
|
|
2343
|
+
* ```
|
|
2344
|
+
* • rad1: number // First point in radians
|
|
2345
|
+
* • rad2: number // Second point in radians
|
|
2346
|
+
* ```
|
|
2347
|
+
* ### Returns
|
|
2348
|
+
* ```
|
|
2349
|
+
* number // Distance in radians from -PI to PI
|
|
2350
|
+
* ```
|
|
2351
|
+
* ### Example
|
|
2352
|
+
* ```
|
|
2353
|
+
* const distance = difrad2n(Math.PI / 2, 0); // 1.5707963267948966
|
|
2354
|
+
* ```
|
|
2355
|
+
*
|
|
2356
|
+
*/
|
|
2357
|
+
export function difrad2n(rad1: number, rad2: number): number;
|
|
2358
|
+
|
|
2359
|
+
/**
|
|
2360
|
+
* ### Description
|
|
2361
|
+
* Midpoint between two points in degrees
|
|
2362
|
+
* ### Params
|
|
2363
|
+
* ```
|
|
2364
|
+
* • deg1: number // First point in degrees
|
|
2365
|
+
* • deg2: number // Second point in degrees
|
|
2366
|
+
* ```
|
|
2367
|
+
* ### Returns
|
|
2368
|
+
* ```
|
|
2369
|
+
* number // Midpoint in degrees
|
|
2370
|
+
* ```
|
|
2371
|
+
* ### Example
|
|
2372
|
+
* ```
|
|
2373
|
+
* const mid = deg_midp(10, 350); // 0
|
|
2374
|
+
* ```
|
|
2375
|
+
*
|
|
2376
|
+
*/
|
|
2377
|
+
export function deg_midp(deg1: number, deg2: number): number;
|
|
2378
|
+
|
|
2379
|
+
/**
|
|
2380
|
+
* ### Description
|
|
2381
|
+
* Midpoint between two points in radians
|
|
2382
|
+
* ### Params
|
|
2383
|
+
* ```
|
|
2384
|
+
* • rad1: number // First point in radians
|
|
2385
|
+
* • rad2: number // Second point in radians
|
|
2386
|
+
* ```
|
|
2387
|
+
* ### Returns
|
|
2388
|
+
* ```
|
|
2389
|
+
* number // Midpoint in radians
|
|
2390
|
+
* ```
|
|
2391
|
+
* ### Example
|
|
2392
|
+
* ```
|
|
2393
|
+
* const mid = rad_midp(0.1, 6.2); // 0.00840734641020724
|
|
2394
|
+
* ```
|
|
2395
|
+
*
|
|
2396
|
+
*/
|
|
2397
|
+
export function rad_midp(rad1: number, rad2: number): number;
|
|
2398
|
+
|
|
2334
2399
|
/**
|
|
2335
2400
|
* ### Description
|
|
2336
2401
|
* Arc distance between two points in degrees in a single direction
|
|
@@ -2369,7 +2434,7 @@ declare module "sweph" {
|
|
|
2369
2434
|
* ```
|
|
2370
2435
|
* ### Example
|
|
2371
2436
|
* ```
|
|
2372
|
-
* const result =
|
|
2437
|
+
* const result = fixstar_mag("Aldebaran");
|
|
2373
2438
|
* if(result.flag !== constants.OK) { throw new Error(result.error); }
|
|
2374
2439
|
* console.log(`
|
|
2375
2440
|
* Star: ${result.name}
|
|
@@ -2478,7 +2543,7 @@ declare module "sweph" {
|
|
|
2478
2543
|
* ```
|
|
2479
2544
|
* ### Example
|
|
2480
2545
|
* ```
|
|
2481
|
-
* const result =
|
|
2546
|
+
* const result = fixstar2_mag("Aldebaran");
|
|
2482
2547
|
* if(result.flag !== constants.OK) { throw new Error(result.error); }
|
|
2483
2548
|
* console.log(`
|
|
2484
2549
|
* Star: ${result.name}
|
|
@@ -2676,7 +2741,7 @@ declare module "sweph" {
|
|
|
2676
2741
|
* Get ayanamsa value from universal time without nutation
|
|
2677
2742
|
* ### Params
|
|
2678
2743
|
* ```
|
|
2679
|
-
* •
|
|
2744
|
+
* • tjd_ut: number // Julian day in universal time
|
|
2680
2745
|
* ```
|
|
2681
2746
|
* ### Returns
|
|
2682
2747
|
* ```
|
|
@@ -2860,7 +2925,7 @@ declare module "sweph" {
|
|
|
2860
2925
|
* ARCLact, // actual longitude difference between object and sun in degrees
|
|
2861
2926
|
* kact, // extinction coefficient
|
|
2862
2927
|
* minTAV, // smallest topocentric arcus visionis in degrees
|
|
2863
|
-
*
|
|
2928
|
+
* TfirstVR, // first time object is visible, according to VR in JD
|
|
2864
2929
|
* TbVR, // optimum time the object is visible, according to VR in JD
|
|
2865
2930
|
* TlastVR, // last time object is visible, according to VR in JD
|
|
2866
2931
|
* TbYallop, // best time the object is visible, according to Yallop in JD
|
|
@@ -3306,7 +3371,7 @@ declare module "sweph" {
|
|
|
3306
3371
|
* ```
|
|
3307
3372
|
* ### Example
|
|
3308
3373
|
* ```
|
|
3309
|
-
* const date = jdet_to_utc(2415423, constants.
|
|
3374
|
+
* const date = jdet_to_utc(2415423, constants.SE_GREG_CAL);
|
|
3310
3375
|
* console.log(date);
|
|
3311
3376
|
* ```
|
|
3312
3377
|
*
|
|
@@ -3334,7 +3399,7 @@ declare module "sweph" {
|
|
|
3334
3399
|
* ```
|
|
3335
3400
|
* ### Example
|
|
3336
3401
|
* ```
|
|
3337
|
-
* const date = jdut1_to_utc(2415423, constants.
|
|
3402
|
+
* const date = jdut1_to_utc(2415423, constants.SE_GREG_CAL);
|
|
3338
3403
|
* console.log(date);
|
|
3339
3404
|
* ```
|
|
3340
3405
|
*
|
|
@@ -4192,7 +4257,7 @@ declare module "sweph" {
|
|
|
4192
4257
|
* ```
|
|
4193
4258
|
* ### Example
|
|
4194
4259
|
* ```
|
|
4195
|
-
* const result =
|
|
4260
|
+
* const result = rise_trans(2555555, constants.SE_MOON, null, constants.SEFLG_SWIEPH, constants.SE_CALC_RISE, [95,40,200], 0, 0);
|
|
4196
4261
|
* if(result.flag !== constants.OK) { console.log(result.error); }
|
|
4197
4262
|
* console.log(result.data);
|
|
4198
4263
|
* ```
|
|
@@ -4233,6 +4298,21 @@ declare module "sweph" {
|
|
|
4233
4298
|
*/
|
|
4234
4299
|
export function set_ephe_path(path: string): void;
|
|
4235
4300
|
|
|
4301
|
+
/**
|
|
4302
|
+
* ### Description
|
|
4303
|
+
* Enable or disable nutation interpolation
|
|
4304
|
+
* ### Params
|
|
4305
|
+
* ```
|
|
4306
|
+
* • do_interpolate: boolean // Enable/disable nutation interpolation
|
|
4307
|
+
* ```
|
|
4308
|
+
* ### Example
|
|
4309
|
+
* ```
|
|
4310
|
+
* set_interpolate_nut(true);
|
|
4311
|
+
* ```
|
|
4312
|
+
*
|
|
4313
|
+
*/
|
|
4314
|
+
export function set_interpolate_nut(do_interpolate: boolean): void;
|
|
4315
|
+
|
|
4236
4316
|
/**
|
|
4237
4317
|
* ### Description
|
|
4238
4318
|
* Set JPL file
|
|
@@ -4293,6 +4373,21 @@ declare module "sweph" {
|
|
|
4293
4373
|
*/
|
|
4294
4374
|
export function set_tid_acc(t_acc: number): void;
|
|
4295
4375
|
|
|
4376
|
+
/**
|
|
4377
|
+
* ### Description
|
|
4378
|
+
* Set the atmospheric lapse rate used by the extended refraction calculations
|
|
4379
|
+
* ### Params
|
|
4380
|
+
* ```
|
|
4381
|
+
* • lapse_rate: number // Lapse rate [°K/m]
|
|
4382
|
+
* ```
|
|
4383
|
+
* ### Example
|
|
4384
|
+
* ```
|
|
4385
|
+
* set_lapse_rate(0.0065);
|
|
4386
|
+
* ```
|
|
4387
|
+
*
|
|
4388
|
+
*/
|
|
4389
|
+
export function set_lapse_rate(lapse_rate: number): void;
|
|
4390
|
+
|
|
4296
4391
|
/**
|
|
4297
4392
|
* ### Description
|
|
4298
4393
|
* Set geographic coordinates for topocentric mode
|
|
@@ -4435,7 +4530,7 @@ declare module "sweph" {
|
|
|
4435
4530
|
* ```
|
|
4436
4531
|
*
|
|
4437
4532
|
*/
|
|
4438
|
-
export function sol_eclipse_when_glob(tjd_start: number, ifl: number, iftype: number, backwards:
|
|
4533
|
+
export function sol_eclipse_when_glob(tjd_start: number, ifl: number, iftype: number, backwards: boolean): EclipseWhenGlob;
|
|
4439
4534
|
|
|
4440
4535
|
/**
|
|
4441
4536
|
* ### Description
|
|
@@ -4729,7 +4824,7 @@ declare module "sweph" {
|
|
|
4729
4824
|
* ```
|
|
4730
4825
|
* ### Example
|
|
4731
4826
|
* ```
|
|
4732
|
-
* const
|
|
4827
|
+
* const currentVersion = version(); // "2.10.03"
|
|
4733
4828
|
* ```
|
|
4734
4829
|
*
|
|
4735
4830
|
*/
|
package/index.mjs
CHANGED
|
@@ -20,7 +20,9 @@ export const constants = c;
|
|
|
20
20
|
export const close = s.close;
|
|
21
21
|
export const set_delta_t_userdef = s.set_delta_t_userdef;
|
|
22
22
|
export const set_ephe_path = s.set_ephe_path;
|
|
23
|
+
export const set_interpolate_nut = s.set_interpolate_nut;
|
|
23
24
|
export const set_jpl_file = s.set_jpl_file;
|
|
25
|
+
export const set_lapse_rate = s.set_lapse_rate;
|
|
24
26
|
export const set_sid_mode = s.set_sid_mode;
|
|
25
27
|
export const set_tid_acc = s.set_tid_acc;
|
|
26
28
|
export const set_topo = s.set_topo;
|
|
@@ -100,6 +102,9 @@ export const difcsn = s.difcsn;
|
|
|
100
102
|
export const difdegn = s.difdegn;
|
|
101
103
|
export const difcs2n = s.difcs2n;
|
|
102
104
|
export const difdeg2n = s.difdeg2n;
|
|
105
|
+
export const difrad2n = s.difrad2n;
|
|
106
|
+
export const deg_midp = s.deg_midp;
|
|
107
|
+
export const rad_midp = s.rad_midp;
|
|
103
108
|
export const csroundsec = s.csroundsec;
|
|
104
109
|
export const d2l = s.d2l;
|
|
105
110
|
export const day_of_week = s.day_of_week;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sweph",
|
|
3
|
-
"version": "2.10.3-
|
|
3
|
+
"version": "2.10.3-7",
|
|
4
4
|
"description": "The definitive Swiss Ephemeris bindings for Node.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sweph",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"prebuild": "prebuildify --napi --strip"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"node-addon-api": "^8.
|
|
50
|
+
"node-addon-api": "^8.9.0",
|
|
51
51
|
"node-gyp-build": "^4.8.4"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#include <sweph.h>
|
|
2
|
+
|
|
3
|
+
constexpr std::pair<int, const char*> args[] = {
|
|
4
|
+
{ 2, "Expecting 2 arguments: deg1, deg2" },
|
|
5
|
+
{ NUMBER, "Argument 1 should be a number - first point in degrees" },
|
|
6
|
+
{ NUMBER, "Argument 2 should be a number - second point in degrees" }
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
Napi::Value sweph_deg_midp(const Napi::CallbackInfo& info) {
|
|
10
|
+
Napi::Env env = info.Env();
|
|
11
|
+
if(!sweph_type_check(args, info)) {
|
|
12
|
+
return env.Null();
|
|
13
|
+
}
|
|
14
|
+
double mid = swe_deg_midp(
|
|
15
|
+
info[0].As<Napi::Number>().DoubleValue(),
|
|
16
|
+
info[1].As<Napi::Number>().DoubleValue()
|
|
17
|
+
);
|
|
18
|
+
return Napi::Number::New(env, mid);
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#include <sweph.h>
|
|
2
|
+
|
|
3
|
+
constexpr std::pair<int, const char*> args[] = {
|
|
4
|
+
{ 2, "Expecting 2 arguments: rad, rad" },
|
|
5
|
+
{ NUMBER, "Argument 1 should be a number - radians" },
|
|
6
|
+
{ NUMBER, "Argument 2 should be a number - radians" }
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
Napi::Value sweph_difrad2n(const Napi::CallbackInfo& info) {
|
|
10
|
+
Napi::Env env = info.Env();
|
|
11
|
+
if(!sweph_type_check(args, info)) {
|
|
12
|
+
return env.Null();
|
|
13
|
+
}
|
|
14
|
+
double dif = swe_difrad2n(
|
|
15
|
+
info[0].As<Napi::Number>().DoubleValue(),
|
|
16
|
+
info[1].As<Napi::Number>().DoubleValue()
|
|
17
|
+
);
|
|
18
|
+
return Napi::Number::New(env, dif);
|
|
19
|
+
}
|
|
@@ -18,7 +18,7 @@ Napi::Value sweph_fixstar(const Napi::CallbackInfo& info) {
|
|
|
18
18
|
strcpy(star, info[0].As<Napi::String>().Utf8Value().c_str());
|
|
19
19
|
int32 flag = swe_fixstar(
|
|
20
20
|
star,
|
|
21
|
-
info[1].As<Napi::Number>().
|
|
21
|
+
info[1].As<Napi::Number>().DoubleValue(),
|
|
22
22
|
info[2].As<Napi::Number>().Int32Value(),
|
|
23
23
|
xx,
|
|
24
24
|
serr
|
|
@@ -18,7 +18,7 @@ Napi::Value sweph_fixstar2(const Napi::CallbackInfo& info) {
|
|
|
18
18
|
strcpy(star, info[0].As<Napi::String>().Utf8Value().c_str());
|
|
19
19
|
int32 flag = swe_fixstar2(
|
|
20
20
|
star,
|
|
21
|
-
info[1].As<Napi::Number>().
|
|
21
|
+
info[1].As<Napi::Number>().DoubleValue(),
|
|
22
22
|
info[2].As<Napi::Number>().Int32Value(),
|
|
23
23
|
xx,
|
|
24
24
|
serr
|
|
@@ -18,7 +18,7 @@ Napi::Value sweph_fixstar2_ut(const Napi::CallbackInfo& info) {
|
|
|
18
18
|
strcpy(star, info[0].As<Napi::String>().Utf8Value().c_str());
|
|
19
19
|
int32 flag = swe_fixstar2_ut(
|
|
20
20
|
star,
|
|
21
|
-
info[1].As<Napi::Number>().
|
|
21
|
+
info[1].As<Napi::Number>().DoubleValue(),
|
|
22
22
|
info[2].As<Napi::Number>().Int32Value(),
|
|
23
23
|
xx,
|
|
24
24
|
serr
|
|
@@ -18,7 +18,7 @@ Napi::Value sweph_fixstar_ut(const Napi::CallbackInfo& info) {
|
|
|
18
18
|
strcpy(star, info[0].As<Napi::String>().Utf8Value().c_str());
|
|
19
19
|
int32 flag = swe_fixstar_ut(
|
|
20
20
|
star,
|
|
21
|
-
info[1].As<Napi::Number>().
|
|
21
|
+
info[1].As<Napi::Number>().DoubleValue(),
|
|
22
22
|
info[2].As<Napi::Number>().Int32Value(),
|
|
23
23
|
xx,
|
|
24
24
|
serr
|
|
@@ -19,7 +19,7 @@ Napi::Value sweph_helio_cross(const Napi::CallbackInfo& info) {
|
|
|
19
19
|
int32 flag = swe_helio_cross(
|
|
20
20
|
info[0].As<Napi::Number>().Int32Value(),
|
|
21
21
|
info[1].As<Napi::Number>().DoubleValue(),
|
|
22
|
-
info[2].As<Napi::Number>().
|
|
22
|
+
info[2].As<Napi::Number>().DoubleValue(),
|
|
23
23
|
info[3].As<Napi::Number>().Int32Value(),
|
|
24
24
|
info[4].As<Napi::Number>().Int32Value(),
|
|
25
25
|
&jd_cross,
|
|
@@ -19,7 +19,7 @@ Napi::Value sweph_helio_cross_ut(const Napi::CallbackInfo& info) {
|
|
|
19
19
|
int32 flag = swe_helio_cross_ut(
|
|
20
20
|
info[0].As<Napi::Number>().Int32Value(),
|
|
21
21
|
info[1].As<Napi::Number>().DoubleValue(),
|
|
22
|
-
info[2].As<Napi::Number>().
|
|
22
|
+
info[2].As<Napi::Number>().DoubleValue(),
|
|
23
23
|
info[3].As<Napi::Number>().Int32Value(),
|
|
24
24
|
info[4].As<Napi::Number>().Int32Value(),
|
|
25
25
|
&jd_cross,
|
|
@@ -16,8 +16,8 @@ Napi::Value sweph_lun_occult_when_loc(const Napi::CallbackInfo& info) {
|
|
|
16
16
|
return env.Null();
|
|
17
17
|
}
|
|
18
18
|
double geopos [3];
|
|
19
|
-
if(!sweph_double_array_converter(geopos, 3, info[
|
|
20
|
-
Napi::TypeError::New(env, args[
|
|
19
|
+
if(!sweph_double_array_converter(geopos, 3, info[4])) {
|
|
20
|
+
Napi::TypeError::New(env, args[5].second).ThrowAsJavaScriptException();
|
|
21
21
|
return env.Null();
|
|
22
22
|
}
|
|
23
23
|
double ret [10];
|
package/src/functions/pheno.cpp
CHANGED
|
@@ -24,6 +24,6 @@ Napi::Value sweph_pheno(const Napi::CallbackInfo& info) {
|
|
|
24
24
|
Napi::Object obj = Napi::Object::New(env);
|
|
25
25
|
obj["flag"] = flag;
|
|
26
26
|
obj["error"] = serr;
|
|
27
|
-
obj["data"] = sweph_js_array_converter(attr,
|
|
27
|
+
obj["data"] = sweph_js_array_converter(attr, 6, env);
|
|
28
28
|
return obj;
|
|
29
29
|
}
|
|
@@ -24,6 +24,6 @@ Napi::Value sweph_pheno_ut(const Napi::CallbackInfo& info) {
|
|
|
24
24
|
Napi::Object obj = Napi::Object::New(env);
|
|
25
25
|
obj["flag"] = flag;
|
|
26
26
|
obj["error"] = serr;
|
|
27
|
-
obj["data"] = sweph_js_array_converter(attr,
|
|
27
|
+
obj["data"] = sweph_js_array_converter(attr, 6, env);
|
|
28
28
|
return obj;
|
|
29
29
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#include <sweph.h>
|
|
2
|
+
|
|
3
|
+
constexpr std::pair<int, const char*> args[] = {
|
|
4
|
+
{ 2, "Expecting 2 arguments: rad1, rad2" },
|
|
5
|
+
{ NUMBER, "Argument 1 should be a number - first point in radians" },
|
|
6
|
+
{ NUMBER, "Argument 2 should be a number - second point in radians" }
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
Napi::Value sweph_rad_midp(const Napi::CallbackInfo& info) {
|
|
10
|
+
Napi::Env env = info.Env();
|
|
11
|
+
if(!sweph_type_check(args, info)) {
|
|
12
|
+
return env.Null();
|
|
13
|
+
}
|
|
14
|
+
double mid = swe_rad_midp(
|
|
15
|
+
info[0].As<Napi::Number>().DoubleValue(),
|
|
16
|
+
info[1].As<Napi::Number>().DoubleValue()
|
|
17
|
+
);
|
|
18
|
+
return Napi::Number::New(env, mid);
|
|
19
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#include <sweph.h>
|
|
2
|
+
|
|
3
|
+
constexpr std::pair<int, const char*> args[] = {
|
|
4
|
+
{ 1, "Expecting 1 argument: do_interpolate" },
|
|
5
|
+
{ TRUEFALSE, "Argument 1 should be a boolean - enable/disable nutation interpolation" }
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
void sweph_set_interpolate_nut(const Napi::CallbackInfo& info) {
|
|
9
|
+
if(!sweph_type_check(args, info)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
swe_set_interpolate_nut(info[0].As<Napi::Boolean>());
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#include <sweph.h>
|
|
2
|
+
|
|
3
|
+
constexpr std::pair<int, const char*> args[] = {
|
|
4
|
+
{ 1, "Expecting 1 arguments: lapse_rate" },
|
|
5
|
+
{ NUMBER, "Argument 1 should be a number - lapse rate [°K/m]" }
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
void sweph_set_lapse_rate(const Napi::CallbackInfo& info) {
|
|
9
|
+
if(!sweph_type_check(args, info)) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
swe_set_lapse_rate(info[0].As<Napi::Number>().DoubleValue());
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
constexpr std::pair<int, const char*> args[] = {
|
|
4
4
|
{ 3, "Expecting 3 arguments: tjd_ut, ifl, geopos" },
|
|
5
5
|
{ NUMBER, "Argument 1 should be a number - julian day in universal time" },
|
|
6
|
-
{ NUMBER, "Argument 2 should be a number -
|
|
6
|
+
{ NUMBER, "Argument 2 should be a number - ephemeris flag" },
|
|
7
7
|
{ ARRAY, "Argument 3 should be an array of 3 numbers - geographic coordinates [longitude, latitude, elevation]" }
|
|
8
8
|
};
|
|
9
9
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
constexpr std::pair<int, const char*> args[] = {
|
|
4
4
|
{ 4, "Expecting 4 arguments: tjd_start, ifl, ifltype, backward" },
|
|
5
5
|
{ NUMBER, "Argument 1 should be a number - julian day in universal time" },
|
|
6
|
-
{ NUMBER, "Argument 2 should be a number -
|
|
6
|
+
{ NUMBER, "Argument 2 should be a number - ephemeris flag" },
|
|
7
7
|
{ NUMBER, "Argument 3 should be a number - eclipse type" },
|
|
8
8
|
{ TRUEFALSE, "Argument 4 should be a boolean - backwards search" }
|
|
9
9
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
constexpr std::pair<int, const char*> args[] = {
|
|
4
4
|
{ 4, "Expecting 4 arguments: tjd_start, ifl, geopos, backward" },
|
|
5
5
|
{ NUMBER, "Argument 1 should be a number - julian day in universal time" },
|
|
6
|
-
{ NUMBER, "Argument 2 should be a number -
|
|
6
|
+
{ NUMBER, "Argument 2 should be a number - ephemeris flag" },
|
|
7
7
|
{ ARRAY, "Argument 3 should be an array of 3 numbers - geographic coordinates [longitude, latitude, elevation]" },
|
|
8
8
|
{ TRUEFALSE, "Argument 4 should be a boolean - backwards search" }
|
|
9
9
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
constexpr std::pair<int, const char*> args[] = {
|
|
4
4
|
{ 2, "Expecting 2 arguments: tjd_ut, ifl" },
|
|
5
5
|
{ NUMBER, "Argument 1 should be a number - julian day in universal time" },
|
|
6
|
-
{ NUMBER, "Argument 2 should be a number -
|
|
6
|
+
{ NUMBER, "Argument 2 should be a number - ephemeris flag" }
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
Napi::Value sweph_sol_eclipse_where(const Napi::CallbackInfo& info) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
constexpr std::pair<int, const char*> args[] = {
|
|
4
4
|
{ 6, "Expecting 6 arguments: tjd_ut, dgeo, datm, dobs, objectname, helflag" },
|
|
5
|
-
{ NUMBER, "Argument 1 should be a number -
|
|
5
|
+
{ NUMBER, "Argument 1 should be a number - julian day in universal time" },
|
|
6
6
|
{ ARRAY, "Argument 2 should be an array of 3 numbers - geographic coordinates [longitude, latitude, elevation]" },
|
|
7
7
|
{ ARRAY, "Argument 3 should be an array of 4 numbers - atmospheric conditions [pressure, temperature, humidity, meteorological range]" },
|
|
8
8
|
{ ARRAY, "Argument 4 should be an array of 6 numbers - observer description [age, sellen ratio, optical type, optical magnification, optical aperture, optical transmission]" },
|
package/src/sweph.cpp
CHANGED
|
@@ -4,7 +4,9 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
|
|
4
4
|
exports["close"] = Napi::Function::New(env, sweph_close);
|
|
5
5
|
exports["set_delta_t_userdef"] = Napi::Function::New(env, sweph_set_delta_t_userdef);
|
|
6
6
|
exports["set_ephe_path"] = Napi::Function::New(env, sweph_set_ephe_path);
|
|
7
|
+
exports["set_interpolate_nut"] = Napi::Function::New(env, sweph_set_interpolate_nut);
|
|
7
8
|
exports["set_jpl_file"] = Napi::Function::New(env, sweph_set_jpl_file);
|
|
9
|
+
exports["set_lapse_rate"] = Napi::Function::New(env, sweph_set_lapse_rate);
|
|
8
10
|
exports["set_sid_mode"] = Napi::Function::New(env, sweph_set_sid_mode);
|
|
9
11
|
exports["set_tid_acc"] = Napi::Function::New(env, sweph_set_tid_acc);
|
|
10
12
|
exports["set_topo"] = Napi::Function::New(env, sweph_set_topo);
|
|
@@ -84,6 +86,9 @@ Napi::Object Init(Napi::Env env, Napi::Object exports) {
|
|
|
84
86
|
exports["difdegn"] = Napi::Function::New(env, sweph_difdegn);
|
|
85
87
|
exports["difcs2n"] = Napi::Function::New(env, sweph_difcs2n);
|
|
86
88
|
exports["difdeg2n"] = Napi::Function::New(env, sweph_difdeg2n);
|
|
89
|
+
exports["difrad2n"] = Napi::Function::New(env, sweph_difrad2n);
|
|
90
|
+
exports["deg_midp"] = Napi::Function::New(env, sweph_deg_midp);
|
|
91
|
+
exports["rad_midp"] = Napi::Function::New(env, sweph_rad_midp);
|
|
87
92
|
exports["csroundsec"] = Napi::Function::New(env, sweph_csroundsec);
|
|
88
93
|
exports["d2l"] = Napi::Function::New(env, sweph_d2l);
|
|
89
94
|
exports["day_of_week"] = Napi::Function::New(env, sweph_day_of_week);
|
package/src/sweph.h
CHANGED
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
void sweph_close(const Napi::CallbackInfo& info);
|
|
9
9
|
void sweph_set_delta_t_userdef(const Napi::CallbackInfo& info);
|
|
10
10
|
void sweph_set_ephe_path(const Napi::CallbackInfo& info);
|
|
11
|
+
void sweph_set_interpolate_nut(const Napi::CallbackInfo& info);
|
|
11
12
|
void sweph_set_jpl_file(const Napi::CallbackInfo& info);
|
|
13
|
+
void sweph_set_lapse_rate(const Napi::CallbackInfo& info);
|
|
12
14
|
void sweph_set_sid_mode(const Napi::CallbackInfo& info);
|
|
13
15
|
void sweph_set_tid_acc(const Napi::CallbackInfo& info);
|
|
14
16
|
void sweph_set_topo(const Napi::CallbackInfo& info);
|
|
@@ -88,6 +90,9 @@ Napi::Value sweph_difcsn(const Napi::CallbackInfo& info);
|
|
|
88
90
|
Napi::Value sweph_difcs2n(const Napi::CallbackInfo& info);
|
|
89
91
|
Napi::Value sweph_difdegn(const Napi::CallbackInfo& info);
|
|
90
92
|
Napi::Value sweph_difdeg2n(const Napi::CallbackInfo& info);
|
|
93
|
+
Napi::Value sweph_difrad2n(const Napi::CallbackInfo& info);
|
|
94
|
+
Napi::Value sweph_deg_midp(const Napi::CallbackInfo& info);
|
|
95
|
+
Napi::Value sweph_rad_midp(const Napi::CallbackInfo& info);
|
|
91
96
|
Napi::Value sweph_csroundsec(const Napi::CallbackInfo& info);
|
|
92
97
|
Napi::Value sweph_d2l(const Napi::CallbackInfo& info);
|
|
93
98
|
Napi::Value sweph_day_of_week(const Napi::CallbackInfo& info);
|
|
@@ -116,4 +121,4 @@ enum TYPES {
|
|
|
116
121
|
TRUEFALSE
|
|
117
122
|
};
|
|
118
123
|
|
|
119
|
-
#endif
|
|
124
|
+
#endif
|