Git Product home page Git Product logo

astronomia's People

Contributors

commenthol avatar mdmunir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

astronomia's Issues

Stance to TypeScript?

Hi there. Currently there's no TypeScript typings which makes the library harder to work with. Would you be interested in rewrite of the library to TypeScript?

Get planetary posision?

Hi there!

Thanks for this library! I found some useful functions.

Is it possible to get planetary positions from this from a certain point in time and position?

Thanks!

[sunrise.js] TypeError: date.midnight is not a function

Code

    const dateObj = new Moment.tz('10.08.2015 17:09:01', 'DD.MM.YYYY HH:mm:ss', 'UTC')
    let sun = new sunrise.Sunrise(dateObj, 45.45, -75.0)

    console.log(sun.rise())... (I have all the available functions there)

Error

./node_modules/astronomia/lib/sunrise.js:88
    this.jde = date.midnight().toJDE();
                    ^
TypeError: date.midnight is not a function

😢

[moonphase] last() return the date of the moon from december when we are in february

Date is set to: 2019-02-02T07:48:18.028Z

const moonnode = require('astronomia').moonnode
const moonphase = require('astronomia').moonphase
const julian = require('astronomia').julian
var date = new Date()

{
      ascending: julian.JDToDate(moonnode.ascending(2019)),
      descending: julian.JDToDate(moonnode.descending(2019)),
      phases: { // julian.JDToCalendarGregorian
        newMoon: julian.JDToDate(moonphase.newMoon(date.getFullYear(), date.getMonth(), date.getDate())),
        first: julian.JDToDate(moonphase.first(date.getFullYear(), date.getMonth(), date.getDate())),
        full: julian.JDToDate(moonphase.full(date.getFullYear(), date.getMonth(), date.getDate())),
        last: julian.JDToDate(moonphase.last(date.getFullYear(), date.getMonth(), date.getDate())),
        meanLunarMonth: moonphase.meanLunarMonth,
      }

    }

Results:

ascending | "2018-12-24T11:55:34.404Z"
-- | --
descending | "2019-01-07T00:08:49.738Z"
phases |  
newMoon | "2019-01-06T01:29:30.434Z"
first | "2019-01-14T06:46:38.206Z"
full | "2019-01-21T05:17:10.850Z"
last | "2018-12-29T09:35:35.554Z"
meanLunarMonth | 29.530588861

According to : https://www.moongiant.com/calendar/January/2019/, last should be on 27 of January.

I'm not quite sure then how to get moon phase for a specific month.

[eclipse-lunar] Invalid attempt to destructure non-iterable instance when using decimal year

Error message:

statusCode | 500
error | "Internal Server Error"
message | "Invalid attempt to destructure non-iterable instance"

The comment of the lunar function says:
Argument year is a decimal year specifying a date.

How I get the year date:

// Get Year Date
var currentDate = new Date()
var calendarObj = new julian.Calendar(currentDate)
var decimalYear = calendarObj.toYear()
console.log(decimalYear) // 2019.0900790352

const solar = eclipse.solar(2019.0900790352) // Return none
const lunar = eclipse.lunar(2019.0900790352) // Return error

// Seems to work
const solar = eclipse.solar(2019)
const lunar = eclipse.lunar(2019)

Result when providing only the year:

solar |  
type | "Partial"
central | false
magnitude | 0.7163024593763634
distance | 1.1406033515377754
umbral | 0.02663833649884918
penumbral | 0.5727383364988492
date | "2019-01-06T01:41:27.496Z"
lunar |  
type | "Total"
magnitude | 1.1930450537543222
distance | 0.3697258633895531
umbral | 0.7474354176856587
penumbral | 1.277664582314341
sdTotal | 0.021278999304816974
sdPartial | 0.06785212737173021
sdPenumbral | 0.10745886851008073
date | "2019-01-21T05:11:56.158Z" // <-- seems accurate

