Skip to content

Library that tells you the best time for stargazing in the next 5 days

License

Notifications You must be signed in to change notification settings

SevInf/stargazing-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

stargazing-time

Build Status codecov

Library that tells you the best time for stargazing in the next 5 days using OpenWeatherMap.

Usage

First of all, you need to obtain OpenWeatherMap API key.

Once you have it, you can start using the library. You can specify the place you want to query in 3 different ways:

Using city name + country code

const StargazingTime = require('stargazing-time');
StargazingTime.getGoodTimes({
        city: 'Berlin,de',
        apiKey: '<YOUR API KEY>'
    })
    .then(results => console.log(results));

Using OpenWeatherMap city id

const StargazingTime = require('stargazing-time');
StargazingTime.getGoodTimes({
        id: 2950159,
        apiKey: '<YOUR API KEY>'
    })
    .then(results => console.log(results));

Find out more about city ids;

Using coordinates

const StargazingTime = require('stargazing-time');
StargazingTime.getGoodTimes({
        lat: 52.52436,
        lon: 13.41053,
        apiKey: '<YOUR API KEY>'
    })
    .then(results => console.log(results));

Response format

getGoodTimes returns a promise to array of time intervals in the next 5 days, which can be good for stargazing. Each element of array has the following fields:

  • from: Date — beginning time of the interval
  • to: Date — end time of the interval
  • forecast — original weather forecast, as per OpenWeatherMap JSON API.

The time interval considered good if:

  1. It is night (doh!)
  2. Cloudiness is less than 30%

License

MIT

About

Library that tells you the best time for stargazing in the next 5 days

Resources

License

Stars

Watchers

Forks

Packages

No packages published