@spacexr/celestial-core 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +71 -0
- package/NOTICE +6 -0
- package/README.md +42 -2
- package/THIRD_PARTY_LICENSES/SunCalc-BSD-2-Clause.txt +21 -0
- package/dist/catalog.d.ts +235 -0
- package/dist/catalog.js +40 -0
- package/dist/catalog.js.map +1 -0
- package/dist/chunk-3XSMSDIY.js +69 -0
- package/dist/chunk-3XSMSDIY.js.map +1 -0
- package/dist/chunk-4EIA3YHD.js +263 -0
- package/dist/chunk-4EIA3YHD.js.map +1 -0
- package/dist/chunk-5JYMI22T.js +464 -0
- package/dist/chunk-5JYMI22T.js.map +1 -0
- package/dist/chunk-7MEJR6EV.js +299 -0
- package/dist/chunk-7MEJR6EV.js.map +1 -0
- package/dist/chunk-DDNSMFFG.js +227 -0
- package/dist/chunk-DDNSMFFG.js.map +1 -0
- package/dist/chunk-MWCQBFQK.js +52 -0
- package/dist/chunk-MWCQBFQK.js.map +1 -0
- package/dist/chunk-MZSDY5BK.js +1525 -0
- package/dist/chunk-MZSDY5BK.js.map +1 -0
- package/dist/chunk-ZQIZH7UO.js +487 -0
- package/dist/chunk-ZQIZH7UO.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +121 -0
- package/dist/index.js.map +1 -0
- package/dist/mechanics.d.ts +277 -0
- package/dist/mechanics.js +38 -0
- package/dist/mechanics.js.map +1 -0
- package/dist/observers.d.ts +334 -0
- package/dist/observers.js +21 -0
- package/dist/observers.js.map +1 -0
- package/dist/spectral-bands-HscYU-M9.d.ts +52 -0
- package/dist/star-BO3OPs70.d.ts +263 -0
- package/dist/stellar.d.ts +134 -0
- package/dist/stellar.js +39 -0
- package/dist/stellar.js.map +1 -0
- package/dist/time-BDUAgvaY.d.ts +27 -0
- package/dist/types-DV008H0a.d.ts +493 -0
- package/docs/GUIDE.md +76 -0
- package/docs/MODELS.md +253 -0
- package/examples/usage.ts +30 -0
- package/package.json +85 -5
- package/src/atmosphere.ts +480 -0
- package/src/blackbody.ts +82 -0
- package/src/body-atmospheres.ts +111 -0
- package/src/body-frame.ts +83 -0
- package/src/catalog.ts +8 -0
- package/src/earth-observer-api.ts +61 -0
- package/src/earth-observer.ts +555 -0
- package/src/ephemeris.ts +348 -0
- package/src/frozen-copy.ts +6 -0
- package/src/index.ts +4 -0
- package/src/kepler.ts +111 -0
- package/src/mechanics.ts +6 -0
- package/src/moon-places.ts +214 -0
- package/src/observers.ts +2 -0
- package/src/physical-constants.ts +34 -0
- package/src/quantity-bounds.ts +16 -0
- package/src/reference-ellipsoids.ts +12 -0
- package/src/rotation-model.ts +201 -0
- package/src/rotation-terms.ts +98 -0
- package/src/satellite-elements.ts +95 -0
- package/src/selenography.ts +31 -0
- package/src/solar-geometry.ts +17 -0
- package/src/solar-system.ts +979 -0
- package/src/spectral-bands.ts +73 -0
- package/src/spectral-class.ts +314 -0
- package/src/star-color.ts +316 -0
- package/src/star.ts +86 -0
- package/src/stellar-illumination.ts +154 -0
- package/src/stellar.ts +8 -0
- package/src/time.ts +45 -0
- package/src/types.ts +159 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Apache License 2.0 (Apache)
|
|
2
|
+
|
|
3
|
+
Apache License
|
|
4
|
+
Version 2.0, January 2004
|
|
5
|
+
<http://www.apache.org/licenses/>
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
## Definitions
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
16
|
+
|
|
17
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
18
|
+
|
|
19
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
20
|
+
|
|
21
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
22
|
+
|
|
23
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
24
|
+
|
|
25
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
26
|
+
|
|
27
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
28
|
+
|
|
29
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
30
|
+
|
|
31
|
+
## Grant of Copyright License
|
|
32
|
+
|
|
33
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
34
|
+
|
|
35
|
+
## Grant of Patent License
|
|
36
|
+
|
|
37
|
+
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
38
|
+
|
|
39
|
+
## Redistribution
|
|
40
|
+
|
|
41
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
42
|
+
|
|
43
|
+
1. You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
44
|
+
|
|
45
|
+
2. You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
46
|
+
|
|
47
|
+
3. You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
48
|
+
|
|
49
|
+
4. If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
|
50
|
+
|
|
51
|
+
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
52
|
+
|
|
53
|
+
## Submission of Contributions
|
|
54
|
+
|
|
55
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
56
|
+
|
|
57
|
+
## Trademarks
|
|
58
|
+
|
|
59
|
+
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
60
|
+
|
|
61
|
+
## Disclaimer of Warranty
|
|
62
|
+
|
|
63
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
64
|
+
|
|
65
|
+
## Limitation of Liability
|
|
66
|
+
|
|
67
|
+
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
68
|
+
|
|
69
|
+
## Accepting Warranty or Additional Liability
|
|
70
|
+
|
|
71
|
+
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Celestial Core, Guillaume Pelletier.
|
|
2
|
+
Derived from SpaceXR packages/dev/space, source commit bde5efeb33c8a861c820f3d33dd1f6d085831e10.
|
|
3
|
+
Source: https://github.com/pandaGaume/SpaceXR
|
|
4
|
+
The Earth observer calculations derive from SunCalc by Vladimir Agafonkin, under BSD-2-Clause.
|
|
5
|
+
Quantia (@spacexr/quantia) is a separate dependency, not copied, under the Apache License 2.0.
|
|
6
|
+
Original modules and provider implementations are preserved as noncompiled archive text.
|
package/README.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Celestial Core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The reference package for astronomical quantities and celestial bodies in TypeScript applications: catalogues, elliptic orbit geometry, approximate ephemerides, Earth observer calculations, star values, the light a star emits per wavelength band, and the atmosphere declared with each body.
|
|
4
|
+
|
|
5
|
+
## Role
|
|
6
|
+
|
|
7
|
+
The data of the Sun, the Earth, the Moon, Mars and the other bodies come from this package. It provides:
|
|
8
|
+
|
|
9
|
+
- each star by values (effective temperature, radius, luminosity), with the Sun filled in and linked to its catalogue entry;
|
|
10
|
+
- a list of wavelength bands whose number is adjustable, and the black-body irradiance of a star per band at a given distance;
|
|
11
|
+
- what a body receives at a date: the irradiance per band at its distance from the star, the direction of the star in the body-fixed frame, and the apparent radius of the star;
|
|
12
|
+
- the atmosphere declared with a body, as slices of altitude (base, top, gases and their proportions, base temperature and temperature gradient, particles), with the temperature, the pressure and the number of molecules per cubic metre at any altitude.
|
|
13
|
+
|
|
14
|
+
The package says what the air of a body is made of. It holds no optical coefficient: no scattering cross section and no refractive index. How that air acts on light is computed by the atmosphere package, from the data declared here. This package does not depend on the atmosphere package and stays independent of rendering engines: it exposes plain data and functions that an application, or the atmosphere package, can read. One model serves every body: the star, illumination and atmosphere code contains no constant of one body in an equation, and selects no body by its name.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
npm install @spacexr/celestial-core
|
|
19
|
+
|
|
20
|
+
Quantities come from the npm dependency @spacexr/quantia@0.1.1 and ellipsoids from @spacexr/geodesy@0.4.0, both pinned to an exact version.
|
|
21
|
+
|
|
22
|
+
## API
|
|
23
|
+
|
|
24
|
+
- /catalog: celestial descriptors, reference ellipsoids, rotation models, lunar places, and declared atmospheres with their vertical profile (`EarthStandardAtmosphere`, `MarsMeanAtmosphere`, `AirlessAtmosphere`, `AtmosphereProfile`).
|
|
25
|
+
- /mechanics: explicit-scale Julian dates, elliptic Kepler solver, geometric ephemerides (`computeBodiesEphemeris` returns the heliocentric position and the orientation of a list of bodies, sharing the work between them), solar geometry, the body-fixed frame and the illumination of a body by its star (`computeStellarIllumination`).
|
|
26
|
+
- /observers: Earth Sun/Moon directions and horizon events.
|
|
27
|
+
- /stellar: star values (`NominalSun`), wavelength bands (`createSpectralBands`), black-body emission (`blackbodyBandIrradiances`), physical constants, spectral classification, descriptive quantity bounds and empirical display colours.
|
|
28
|
+
|
|
29
|
+
See the [usage guide](docs/GUIDE.md) and [scientific models](docs/MODELS.md). Run npm run docs to generate docs/api/index.html. npm run docs:json emits the TypeDoc JSON model. Public declarations carry TSDoc/JSDoc comments, including units, mutation rules and failure cases.
|
|
30
|
+
|
|
31
|
+
## Coordinates and units
|
|
32
|
+
|
|
33
|
+
Ephemeris positions are metres in the heliocentric mean ecliptic/equinox J2000 frame. Spin axes are dimensionless unit vectors. primeMeridianRadians is a wrapped radian angle. bodyFixedAxes gives the whole orientation of a body as the three unit axes of its body-fixed frame, in the frame of the positions. Orbital elements carry an explicit distance unit, reference plane and reference centre. The orbits of the 19 moons other than the Moon come from the NASA JPL table of planetary satellite mean elements; each is counted from a reference plane given by its pole, and its node and periapsis turn at constant rates. `docs/MODELS.md` says what is taken from the NASA kernels instead, and lists the disagreements between the NASA sources. Public observers expose scalar names with Radians or Metres suffixes and Quantia getters for physical values.
|
|
34
|
+
|
|
35
|
+
Wavelengths are nanometres. Spectral irradiance is in watts per square metre per nanometre, sampled at the centre of each band. The direction of the star is a unit vector in the body-fixed frame: origin at the centre of the body, Z along the spin axis toward the pole of the rotation model, X in the equator through the prime meridian, Y at longitude 90 degrees east. For the Earth this is the Earth-centred, Earth-fixed frame. Atmosphere altitudes are metres above the reference ellipsoid; temperatures are kelvin, gradients kelvin per metre (positive when the air warms with altitude), pressures pascals and number densities molecules per cubic metre.
|
|
36
|
+
|
|
37
|
+
Date input to an ephemeris is labelled as a UTC approximation. A JulianDate input requires its time scale explicitly. No UTC/TDB conversion is inferred. The supported geometric model interval is 1800-2050 unless extrapolation is explicitly allowed.
|
|
38
|
+
|
|
39
|
+
## Development
|
|
40
|
+
|
|
41
|
+
Run npm ci, then npm run check: it formats, lints, checks types, runs tests, builds the package, executes examples and validates TypeDoc. npm run pack:check inspects package contents. Runtime dependencies are Quantia and geodesy; scientific reference tests run offline.
|
|
42
|
+
|
|
43
|
+
A tag `vX.Y.Z` that matches the version of package.json runs the release workflow: it runs the checks, publishes the version on npm with provenance when it is not published yet, and creates the GitHub release. Npm trusted publishing must be configured for the package and this workflow.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Copyright (c) 2014, Vladimir Agafonkin
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are
|
|
5
|
+
permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice, this list of
|
|
8
|
+
conditions and the following disclaimer.
|
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list
|
|
10
|
+
of conditions and the following disclaimer in the documentation and/or other materials
|
|
11
|
+
provided with the distribution.
|
|
12
|
+
|
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
14
|
+
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
15
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
16
|
+
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
17
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
18
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
19
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
20
|
+
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
21
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { C as CelestialCatalogue, I as IAtmosphereDescriptor } from './types-DV008H0a.js';
|
|
2
|
+
export { A as AtmosphereProfile, a as AtmosphereState, b as CelestialNodeType, c as IAtmosphereSlice, d as ICelestialBody, e as ICelestialBodyDescriptor, f as IGasComponent, g as IOrbitReferencePole, h as IOrbitalElements, i as IParticulateDeclaration, j as IRawCelestialBody, k as IRawOrbitalElements, l as IResolvedAtmosphereSlice, m as IRotationModelParameters, n as IRotationOrientation, o as IRotationPeriodicTerm, p as IVector3, R as RotationModel, q as atmosphereNumberDensityAt, r as atmospherePressureAt, s as atmosphereTemperatureAt, t as createAtmosphereDescriptor, u as meanMolarMass } from './types-DV008H0a.js';
|
|
3
|
+
import { Angle } from '@spacexr/quantia';
|
|
4
|
+
import { Ellipsoid } from '@spacexr/geodesy';
|
|
5
|
+
import './star-BO3OPs70.js';
|
|
6
|
+
|
|
7
|
+
/** Immutable catalogue of 31 bodies, with explicit Quantia quantities and orbital distance units. Earth-centre states use a mass-weighted lunar correction; Ceres and Vesta remain unresolved. The Sun carries star values; the Earth, Mars and the Moon carry a declared atmosphere. */
|
|
8
|
+
declare const SolarSystemBodies: CelestialCatalogue;
|
|
9
|
+
|
|
10
|
+
/** Immutable east-positive lunar latitude and longitude, stored in degrees. */
|
|
11
|
+
declare class SelenographicLocation {
|
|
12
|
+
/**
|
|
13
|
+
* Geographic latitude as an explicit Quantia Angle, north positive.
|
|
14
|
+
*/
|
|
15
|
+
readonly latitude: number;
|
|
16
|
+
/**
|
|
17
|
+
* Geographic longitude as an explicit Quantia Angle, east positive.
|
|
18
|
+
*/
|
|
19
|
+
readonly longitude: number;
|
|
20
|
+
/** Validate and store a lunar coordinate, with no Earth datum attached. */
|
|
21
|
+
constructor(
|
|
22
|
+
/**
|
|
23
|
+
* Geographic latitude as an explicit Quantia Angle, north positive.
|
|
24
|
+
*/
|
|
25
|
+
latitude: number,
|
|
26
|
+
/**
|
|
27
|
+
* Geographic longitude as an explicit Quantia Angle, east positive.
|
|
28
|
+
*/
|
|
29
|
+
longitude: number);
|
|
30
|
+
/** Latitude as a new Quantia angle in degrees. */ get latitudeAngle(): Angle;
|
|
31
|
+
/** East-positive longitude as a new Quantia angle in degrees. */ get longitudeAngle(): Angle;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Named lunar sites in selenographic degrees, north-positive latitude and east-positive longitude. These are catalogue coordinates, not an Earth datum.
|
|
36
|
+
*
|
|
37
|
+
* Sources, read on 5 December 2026:
|
|
38
|
+
* - Apollo sites: the Lunar Module positions of the NASA page "Apollo Landing Site Coordinates",
|
|
39
|
+
* https://nssdc.gsfc.nasa.gov/planetary/lunar/lunar_sites.html, planetocentric in the Mean Earth/Polar Axis
|
|
40
|
+
* frame of the DE421 ephemeris, measured on Lunar Reconnaissance Orbiter images.
|
|
41
|
+
* - Other names: the centre coordinates of the IAU Gazetteer of Planetary Nomenclature,
|
|
42
|
+
* https://planetarynames.wr.usgs.gov, kept by the U.S. Geological Survey. It is the official list of lunar
|
|
43
|
+
* names, but it is not published by a space agency. Some property names differ from the official names:
|
|
44
|
+
* MareSereniatis is Mare Serenitatis, VallisSnelius is Vallis Snellius, VallisAlpina is Vallis Alpes,
|
|
45
|
+
* MalabertCrater is the crater Malapert, ShackletonCrater is Shackleton and InaCaldera is Ina.
|
|
46
|
+
*
|
|
47
|
+
* Every place has a published source: AristarPlateau and GruithuisenDomes were removed, since no source gives
|
|
48
|
+
* their coordinates.
|
|
49
|
+
*/
|
|
50
|
+
declare class MoonKnownPlaces {
|
|
51
|
+
/**
|
|
52
|
+
* Named selenographic locations, expressed in degrees.
|
|
53
|
+
*/
|
|
54
|
+
static ApolloLandingSites: {
|
|
55
|
+
/** Apollo11 selenographic location; latitude and east-positive longitude are degrees. */
|
|
56
|
+
Apollo11: SelenographicLocation;
|
|
57
|
+
/** Apollo12 selenographic location; latitude and east-positive longitude are degrees. */
|
|
58
|
+
Apollo12: SelenographicLocation;
|
|
59
|
+
/** Apollo14 selenographic location; latitude and east-positive longitude are degrees. */
|
|
60
|
+
Apollo14: SelenographicLocation;
|
|
61
|
+
/** Apollo15 selenographic location; latitude and east-positive longitude are degrees. */
|
|
62
|
+
Apollo15: SelenographicLocation;
|
|
63
|
+
/** Apollo16 selenographic location; latitude and east-positive longitude are degrees. */
|
|
64
|
+
Apollo16: SelenographicLocation;
|
|
65
|
+
/** Apollo17 selenographic location; latitude and east-positive longitude are degrees. */
|
|
66
|
+
Apollo17: SelenographicLocation;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Named selenographic locations, expressed in degrees.
|
|
70
|
+
*/
|
|
71
|
+
static Craters: {
|
|
72
|
+
/** Tycho selenographic location; latitude and east-positive longitude are degrees. */
|
|
73
|
+
Tycho: SelenographicLocation;
|
|
74
|
+
/** Copernicus selenographic location; latitude and east-positive longitude are degrees. */
|
|
75
|
+
Copernicus: SelenographicLocation;
|
|
76
|
+
/** Aristarchus selenographic location; latitude and east-positive longitude are degrees. */
|
|
77
|
+
Aristarchus: SelenographicLocation;
|
|
78
|
+
/** Kepler selenographic location; latitude and east-positive longitude are degrees. */
|
|
79
|
+
Kepler: SelenographicLocation;
|
|
80
|
+
/** Plato selenographic location; latitude and east-positive longitude are degrees. */
|
|
81
|
+
Plato: SelenographicLocation;
|
|
82
|
+
/** Clavius selenographic location; latitude and east-positive longitude are degrees. */
|
|
83
|
+
Clavius: SelenographicLocation;
|
|
84
|
+
/** Grimaldi selenographic location; latitude and east-positive longitude are degrees. */
|
|
85
|
+
Grimaldi: SelenographicLocation;
|
|
86
|
+
/** Theophilus selenographic location; latitude and east-positive longitude are degrees. */
|
|
87
|
+
Theophilus: SelenographicLocation;
|
|
88
|
+
/** Eratosthenes selenographic location; latitude and east-positive longitude are degrees. */
|
|
89
|
+
Eratosthenes: SelenographicLocation;
|
|
90
|
+
/** Archimedes selenographic location; latitude and east-positive longitude are degrees. */
|
|
91
|
+
Archimedes: SelenographicLocation;
|
|
92
|
+
/** Ptolemaeus selenographic location; latitude and east-positive longitude are degrees. */
|
|
93
|
+
Ptolemaeus: SelenographicLocation;
|
|
94
|
+
/** Alphonsus selenographic location; latitude and east-positive longitude are degrees. */
|
|
95
|
+
Alphonsus: SelenographicLocation;
|
|
96
|
+
/** Arzachel selenographic location; latitude and east-positive longitude are degrees. */
|
|
97
|
+
Arzachel: SelenographicLocation;
|
|
98
|
+
/** Langrenus selenographic location; latitude and east-positive longitude are degrees. */
|
|
99
|
+
Langrenus: SelenographicLocation;
|
|
100
|
+
/** Petavius selenographic location; latitude and east-positive longitude are degrees. */
|
|
101
|
+
Petavius: SelenographicLocation;
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Named selenographic locations, expressed in degrees.
|
|
105
|
+
*/
|
|
106
|
+
static Maria: {
|
|
107
|
+
/** MareTranquillitatis selenographic location; latitude and east-positive longitude are degrees. */
|
|
108
|
+
MareTranquillitatis: SelenographicLocation;
|
|
109
|
+
/** MareSereniatis selenographic location; latitude and east-positive longitude are degrees. */
|
|
110
|
+
MareSereniatis: SelenographicLocation;
|
|
111
|
+
/** MareImbrium selenographic location; latitude and east-positive longitude are degrees. */
|
|
112
|
+
MareImbrium: SelenographicLocation;
|
|
113
|
+
/** MareCrisium selenographic location; latitude and east-positive longitude are degrees. */
|
|
114
|
+
MareCrisium: SelenographicLocation;
|
|
115
|
+
/** MareFecunditatis selenographic location; latitude and east-positive longitude are degrees. */
|
|
116
|
+
MareFecunditatis: SelenographicLocation;
|
|
117
|
+
/** MareNectaris selenographic location; latitude and east-positive longitude are degrees. */
|
|
118
|
+
MareNectaris: SelenographicLocation;
|
|
119
|
+
/** MareHumorum selenographic location; latitude and east-positive longitude are degrees. */
|
|
120
|
+
MareHumorum: SelenographicLocation;
|
|
121
|
+
/** MareNubium selenographic location; latitude and east-positive longitude are degrees. */
|
|
122
|
+
MareNubium: SelenographicLocation;
|
|
123
|
+
/** OceanusProcellarum selenographic location; latitude and east-positive longitude are degrees. */
|
|
124
|
+
OceanusProcellarum: SelenographicLocation;
|
|
125
|
+
/** MareFrigoris selenographic location; latitude and east-positive longitude are degrees. */
|
|
126
|
+
MareFrigoris: SelenographicLocation;
|
|
127
|
+
/** MareMarginis selenographic location; latitude and east-positive longitude are degrees. */
|
|
128
|
+
MareMarginis: SelenographicLocation;
|
|
129
|
+
/** MareVaporum selenographic location; latitude and east-positive longitude are degrees. */
|
|
130
|
+
MareVaporum: SelenographicLocation;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* Named selenographic locations, expressed in degrees.
|
|
134
|
+
*/
|
|
135
|
+
static Mountains: {
|
|
136
|
+
/** MontesApenninus selenographic location; latitude and east-positive longitude are degrees. */
|
|
137
|
+
MontesApenninus: SelenographicLocation;
|
|
138
|
+
/** MontesAlpes selenographic location; latitude and east-positive longitude are degrees. */
|
|
139
|
+
MontesAlpes: SelenographicLocation;
|
|
140
|
+
/** MontesCaucasus selenographic location; latitude and east-positive longitude are degrees. */
|
|
141
|
+
MontesCaucasus: SelenographicLocation;
|
|
142
|
+
/** MontesJura selenographic location; latitude and east-positive longitude are degrees. */
|
|
143
|
+
MontesJura: SelenographicLocation;
|
|
144
|
+
/** MontesCarpatus selenographic location; latitude and east-positive longitude are degrees. */
|
|
145
|
+
MontesCarpatus: SelenographicLocation;
|
|
146
|
+
/** MonsPiton selenographic location; latitude and east-positive longitude are degrees. */
|
|
147
|
+
MonsPiton: SelenographicLocation;
|
|
148
|
+
/** MonsHuygens selenographic location; latitude and east-positive longitude are degrees. */
|
|
149
|
+
MonsHuygens: SelenographicLocation;
|
|
150
|
+
/** MonsHadley selenographic location; latitude and east-positive longitude are degrees. */
|
|
151
|
+
MonsHadley: SelenographicLocation;
|
|
152
|
+
/** MonsBradley selenographic location; latitude and east-positive longitude are degrees. */
|
|
153
|
+
MonsBradley: SelenographicLocation;
|
|
154
|
+
/** MontesRook selenographic location; latitude and east-positive longitude are degrees. */
|
|
155
|
+
MontesRook: SelenographicLocation;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Public RillesAndValleys metadata for MoonKnownPlaces. See the class contract for unit conventions.
|
|
159
|
+
*/
|
|
160
|
+
static RillesAndValleys: {
|
|
161
|
+
/** RimaHadley selenographic location; latitude and east-positive longitude are degrees. */
|
|
162
|
+
RimaHadley: SelenographicLocation;
|
|
163
|
+
/** VallisSnelius selenographic location; latitude and east-positive longitude are degrees. */
|
|
164
|
+
VallisSnelius: SelenographicLocation;
|
|
165
|
+
/** VallisAlpina selenographic location; latitude and east-positive longitude are degrees. */
|
|
166
|
+
VallisAlpina: SelenographicLocation;
|
|
167
|
+
/** VallisSchroteri selenographic location; latitude and east-positive longitude are degrees. */
|
|
168
|
+
VallisSchroteri: SelenographicLocation;
|
|
169
|
+
/** RimaAriadaeus selenographic location; latitude and east-positive longitude are degrees. */
|
|
170
|
+
RimaAriadaeus: SelenographicLocation;
|
|
171
|
+
/** RimaHyginus selenographic location; latitude and east-positive longitude are degrees. */
|
|
172
|
+
RimaHyginus: SelenographicLocation;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Public ExplorationCandidates metadata for MoonKnownPlaces. See the class contract for unit conventions.
|
|
176
|
+
*/
|
|
177
|
+
static ExplorationCandidates: {
|
|
178
|
+
/** ShackletonCrater selenographic location; latitude and east-positive longitude are degrees. */
|
|
179
|
+
ShackletonCrater: SelenographicLocation;
|
|
180
|
+
/** MalabertCrater selenographic location; latitude and east-positive longitude are degrees. */
|
|
181
|
+
MalabertCrater: SelenographicLocation;
|
|
182
|
+
/** ReinerGamma selenographic location; latitude and east-positive longitude are degrees. */
|
|
183
|
+
ReinerGamma: SelenographicLocation;
|
|
184
|
+
/** InaCaldera selenographic location; latitude and east-positive longitude are degrees. */
|
|
185
|
+
InaCaldera: SelenographicLocation;
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Mars 2000 oblate reference ellipsoid: equatorial radius 3396190 m, polar radius 3376200 m.
|
|
191
|
+
*
|
|
192
|
+
* Source: BODY499_RADII = ( 3396.19 3396.19 3376.20 ) km in the NASA NAIF planetary constants kernel
|
|
193
|
+
* pck00010.tpc, https://naif.jpl.nasa.gov/pub/naif/generic_kernels/pck/pck00010.tpc, read on 5 December 2026.
|
|
194
|
+
* The kernel takes them from the 2009 report of the IAU Working Group on Cartographic Coordinates and
|
|
195
|
+
* Rotational Elements. That report gives a north polar radius of 3373.19 km and a south polar radius of
|
|
196
|
+
* 3379.21 km; the polar radius here is their average, as in the kernel.
|
|
197
|
+
*/
|
|
198
|
+
declare const Mars2000: Ellipsoid;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Atmosphere of the Earth: the seven slices of the U.S. Standard Atmosphere 1976, from the
|
|
202
|
+
* surface to 84 852 m, with 101 325 Pa at the base. The gases are dry air and are the same in
|
|
203
|
+
* every slice. Water vapour and ozone are left out: their proportion changes inside a slice,
|
|
204
|
+
* which this declaration cannot express yet. No particle is declared: no sourced amount is available.
|
|
205
|
+
*
|
|
206
|
+
* The standard gives its altitudes as geopotential altitudes. The profile of this package holds
|
|
207
|
+
* gravity constant, which treats altitude the same way, so the pressures of the standard are
|
|
208
|
+
* reproduced at these altitudes. Read as heights above the ellipsoid, they are shifted by about
|
|
209
|
+
* h^2 / R: 19 m at 11 km and 1.1 km at the top.
|
|
210
|
+
*/
|
|
211
|
+
declare const EarthStandardAtmosphere: IAtmosphereDescriptor;
|
|
212
|
+
/**
|
|
213
|
+
* Atmosphere of Mars: one isothermal slice that starts at the reference ellipsoid and has no
|
|
214
|
+
* declared top. Its values are those of the NASA Mars Fact Sheet updated on 19 May 2025, read on
|
|
215
|
+
* 5 December 2026:
|
|
216
|
+
* - gases by volume: CO2 95.1%, N2 2.59%, Ar 1.94%, O2 0.16% and H2O 210 ppm. Carbon monoxide
|
|
217
|
+
* (0.06%) and the other minor gases are left out: the molar mass table above does not carry them.
|
|
218
|
+
* With these gases the mean molar mass is 43.49 g/mol, the mean molecular weight of the fact sheet;
|
|
219
|
+
* - 636 Pa at the base: 6.36 mb at the mean radius;
|
|
220
|
+
* - 214 K: the average temperature of about 214 K.
|
|
221
|
+
* The atmosphere package and the spikypanda catalogue used 210 K and older proportions
|
|
222
|
+
* (CO2 0.9532, N2 0.027, Ar 0.0163, O2 0.0013, H2O 0.0003), which these values replace.
|
|
223
|
+
* No temperature gradient is declared: no sourced vertical profile has been selected for Mars.
|
|
224
|
+
* No particle is declared: the dust values of the atmosphere package are assumptions and its
|
|
225
|
+
* dust amount is an optical depth, which is an optical quantity and stays there.
|
|
226
|
+
* NASA Mars Fact Sheet: https://nssdc.gsfc.nasa.gov/planetary/factsheet/marsfact.html
|
|
227
|
+
*/
|
|
228
|
+
declare const MarsMeanAtmosphere: IAtmosphereDescriptor;
|
|
229
|
+
/**
|
|
230
|
+
* A body declared without air: no slice and a zero base pressure. It is used for the Moon,
|
|
231
|
+
* whose extremely thin exosphere is neglected by decision of the project (4 December 2026).
|
|
232
|
+
*/
|
|
233
|
+
declare const AirlessAtmosphere: IAtmosphereDescriptor;
|
|
234
|
+
|
|
235
|
+
export { AirlessAtmosphere, CelestialCatalogue, EarthStandardAtmosphere, IAtmosphereDescriptor, Mars2000, MarsMeanAtmosphere, MoonKnownPlaces, SelenographicLocation, SolarSystemBodies };
|
package/dist/catalog.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MoonKnownPlaces,
|
|
3
|
+
SelenographicLocation
|
|
4
|
+
} from "./chunk-DDNSMFFG.js";
|
|
5
|
+
import {
|
|
6
|
+
AirlessAtmosphere,
|
|
7
|
+
AtmosphereProfile,
|
|
8
|
+
AtmosphereState,
|
|
9
|
+
CelestialNodeType,
|
|
10
|
+
EarthStandardAtmosphere,
|
|
11
|
+
Mars2000,
|
|
12
|
+
MarsMeanAtmosphere,
|
|
13
|
+
RotationModel,
|
|
14
|
+
SolarSystemBodies,
|
|
15
|
+
atmosphereNumberDensityAt,
|
|
16
|
+
atmospherePressureAt,
|
|
17
|
+
atmosphereTemperatureAt,
|
|
18
|
+
createAtmosphereDescriptor,
|
|
19
|
+
meanMolarMass
|
|
20
|
+
} from "./chunk-MZSDY5BK.js";
|
|
21
|
+
import "./chunk-7MEJR6EV.js";
|
|
22
|
+
export {
|
|
23
|
+
AirlessAtmosphere,
|
|
24
|
+
AtmosphereProfile,
|
|
25
|
+
AtmosphereState,
|
|
26
|
+
CelestialNodeType,
|
|
27
|
+
EarthStandardAtmosphere,
|
|
28
|
+
Mars2000,
|
|
29
|
+
MarsMeanAtmosphere,
|
|
30
|
+
MoonKnownPlaces,
|
|
31
|
+
RotationModel,
|
|
32
|
+
SelenographicLocation,
|
|
33
|
+
SolarSystemBodies,
|
|
34
|
+
atmosphereNumberDensityAt,
|
|
35
|
+
atmospherePressureAt,
|
|
36
|
+
atmosphereTemperatureAt,
|
|
37
|
+
createAtmosphereDescriptor,
|
|
38
|
+
meanMolarMass
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PhysicalConstants
|
|
3
|
+
} from "./chunk-7MEJR6EV.js";
|
|
4
|
+
|
|
5
|
+
// src/blackbody.ts
|
|
6
|
+
import { Length, Temperature } from "@spacexr/quantia";
|
|
7
|
+
function planckPerMetre(lambda, kelvin) {
|
|
8
|
+
const { planck, speedOfLight, boltzmann } = PhysicalConstants;
|
|
9
|
+
const denominator = Math.expm1(planck * speedOfLight / (lambda * boltzmann * kelvin));
|
|
10
|
+
if (denominator === Infinity) return 0;
|
|
11
|
+
return 2 * planck * speedOfLight ** 2 / lambda ** 5 / denominator;
|
|
12
|
+
}
|
|
13
|
+
function positive(value, label) {
|
|
14
|
+
if (!(value > 0 && Number.isFinite(value))) throw new RangeError(label + " must be positive and finite");
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
function planckSpectralRadiance(wavelength, temperature) {
|
|
18
|
+
return planckPerMetre(
|
|
19
|
+
positive(wavelength.getValue(Length.Units.m), "Wavelength"),
|
|
20
|
+
positive(temperature.getValue(Temperature.Units.k), "Temperature")
|
|
21
|
+
) * 1e-9;
|
|
22
|
+
}
|
|
23
|
+
function dilution(radius, distance) {
|
|
24
|
+
const r = positive(radius.getValue(Length.Units.m), "Star radius"), d = positive(distance.getValue(Length.Units.m), "Distance");
|
|
25
|
+
if (d <= r) throw new RangeError("Observer must be outside the star");
|
|
26
|
+
return Math.PI * (r / d) ** 2;
|
|
27
|
+
}
|
|
28
|
+
function blackbodySpectralIrradiance(wavelength, temperature, radius, distance) {
|
|
29
|
+
return planckSpectralRadiance(wavelength, temperature) * dilution(radius, distance);
|
|
30
|
+
}
|
|
31
|
+
function blackbodyBandIrradiances(bands, temperature, radius, distance) {
|
|
32
|
+
const kelvin = positive(temperature.getValue(Temperature.Units.k), "Temperature"), factor = dilution(radius, distance) * 1e-9;
|
|
33
|
+
return bands.map((band) => planckPerMetre(positive(band.centreNm, "Band centre") * 1e-9, kelvin) * factor);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/spectral-bands.ts
|
|
37
|
+
import { Length as Length2 } from "@spacexr/quantia";
|
|
38
|
+
var DefaultSpectralBandCount = 24;
|
|
39
|
+
var DefaultSpectralRangeNm = Object.freeze({ lower: 380, upper: 780 });
|
|
40
|
+
function createSpectralBands(options = {}) {
|
|
41
|
+
const count = options.count ?? DefaultSpectralBandCount;
|
|
42
|
+
const lower = options.lower ? options.lower.getValue(Length2.Units.nm) : DefaultSpectralRangeNm.lower;
|
|
43
|
+
const upper = options.upper ? options.upper.getValue(Length2.Units.nm) : DefaultSpectralRangeNm.upper;
|
|
44
|
+
if (!Number.isInteger(count) || count < 1) throw new RangeError("Band count must be a positive integer");
|
|
45
|
+
if (!(lower > 0 && upper > lower)) throw new RangeError("Band interval must be positive and increasing");
|
|
46
|
+
const step = (upper - lower) / count;
|
|
47
|
+
return Object.freeze(
|
|
48
|
+
Array.from(
|
|
49
|
+
{ length: count },
|
|
50
|
+
(_, index) => Object.freeze({
|
|
51
|
+
index,
|
|
52
|
+
lowerNm: lower + index * step,
|
|
53
|
+
upperNm: index === count - 1 ? upper : lower + (index + 1) * step,
|
|
54
|
+
centreNm: lower + (index + 0.5) * step,
|
|
55
|
+
widthNm: step
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
planckSpectralRadiance,
|
|
63
|
+
blackbodySpectralIrradiance,
|
|
64
|
+
blackbodyBandIrradiances,
|
|
65
|
+
DefaultSpectralBandCount,
|
|
66
|
+
DefaultSpectralRangeNm,
|
|
67
|
+
createSpectralBands
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=chunk-3XSMSDIY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/blackbody.ts","../src/spectral-bands.ts"],"sourcesContent":["import { Length, Temperature } from \"@spacexr/quantia\";\nimport { PhysicalConstants } from \"./physical-constants\";\nimport type { ISpectralBand } from \"./spectral-bands\";\n\n/** Planck law for a wavelength in metres and a temperature in kelvin; W per m^2 per sr per metre of wavelength. */\nfunction planckPerMetre(lambda: number, kelvin: number): number {\n const { planck, speedOfLight, boltzmann } = PhysicalConstants;\n const denominator = Math.expm1((planck * speedOfLight) / (lambda * boltzmann * kelvin));\n // The exponential overflows far on the short-wavelength side, where the radiance tends to zero.\n if (denominator === Infinity) return 0;\n return (2 * planck * speedOfLight ** 2) / lambda ** 5 / denominator;\n}\n\nfunction positive(value: number, label: string): number {\n if (!(value > 0 && Number.isFinite(value))) throw new RangeError(label + \" must be positive and finite\");\n return value;\n}\n\n/**\n * Spectral radiance of a black body (Planck law):\n * B(lambda, T) = 2 h c^2 / lambda^5 / (exp(h c / (lambda k_B T)) - 1).\n * @param wavelength - Wavelength in vacuum, strictly positive.\n * @param temperature - Temperature of the black body, strictly positive.\n * @returns Radiance in watts per square metre, per steradian, per nanometre of wavelength.\n * @throws RangeError when an input is not positive.\n */\nexport function planckSpectralRadiance(wavelength: Length, temperature: Temperature): number {\n return (\n planckPerMetre(\n positive(wavelength.getValue(Length.Units.m), \"Wavelength\"),\n positive(temperature.getValue(Temperature.Units.k), \"Temperature\"),\n ) * 1e-9\n );\n}\n\nfunction dilution(radius: Length, distance: Length): number {\n const r = positive(radius.getValue(Length.Units.m), \"Star radius\"),\n d = positive(distance.getValue(Length.Units.m), \"Distance\");\n if (d <= r) throw new RangeError(\"Observer must be outside the star\");\n return Math.PI * (r / d) ** 2;\n}\n\n/**\n * Spectral irradiance received from a spherical black-body star, on a surface that faces it:\n * E(lambda) = pi * B(lambda, T) * (R / D)^2.\n * The star is a uniform disc, without limb darkening or spectral lines. Nothing is absorbed on the way.\n * @param wavelength - Wavelength in vacuum.\n * @param temperature - Effective temperature of the star.\n * @param radius - Radius of the star.\n * @param distance - Distance from the centre of the star, larger than its radius.\n * @returns Irradiance in watts per square metre, per nanometre of wavelength.\n * @throws RangeError when an input is not positive or the observer is inside the star.\n */\nexport function blackbodySpectralIrradiance(\n wavelength: Length,\n temperature: Temperature,\n radius: Length,\n distance: Length,\n): number {\n return planckSpectralRadiance(wavelength, temperature) * dilution(radius, distance);\n}\n\n/**\n * The same irradiance for a list of bands, each sampled at its centre.\n * Multiply a value by the band widthNm to approximate the power of the band in watts per square metre.\n * @param bands - Bands from createSpectralBands, or any list with centres in nanometres.\n * @param temperature - Effective temperature of the star.\n * @param radius - Radius of the star.\n * @param distance - Distance from the centre of the star, larger than its radius.\n * @returns A new array, one value per band and in the same order, in watts per square metre per nanometre.\n * @throws RangeError when an input is not positive or the observer is inside the star.\n */\nexport function blackbodyBandIrradiances(\n bands: readonly ISpectralBand[],\n temperature: Temperature,\n radius: Length,\n distance: Length,\n): number[] {\n const kelvin = positive(temperature.getValue(Temperature.Units.k), \"Temperature\"),\n factor = dilution(radius, distance) * 1e-9;\n return bands.map((band) => planckPerMetre(positive(band.centreNm, \"Band centre\") * 1e-9, kelvin) * factor);\n}\n","import { Length } from \"@spacexr/quantia\";\n\n/**\n * One wavelength band. All values are nanometres. A band is sampled at its centre:\n * a spectral quantity \"per band\" is its value at centreNm.\n */\nexport interface ISpectralBand {\n /** Zero-based position in the list, counted from the shortest wavelength. */\n readonly index: number;\n /** Lower edge of the band, nanometres. */\n readonly lowerNm: number;\n /** Upper edge of the band, nanometres. */\n readonly upperNm: number;\n /** Midpoint of the band, nanometres. This is the sampling wavelength. */\n readonly centreNm: number;\n /** Width of the band, nanometres. */\n readonly widthNm: number;\n}\n\n/** Controls of the band list. Every field is optional. */\nexport interface ISpectralBandOptions {\n /** Number of bands, a positive integer. Defaults to DefaultSpectralBandCount. */\n count?: number;\n /** Lower edge of the first band. Defaults to DefaultSpectralRangeNm.lower, in nanometres. */\n lower?: Length;\n /** Upper edge of the last band. Defaults to DefaultSpectralRangeNm.upper, in nanometres. */\n upper?: Length;\n}\n\n/** Edges of a wavelength interval, nanometres. */\nexport interface ISpectralRangeNm {\n /** Lower edge, nanometres. */\n readonly lower: number;\n /** Upper edge, nanometres. */\n readonly upper: number;\n}\n\n/**\n * Default number of bands. It is the default of the atmosphere package (24, with 48 as its\n * finer setting), kept so that the star and the atmosphere use the same bands.\n */\nexport const DefaultSpectralBandCount = 24;\n\n/** Default interval, 380 to 780 nm: the visible range sampled by the atmosphere package. */\nexport const DefaultSpectralRangeNm: ISpectralRangeNm = Object.freeze({ lower: 380, upper: 780 });\n\n/**\n * Build equal-width bands over a wavelength interval, each sampled at its midpoint:\n * centre_i = lower + (i + 0.5) * (upper - lower) / count.\n * The count is free, so a result can be checked by doubling the number of bands.\n * @param options - Count and interval; defaults are 24 bands over 380 to 780 nm.\n * @returns A frozen list of frozen bands, ordered by increasing wavelength.\n * @throws RangeError when the count is not a positive integer or the interval is not positive and increasing.\n */\nexport function createSpectralBands(options: ISpectralBandOptions = {}): readonly ISpectralBand[] {\n const count = options.count ?? DefaultSpectralBandCount;\n const lower = options.lower ? options.lower.getValue(Length.Units.nm) : DefaultSpectralRangeNm.lower;\n const upper = options.upper ? options.upper.getValue(Length.Units.nm) : DefaultSpectralRangeNm.upper;\n if (!Number.isInteger(count) || count < 1) throw new RangeError(\"Band count must be a positive integer\");\n if (!(lower > 0 && upper > lower)) throw new RangeError(\"Band interval must be positive and increasing\");\n const step = (upper - lower) / count;\n return Object.freeze(\n Array.from({ length: count }, (_, index) =>\n Object.freeze({\n index,\n lowerNm: lower + index * step,\n upperNm: index === count - 1 ? upper : lower + (index + 1) * step,\n centreNm: lower + (index + 0.5) * step,\n widthNm: step,\n }),\n ),\n );\n}\n"],"mappings":";;;;;AAAA,SAAS,QAAQ,mBAAmB;AAKpC,SAAS,eAAe,QAAgB,QAAwB;AAC5D,QAAM,EAAE,QAAQ,cAAc,UAAU,IAAI;AAC5C,QAAM,cAAc,KAAK,MAAO,SAAS,gBAAiB,SAAS,YAAY,OAAO;AAEtF,MAAI,gBAAgB,SAAU,QAAO;AACrC,SAAQ,IAAI,SAAS,gBAAgB,IAAK,UAAU,IAAI;AAC5D;AAEA,SAAS,SAAS,OAAe,OAAuB;AACpD,MAAI,EAAE,QAAQ,KAAK,OAAO,SAAS,KAAK,GAAI,OAAM,IAAI,WAAW,QAAQ,8BAA8B;AACvG,SAAO;AACX;AAUO,SAAS,uBAAuB,YAAoB,aAAkC;AACzF,SACI;AAAA,IACI,SAAS,WAAW,SAAS,OAAO,MAAM,CAAC,GAAG,YAAY;AAAA,IAC1D,SAAS,YAAY,SAAS,YAAY,MAAM,CAAC,GAAG,aAAa;AAAA,EACrE,IAAI;AAEZ;AAEA,SAAS,SAAS,QAAgB,UAA0B;AACxD,QAAM,IAAI,SAAS,OAAO,SAAS,OAAO,MAAM,CAAC,GAAG,aAAa,GAC7D,IAAI,SAAS,SAAS,SAAS,OAAO,MAAM,CAAC,GAAG,UAAU;AAC9D,MAAI,KAAK,EAAG,OAAM,IAAI,WAAW,mCAAmC;AACpE,SAAO,KAAK,MAAM,IAAI,MAAM;AAChC;AAaO,SAAS,4BACZ,YACA,aACA,QACA,UACM;AACN,SAAO,uBAAuB,YAAY,WAAW,IAAI,SAAS,QAAQ,QAAQ;AACtF;AAYO,SAAS,yBACZ,OACA,aACA,QACA,UACQ;AACR,QAAM,SAAS,SAAS,YAAY,SAAS,YAAY,MAAM,CAAC,GAAG,aAAa,GAC5E,SAAS,SAAS,QAAQ,QAAQ,IAAI;AAC1C,SAAO,MAAM,IAAI,CAAC,SAAS,eAAe,SAAS,KAAK,UAAU,aAAa,IAAI,MAAM,MAAM,IAAI,MAAM;AAC7G;;;ACjFA,SAAS,UAAAA,eAAc;AAyChB,IAAM,2BAA2B;AAGjC,IAAM,yBAA2C,OAAO,OAAO,EAAE,OAAO,KAAK,OAAO,IAAI,CAAC;AAUzF,SAAS,oBAAoB,UAAgC,CAAC,GAA6B;AAC9F,QAAM,QAAQ,QAAQ,SAAS;AAC/B,QAAM,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,SAASA,QAAO,MAAM,EAAE,IAAI,uBAAuB;AAC/F,QAAM,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,SAASA,QAAO,MAAM,EAAE,IAAI,uBAAuB;AAC/F,MAAI,CAAC,OAAO,UAAU,KAAK,KAAK,QAAQ,EAAG,OAAM,IAAI,WAAW,uCAAuC;AACvG,MAAI,EAAE,QAAQ,KAAK,QAAQ,OAAQ,OAAM,IAAI,WAAW,+CAA+C;AACvG,QAAM,QAAQ,QAAQ,SAAS;AAC/B,SAAO,OAAO;AAAA,IACV,MAAM;AAAA,MAAK,EAAE,QAAQ,MAAM;AAAA,MAAG,CAAC,GAAG,UAC9B,OAAO,OAAO;AAAA,QACV;AAAA,QACA,SAAS,QAAQ,QAAQ;AAAA,QACzB,SAAS,UAAU,QAAQ,IAAI,QAAQ,SAAS,QAAQ,KAAK;AAAA,QAC7D,UAAU,SAAS,QAAQ,OAAO;AAAA,QAClC,SAAS;AAAA,MACb,CAAC;AAAA,IACL;AAAA,EACJ;AACJ;","names":["Length"]}
|