npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@behaver/solar-planets-hecc

v1.0.10

Published

This package is created for calcultating main planets of solar system heliocentric ecliptic coordinate.

Downloads

47

Readme

SolarPlanetsHECC

GitHub license npm version PRs Welcome

简介

SolarPlanetsHECC 是计算太阳系行星的动力学 Date 日心平黄道坐标的组件库,这其中包含了 MercuryMarsEarthVenusJupiterSaturnUranusNeptune 这八个太阳系行星的日心黄道坐标计算组件。

核心组件 VSOP87 计算器文档,另见:VSOP87Calculator

安装

通过 npm 安装,在你的 node 项目目录下执行:

npm install @behaver/solar-planets-hecc

安装完成后,调用即可:

const { MercuryHECC, MarsHECC, EarthHECC } = require('@behaver/solar-planets-hecc');

用例

const { VenusHECC } = require('@behaver/solar-planets-hecc');
const { JDateRepository } = require('@behaver/jdate');

let jdr = new JDateRepository(2446896);
let venus = VenusHECC(jdr);

// 获取金星日心黄经度数
let l = venus.l.getDegrees();

// 获取金星日心黄纬度数
let b = venus.b.getDegrees();

// 获取金星日心距离
let r = venus.r;

// 获取金星日心球坐标
let sc = venus.sc;

关于计算误差的设置:

const { VenusHECC } = require('@behaver/solar-planets-hecc');
const { JDateRepository } = require('@behaver/jdate');

let jdr = new JDateRepository(2446896);
let venus = VenusHECC(jdr);

// 方法一:调整精度等级
venus.accuracy = 'low';

// 方法二:设置计算截断值数组
venus.setTruncation('b', [ 20, 10, 5, 3, 2, 1 ]);

// 方法三:
// 设置最大误差(瞬时)
venus.setMaxError('r', 0.000005);

// 设置平均最大误差
venus.setMaxError('r', 0.000005, 'mean');

// 设置安全最大误差
venus.setMaxError('r', 0.000005, 'safe');

类图

SolarPlanetsHECC

API

constructor(obTime, accuracy = 'normal')

构造函数

  • obTime 观测儒略时间
  • accuracy 计算精度

get l()

获取 行星 Date 日心黄经值

get b()

获取 行星 Date 日心黄纬值

get r()

获取 行星 Date 日心距离,单位:AU

get sc()

获取 行星 Date 日心黄道球坐标

get obTime()

获取观测儒略时间

set obTime(jdr)

  • jdr 儒略时间对象

设定观测儒略时间

get accuracy()

获取计算精度

set accuracy(level)

设置计算精度

  • levev 包括以下几个等级:low, normal, high, fine, complete。

精度等级和安全最大误差(单位:弧度, AU)的对应关系:

  • low 0.00005
  • normal 0.000005
  • high 0.0000005
  • fine 0.00000005
  • complete 0

此处不考虑 VSOP87 数据算法自身误差,实际误差要进行叠加。

getTruncation(item)

获取截断值数组

  • item 计算项:l、b、r

setTruncation(item, tNumsArray)

设置截断值数组

  • item 计算项:l、b、r
  • tNumsArray 截断值数组

setMaxError(item, value, mode = 'true')

设置计算允许最大误差

通过此方法设置运算截断值相较于 setTruncation(item, tNumsArray)set accuracy(level) 会产生额外的运算量,若为了缩小运算量而使用该方法,则不适于多次调用。

  • item 计算项:l、b、r
  • value 最大误差数值
  • mode 计算模式: true(瞬时误差)、mean(平均误差)、safe(安全误差)

getMaxError(item)

获取最大误差

  • item 计算项:l、b、r

许可证书

The MIT license.