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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@behaver/diurnal-parallax

v1.1.6

Published

The package is for calculating diurnal parallax.

Readme

DiurnalParallax

GitHub license npm version PRs Welcome

简介

DiurnalParallax 是一个关于天体坐标的周日视差的计算组件,可用以转换站心与地心坐标。

以月球为例,其周日视差的示意图:

周日月球视差

用例

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

npm i --save @behaver/diurnal-parallax

安装完成后,调用即可:

const DiurnalParallax = require('@behaver/diurnal-parallax');

const DiurnalParallax = require('@behaver/diurnal-parallax');
const { JDateRepository } = require('@behaver/jdate');
const SiderealTime = require('@behaver/sidereal-time');
const { SphericalCoordinate3D } = require('@behaver/coordinate/3d');
const Angle = require('@behaver/angle');

const angle = new Angle;

// 观测时间
let date = new Date('2003/08/28 11:17:00');

// 观测儒略时间
let jdate = new JDateRepository(date, 'date');

// 观测位置经纬
let obGeoLong = angle.parseDACString('116°51′50″').getDegrees();
let obGeoLat = angle.parseDACString('33°21′21″').getDegrees();

// 观测位置海拔高度,单位:千米
let obElevation = 1713;

// 观测位置恒星时对象
let siderealTime = new SiderealTime(jdate, obGeoLong);

// 天体距离,单位:AU
let r = 0.37276;

// 天体球坐标 theta 值
let theta = angle.setDegrees(90 + 15.771083).getRadian();

// 天体球坐标 phi 值
let phi = angle.setDegrees(339.530208).getRadian();

// 天体位置赤道球坐标
let gc = new SphericalCoordinate3D(r, theta, phi);

// 实例化周日视差
let dp = new DiurnalParallax({
  gc,
  siderealTime,
  obGeoLat,
  obElevation,
  system: 'equinoctial',
});

// 获取站心球坐标
let tc = dp.TC;

API

constructor(options)

构造函数,接口同 init 方法

init(options)

初始化方法

规定参数:

  • options.gc 地心球坐标,参数类型为 SphericalCoordinate3D 对象
  • options.tc 站心球坐标,参数类型为 SphericalCoordinate3D 对象
  • options.obGeoLat 观测位置地理纬度,单位:度,值域:[-90, 90]
  • options.obElevation 观测位置海拔高度,单位:米,值域:[-12000, 3e7]
  • options.siderealTime 观测位置的当地真恒星时对象,参数类型为 SiderealTime 对象
  • options.system 球坐标系统类型,可选用:equinoctial(赤道坐标) 和 horizontal(地平坐标),默认为:equinoctial

set TC(tc)

设置站心球坐标对象

参数类型为 SphericalCoordinate3D 对象,规定参数球坐标中 r 值单位为:AU

get TC()

获取站心球坐标对象

set GC(gc)

设置地心球坐标对象

参数类型为 SphericalCoordinate3D 对象,规定参数球坐标中 r 值单位为:AU

get GC()

获取地心球坐标对象

许可证书

The MIT license.