mirror of
https://github.com/acamarata/nrel-spa.git
synced 2026-06-30 19:04:25 +00:00
Complete modernization of the package. The core SPA algorithm is unchanged and validated; everything else is rebuilt to match current JavaScript ecosystem standards. Changes: - TypeScript wrapper in src/ with full type definitions - Dual CJS/ESM build via tsup (dist/index.cjs, dist/index.mjs) - Core algorithm moved from dist/spa.js to lib/spa.js (same code) - Input validation with descriptive TypeError/RangeError messages - formatTime() and SPA function code constants as named exports - getSpa() / calcSpa() accept null for optional args (tz, options) - Test suite: 61 ESM assertions and 17 CJS assertions - GitHub Actions CI: Node 20/22/24 matrix, typecheck, pack-check - GitHub Wiki: Home, API Reference, Architecture, Twilight, NREL SPA - NREL attribution in LICENSE and README per their license terms - package.json: exports map, files, engines >=20, sideEffects: false - Author corrected to Aric Camarata; repository.url uses git+https:// - LICENSE year corrected to 2023-2026 - Removed: index.js, test.js, dist/spa.js (superseded by above)
65 lines
3.5 KiB
Text
65 lines
3.5 KiB
Text
MIT License
|
|
|
|
Copyright (c) 2023-2026 Aric Camarata
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
SOFTWARE.
|
|
|
|
Third-Party Notice: NREL Solar Position Algorithm
|
|
--------------------------------------------------
|
|
|
|
The core algorithm in this package (lib/spa.js) is a JavaScript port of the
|
|
Solar Position Algorithm (SPA) developed at the National Renewable Energy
|
|
Laboratory (NREL) by Ibrahim Reda and Afshin Andreas. The original C source
|
|
files are subject to their own license terms, reproduced below:
|
|
|
|
Copyright (C) 2008-2011 Alliance for Sustainable Energy, LLC,
|
|
All Rights Reserved
|
|
|
|
The Solar Position Algorithm ("Software") is code in development prepared
|
|
by employees of the Alliance for Sustainable Energy, LLC, (hereinafter the
|
|
"Contractor"), under Contract No. DE-AC36-08GO28308 ("Contract") with the
|
|
U.S. Department of Energy (the "DOE"). The United States Government has
|
|
been granted for itself and others acting on its behalf a paid-up, non-
|
|
exclusive, irrevocable, worldwide license in the Software to reproduce,
|
|
prepare derivative works, and perform publicly and display publicly.
|
|
Beginning five (5) years after the date permission to assert copyright is
|
|
obtained from the DOE, and subject to any subsequent five (5) year
|
|
renewals, the United States Government is granted for itself and others
|
|
acting on its behalf a paid-up, non-exclusive, irrevocable, worldwide
|
|
license in the Software to reproduce, prepare derivative works, distribute
|
|
copies to the public, perform publicly and display publicly, and to permit
|
|
others to do so. If the Contractor ceases to make this computer software
|
|
available, it may be obtained from DOE's Office of Scientific and Technical
|
|
Information's Energy Science and Technology Software Center (ESTSC) at
|
|
P.O. Box 1020, Oak Ridge, TN 37831-1020.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE CONTRACTOR "AS IS" AND ANY EXPRESS OR
|
|
IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
IN NO EVENT SHALL THE CONTRACTOR OR THE U.S. GOVERNMENT BE LIABLE FOR ANY
|
|
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER,
|
|
INCLUDING BUT NOT LIMITED TO CLAIMS ASSOCIATED WITH THE LOSS OF DATA OR
|
|
PROFITS, WHICH MAY RESULT FROM AN ACTION IN CONTRACT, NEGLIGENCE OR OTHER
|
|
TORTIOUS CLAIM THAT ARISES OUT OF OR IN CONNECTION WITH THE ACCESS, USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
Reference: Reda, I., Andreas, A. (2004). "Solar Position Algorithm for
|
|
Solar Radiation Applications." Solar Energy, 76(5), 577-589.
|
|
|
|
Original source: https://midcdmz.nrel.gov/spa/
|