How to use the astronomia/lib/planetposition.Planet function in astronomia

To help you get started, we’ve selected a few astronomia examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github commenthol / date-chinese / src / Chinese.js View on Github external
/**
 * @copyright 2016 commenthol
 * @license MIT
 */

// import {base, solstice, solar, moonphase, planetposition, julian, data} from 'astronomia' // TODO waiting for tree-shaking that works...
import base from 'astronomia/lib/base'
import solstice from 'astronomia/lib/solstice'
import solar from 'astronomia/lib/solar'
import moonphase from 'astronomia/lib/moonphase'
import planetposition from 'astronomia/lib/planetposition'
import julian from 'astronomia/lib/julian'
import dataEarth from 'astronomia/data/vsop87Bearth'

const earth = new planetposition.Planet(dataEarth)
const lunarOffset = moonphase.meanLunarMonth / 2
const p = 180 / Math.PI

// Start of Chinese Calendar in 2636 BCE by Chalmers
const epochY = -2636
const epoch = new julian.CalendarGregorian(epochY, 2, 15).toJDE()

function toYear (jde) {
  return new julian.CalendarGregorian().fromJDE(jde).toYear()
}

// prevent rounding errors
function toFixed (val, e) {
  return parseFloat(val.toFixed(e), 10)
}
github commenthol / date-chinese / lib / Chinese.js View on Github external
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 * @copyright 2016 commenthol
 * @license MIT
 */

var base = require('astronomia/lib/base');
var solstice = require('astronomia/lib/solstice');
var solar = require('astronomia/lib/solar');
var moonphase = require('astronomia/lib/moonphase');
var planetpos = require('astronomia/lib/planetposition');
var julian = require('astronomia/lib/julian');

var earth = new planetpos.Planet(require('astronomia/data/vsop87Bearth.js'));
var lunarOffset = moonphase.meanLunarMonth / 2;
var p = 180 / Math.PI;

// Start of Chinese Calendar in 2636 BCE by Chalmers
var epochY = -2636;
var epoch = new julian.CalendarGregorian(epochY, 2, 15).toJDE();

function toYear(jde) {
  return new julian.CalendarGregorian().fromJDE(jde).toYear();
}

// prevent rounding errors
function toFixed(val, e) {
  return parseFloat(val.toFixed(e), 10);
}
github commenthol / date-holidays-parser / src / Equinox.js View on Github external
'use strict'

const solstice = require('astronomia/lib/solstice')
const julian = require('astronomia/lib/julian')
const planetpos = require('astronomia/lib/planetposition')
const earth = new planetpos.Planet(require('astronomia/data/vsop87Bearth'))

const moment = require('moment-timezone')
const CalEvent = require('./CalEvent')
const CalDate = require('caldate')

class Equinox extends CalEvent {
  /**
   * @param {object} [opts]
   * @param {string} opts.season - type of season (spring|summer|autumn|winter)
   * @param {number|string} opts.offset - offset in days
   */
  constructor (opts) {
    opts = opts || {}
    super(opts)

    this._season = opts.season