I wonder what is the purpose of providing a year date for those functions. (I checked the dates from https://www.timeanddate.com/eclipse/solar/2019-january-6)

It seems those functions works fine with a year as integer.

strange output of julian.JDEToDate

function oddJDEToDate(){
  let d = 1721790.0684809217
  console.log([julian.JDEToDate(d), julian.JDEToDate(d+0.5)]) 
}
oddJDEToDate()  // [ 0001-12-31T10:42:33.414Z, 0002-12-31T22:42:33.428Z ]

Note: Difference between julian.JDEToDate(d) and julian.JDEToDate(d+0.5) is more than one year.

Example usage?

Are there any examples of how to use this library?

Examples for functions like getting the solstice?

I'm struggling to see any info on how to use this code.

optionalDependencies -> devDependencies

Hello!

Could you please update the package.json file for this module to move your "optionalDependencies" into "devDependencies"? Right now if I install this module as a dependency of my project, it adds 255 packages (from the packages and all the dependents listed in optionalDependencies - mostly eslint). None of those packages are actually needed by or used by Astronomia when the code is used. Optional dependencies in package.json is normally used for packages that are OS dependent (such as fsevents).

Thanks!

vsop87 return undefined

const astroVSOP = require('astronomia').vsop87
const vsopEarth = new astroVSOP.VSOP('earth', './VSOP/')
const astronomia = require('astronomia')
const vsopEarth = new astronomia.vsop87.VSOP(...)
- or -
const vsopEarth = new astronomia.VSOP(...)

I get 'Cannot read property 'VSOP' of undefined'

Also, console.logging the astronomia module, it doesn't export vsop87.

The goal is to use the object for solstice calculation:
astronomia.solstice.march2(year, vsopEarth)

Bundle library and VSOP87 data as UMD module

First off, hats off for putting in the time and effort to create this clean port of meeus! 👏

Lately I've been playing a bit with Observable but I've had some trouble importing Astronomia and the VSOP87 dataset.

While there is a guide on how to require “stubborn modules”, none of the techniques described quite work. I was able to load the main library through wzrd.in, but I've had to bundle and host the VSOP87 files separately on a private server to be able to import them in an Observable notebook.

Given that you’re already shipping the transpiled code in lib/, would you consider adding an extra build step with either Rollup or Webpack to bundle those files (as well as the files in data/) as UMD modules? I'm happy to look into this and submit a PR if you'd like.

julian day at January 27 at noon of the year

According Meeus(2009) page 61, Example 7.b, "the JD corresponding to January 27 at noon of the year 333" is 1842713.0

But following expression get 1842712

julian.DateToJD(new Date(Date.UTC(333,0,27,12,0,0)))

No way to calculate Jupiter's moons' shadows?

The api jupitermoons.e5() takes a mandatory earth argument. This is what one normally needs to compute transits, occultations, or just the visible positions.

However, to compute the shadow transits and eclipses, one would need to set Sun's radius vector to zero (Meeus, p. 315).

I don't see how this can be done. Am I missing something?
If not, can something be changed to allow that - e.g. ability pass a null earth argument, which would be considered as "make range be zero"?

Orient celestial sphere?

Great library!

I have a celestial sphere I created in Babylon.js (demo here) and am wanting to orient this correctly for a given geolocation, date and time.

Looking at the astronomia library, I could probably pass the northern celestial pole (NCP) to apparent then use the returned ra and dec to create the axis for the celestial sphere.

Is there a better way of doing this with the library?

Question about horizontal position / change of coordinates for moon

Hello - thank you for all the work that has gone into this library.

I wonder if you could help me understand an example of calculating the horizontal alt/az of the moon given a geographic position. Or: "Where is the moon?"

I can't get the output to match an Ephemeris from NASA : https://ssd.jpl.nasa.gov/horizons.cgi thought this is very definitely my implementation error.

Would you be able to help me out?

Assuming I import various things:

import Moonposition from "astronomia/src/moonposition";
import {Coord} from "astronomia/src/globe";
import {Ecliptic} from "astronomia/src/coord";
import Julian from "astronomia/src/julian";
import Sidereal from "astronomia/src/sidereal";
import {nutation} from "astronomia/src/nutation";

Define my coordinates as such:

// get the device's geographicCoordinates - or a fallback:

      let geographicCoordinates = new Coord(
        this.deviceCoordinates.latitude / 180 * Math.PI,
        this.deviceCoordinates.longitude / 180 * Math.PI
      );

I think I then:

  1. Get the ecliptic Moon position
  2. Convert this to Equatorial, by knowledge of the obliquity
  3. Convert this to Horizontal by knowledge of siderealTime + my location
      let calendar = new Julian.Calendar().fromDate(date)
      let jd = calendar.toJD()
      let jde = calendar.toJDE()
      let siderealTime = Sidereal.apparent0UT(jd);
      let eclipticMoonPosition = Moonposition.position(jde);
      let obliquity = nutation(jde)[1];

      let equatorialMoonPosition = new Ecliptic(
        eclipticMoonPosition.lat,
        eclipticMoonPosition.lon
      ).toEquatorial(obliquity);

      let horizontalMoonPosition = equatorialMoonPosition.toHorizontal(
        geographicCoordinates,
        siderealTime
      );

      return horizontalMoonPosition;

How to find apparent ra/dec of planets(such as mars, jupiter)?

Form HORIZONS Web-Interface,
use settings:

Ephemeris Type [change] : | OBSERVER
Target Body [change] : | Mars [499]
Observer Location [change] : | Geocentric [500]
Time Span [change] : | Start=2021-1-1, Stop=2021-1-2, Intervals=1
Table Settings [change] : | QUANTITIES=1,2,20; angle format=DEG
Display/Output [change] : | default (formatted HTML)

I can find mars location at 2021/1/1 0:0:0 UTC as follow:

**************************************************************************************************
 Date__(UT)__HR:MN:SC.fff     R.A.___(ICRF)___DEC R.A._(a-appar)_DEC.            delta      deldot
**************************************************************************************************
$$SOE
 2021-Jan-01 00:00:00.000      24.79948  11.23957  25.07558  11.34477 0.89856820833498  15.6579710
 2021-Jan-02 00:00:00.000      25.20526  11.41417  25.48167  11.51905 0.90763028296333  15.7216113
$$EOE
**************************************************************************************************

How can we use astronomia package to get such data with reasonal precision?

Unexpected .deg() result from sexagesimal.HourAngle and .RA

Is it intentional that the HourAngle class and its derived RA class return .hour() when .deg() is called?

I would have expected .deg() to convert the results into true decimal degrees, such that given:

    const sx = require('astronomia/sexagesimal');
    const ra = Math.PI / 2;
    const o = new sx.RA(ra)
    console.log(o.hour(), o.deg())

it should output 6 90 and not 6 6.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.