@behaver/diurnal-parallax
Advanced tools
Comparing version 1.0.2 to 1.0.3
18
index.js
@@ -46,4 +46,4 @@ 'use strict' | ||
* @param {Number} options.obGeoLat 观测位置地理纬度,单位:度,值域:[-90, 90] | ||
* @param {Number} options.obElevation 观测位置海拔高度,单位:米,值域:[-12000, 3e7] | ||
* @param {SiderealTime} options.siderealTime 观测位置的当地真恒星时对象 | ||
* @param {Number} options.elevation 观测位置海拔高度,单位:米,值域:[-12000, 3e7] | ||
* | ||
@@ -56,9 +56,9 @@ * @return {DiurnalParallax} 返回 this 引用 | ||
obGeoLat, | ||
obElevation, | ||
siderealTime, | ||
elevation, | ||
}) { | ||
// 参数预处理 | ||
if (elevation === undefined) elevation = 0; | ||
else if (typeof(elevation) !== 'number') throw Error('The param elevation should be a Number.'); | ||
else if (elevation > 3e7 || elevation < -12000) throw Error('The param elevation should be in (-12000, 3e7).'); | ||
if (obElevation === undefined) obElevation = 0; | ||
else if (typeof(obElevation) !== 'number') throw Error('The param obElevation should be a Number.'); | ||
else if (obElevation > 3e7 || obElevation < -12000) throw Error('The param obElevation should be in (-12000, 3e7).'); | ||
@@ -73,3 +73,3 @@ if (siderealTime === undefined) throw Error('The param siderealTime should be defined.'); | ||
obGeoLat, | ||
elevation, | ||
obElevation, | ||
siderealTime, | ||
@@ -112,6 +112,6 @@ } | ||
// 海拔高度,单位:千米 | ||
let elevation = this.private.elevation / 1000; | ||
let obElevation = this.private.obElevation / 1000; | ||
// 站心与地心向径的赤道平面投影长度,单位:千米 | ||
let r = EAR * Math.cos(geocentricLat) + elevation * Math.cos(geographicLat); | ||
let r = EAR * Math.cos(geocentricLat) + obElevation * Math.cos(geographicLat); | ||
@@ -122,3 +122,3 @@ // 空间直角坐标系下周日视差的各轴修正值结果,单位:千米 | ||
y: r * Math.sin(TST), | ||
z: EAR * Math.sin(geocentricLat) * PER + elevation * Math.sin(geographicLat), | ||
z: EAR * Math.sin(geocentricLat) * PER + obElevation * Math.sin(geographicLat), | ||
} | ||
@@ -125,0 +125,0 @@ |
{ | ||
"name": "@behaver/diurnal-parallax", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "The package is for calculating diurnal parallax.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -43,3 +43,3 @@ # DiurnalParallax | ||
// 观测位置海拔高度,单位:千米 | ||
let elevation = 1713; | ||
let obElevation = 1713; | ||
@@ -66,3 +66,3 @@ // 观测位置恒星时对象 | ||
obGeoLat, | ||
elevation, | ||
obElevation, | ||
}); | ||
@@ -89,4 +89,4 @@ | ||
* options.obGeoLat 观测位置地理纬度,单位:度,值域:[-90, 90] | ||
* options.obElevation 观测位置海拔高度,单位:米,值域:[-12000, 3e7] | ||
* options.siderealTime 观测位置的当地真恒星时对象,参数类型为 SiderealTime 对象 | ||
* options.elevation 观测位置海拔高度,单位:米,值域:[-12000, 3e7] | ||
@@ -93,0 +93,0 @@ `set TC(tc)` |
@@ -35,3 +35,3 @@ const expect = require("chai").expect; | ||
it('The param elevation should be a Number.', () => { | ||
it('The param obElevation should be a Number.', () => { | ||
expect(() => { | ||
@@ -42,3 +42,3 @@ let dp = new DiurnalParallax({ | ||
obGeoLat: 33, | ||
elevation: 1111, | ||
obElevation: 1111, | ||
}); | ||
@@ -52,3 +52,3 @@ }).not.to.throw(); | ||
obGeoLat: 33, | ||
elevation: '111', | ||
obElevation: '111', | ||
}); | ||
@@ -58,3 +58,3 @@ }).to.throw(); | ||
it('The param elevation should be in (-12000, 3e7).', () => { | ||
it('The param obElevation should be in (-12000, 3e7).', () => { | ||
expect(() => { | ||
@@ -65,3 +65,3 @@ let dp = new DiurnalParallax({ | ||
obGeoLat: 33, | ||
elevation: -12001, | ||
obElevation: -12001, | ||
}); | ||
@@ -75,3 +75,3 @@ }).to.throw(); | ||
obGeoLat: 33, | ||
elevation: 3e8, | ||
obElevation: 3e8, | ||
}); | ||
@@ -214,3 +214,3 @@ }).to.throw(); | ||
let obGeoLat = angle.parseDACString('33°21′21″').getDegrees(); | ||
let elevation = 1713; | ||
let obElevation = 1713; | ||
@@ -230,3 +230,3 @@ let siderealTime = new SiderealTime(jdate, obGeoLong); | ||
obGeoLat: obGeoLat, | ||
elevation: 1713, | ||
obElevation: 1713, | ||
}); | ||
@@ -248,3 +248,3 @@ | ||
let obGeoLat = angle.parseDACString('33°21′21″').getDegrees(); | ||
let elevation = 1713; | ||
let obElevation = 1713; | ||
@@ -262,3 +262,3 @@ let siderealTime = new SiderealTime(jdate, obGeoLong); | ||
obGeoLat: obGeoLat, | ||
elevation: 1713, | ||
obElevation: 1713, | ||
}); | ||
@@ -265,0 +265,0 @@ |
1383194