astro_calculations 0.0.1
astro_calculations: ^0.0.1 copied to clipboard

A starting point for Dart libraries or applications.

astro_calculations #

astro_calculations is a Dart package for astronomical calculations. astro_calculations is inspired by Pysolar and based on this pdf by Ibrahim Reda and Afshin Andreas.

astro_calculations is currently a work in progress. It will soon support many more calculations.

Usage #

SUNRISE TIME
By default all functions return DateTime object for UTC. To get it in Local format, pass isLocal as true.

  final latitude = 28.6139;
  final longitude = 77.2090;
  final dateTime = DateTime.utc(2020, 12, 30);

  final sunRiseTime =
      getSunRiseTime(latitude, longitude, dateTime, isLocal: true);

SUNSET TIME

 final sunSetTime =
      getSunSetTime(latitude, longitude, dateTime, isLocal: true);

SUN TRANSIT TIME

 final sunTransitTime =
      getSunTransitTime(latitude, longitude, dateTime, isLocal: true);

AZIMUTH ANGLE OF SUN

 final azimuthAngle =
      getSunAzimuthAngle(latitude, longitude, elevation); //elevation is w.r.t. Sea level

Example #

void main() {
  final latitude = 28.6139;
  final longitude = 77.2090;
  final dateTime = DateTime.utc(2020, 12, 30);

  final sunRiseTime =
      getSunRiseTime(latitude, longitude, dateTime, isLocal: true);
  final sunSetTime =
      getSunSetTime(latitude, longitude, dateTime, isLocal: true);
  final sunTransitTime =
      getSunTransitTime(latitude, longitude, dateTime, isLocal: true);

  print('Sunrise Time: $sunRiseTime');
  print('Sunset Time: $sunSetTime');
  print('Sun Transit Time: $sunTransitTime');
}

OUTPUT

Sunrise Time: 2020-12-30 07:13:20.000
Sunset Time: 2020-12-30 17:34:16.000
Sun Transit Time: 2020-12-30 12:23:46.000

Created from templates made available by Stagehand under a BSD-style license.

0
likes
80
pub points
0%
popularity

A starting point for Dart libraries or applications.

Repository (GitHub)
View/report issues

Documentation

API reference

License

LICENSE

Dependencies

meta

More

Packages that depend on astro_calculations