nrel-spa-dart/.github/wiki/Home.md

998 B

nrel_spa

NREL Solar Position Algorithm for Dart and Flutter. Calculates solar zenith, azimuth, sunrise, sunset, and solar noon for any location and time. Pure Dart, zero dependencies, accurate to ±0.0003 degrees.

Based on Reda & Andreas (2004), NREL/TP-560-34302.

Install

dependencies:
  nrel_spa: ^1.0.1
import 'package:nrel_spa/nrel_spa.dart';

final result = getSpa(
  DateTime.utc(2024, 3, 15, 17, 0, 0),
  40.7128,   // latitude
  -74.0060,  // longitude
  -5.0,      // UTC offset (EST)
);

print('Zenith:  ${result.zenith.toStringAsFixed(4)}°');
print('Sunrise: ${result.sunrise.toStringAsFixed(4)} h');

Contents