@hebcal/noaa 0.8.6 → 0.8.8
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/README.md +1 -1
- package/dist/{cjs/index.js → index.cjs} +1 -19
- package/dist/index.d.ts +17 -2
- package/dist/{esm/index.js → index.js} +76 -58
- package/package.json +16 -11
package/README.md
CHANGED
|
@@ -66,7 +66,7 @@ GeoLocation constructor with parameters for all required fields.
|
|
|
66
66
|
| --- | --- | --- |
|
|
67
67
|
| name | <code>string</code> | The location name for display use such as "Lakewood, NJ" |
|
|
68
68
|
| latitude | <code>number</code> | the latitude in a double format such as 40.095965 for Lakewood, NJ. <b>Note: </b> For latitudes south of the equator, a negative value should be used. |
|
|
69
|
-
| longitude | <code>number</code> | double the longitude in a double format such as -74.222130 for Lakewood, NJ. <b>Note: </b> For longitudes
|
|
69
|
+
| longitude | <code>number</code> | double the longitude in a double format such as -74.222130 for Lakewood, NJ. <b>Note: </b> For longitudes west of the <a href="http://en.wikipedia.org/wiki/Prime_Meridian">Prime Meridian </a> (Greenwich), a negative value should be used. |
|
|
70
70
|
| elevation | <code>number</code> | the elevation above sea level in Meters. Elevation is not used in most algorithms used for calculating sunrise and set. |
|
|
71
71
|
| timeZoneId | <code>string</code> | the <code>TimeZone</code> for the location. |
|
|
72
72
|
|
|
@@ -29,24 +29,6 @@ const Long_MIN_VALUE = NaN;
|
|
|
29
29
|
* @version 1.1
|
|
30
30
|
*/
|
|
31
31
|
class GeoLocation {
|
|
32
|
-
/**
|
|
33
|
-
* GeoLocation constructor with parameters for all required fields.
|
|
34
|
-
*
|
|
35
|
-
* @param {string} name
|
|
36
|
-
* The location name for display use such as "Lakewood, NJ"
|
|
37
|
-
* @param {number} latitude
|
|
38
|
-
* the latitude in a double format such as 40.095965 for Lakewood, NJ.
|
|
39
|
-
* <b>Note: </b> For latitudes south of the equator, a negative value should be used.
|
|
40
|
-
* @param {number} longitude
|
|
41
|
-
* double the longitude in a double format such as -74.222130 for Lakewood, NJ.
|
|
42
|
-
* <b>Note: </b> For longitudes east of the <a href="http://en.wikipedia.org/wiki/Prime_Meridian">Prime
|
|
43
|
-
* Meridian </a> (Greenwich), a negative value should be used.
|
|
44
|
-
* @param {number} elevation
|
|
45
|
-
* the elevation above sea level in Meters. Elevation is not used in most algorithms used for calculating
|
|
46
|
-
* sunrise and set.
|
|
47
|
-
* @param {string} timeZoneId
|
|
48
|
-
* the <code>TimeZone</code> for the location.
|
|
49
|
-
*/
|
|
50
32
|
constructor(name, latitude, longitude, elevationOrTimeZoneId, timeZoneId) {
|
|
51
33
|
/**
|
|
52
34
|
* @private
|
|
@@ -139,7 +121,7 @@ class GeoLocation {
|
|
|
139
121
|
* AstronomicalCalendar to output times in the expected offset. This situation will arise if the
|
|
140
122
|
* AstronomicalCalendar is ever {@link AstronomicalCalendar#clone() cloned}.
|
|
141
123
|
*
|
|
142
|
-
* @param {string}
|
|
124
|
+
* @param {string} timeZoneId
|
|
143
125
|
* The timeZone to set.
|
|
144
126
|
*/
|
|
145
127
|
setTimeZone(timeZoneId) {
|
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare class GeoLocation {
|
|
|
19
19
|
* <b>Note: </b> For latitudes south of the equator, a negative value should be used.
|
|
20
20
|
* @param {number} longitude
|
|
21
21
|
* double the longitude in a double format such as -74.222130 for Lakewood, NJ.
|
|
22
|
-
* <b>Note: </b> For longitudes
|
|
22
|
+
* <b>Note: </b> For longitudes west of the <a href="http://en.wikipedia.org/wiki/Prime_Meridian">Prime
|
|
23
23
|
* Meridian </a> (Greenwich), a negative value should be used.
|
|
24
24
|
* @param {number} elevation
|
|
25
25
|
* the elevation above sea level in Meters. Elevation is not used in most algorithms used for calculating
|
|
@@ -28,6 +28,21 @@ export declare class GeoLocation {
|
|
|
28
28
|
* the <code>TimeZone</code> for the location.
|
|
29
29
|
*/
|
|
30
30
|
constructor(name: string | null, latitude: number, longitude: number, elevation: number, timeZoneId?: string);
|
|
31
|
+
/**
|
|
32
|
+
* GeoLocation constructor with parameters for all required fields.
|
|
33
|
+
*
|
|
34
|
+
* @param {string} name
|
|
35
|
+
* The location name for display use such as "Lakewood, NJ"
|
|
36
|
+
* @param {number} latitude
|
|
37
|
+
* the latitude in a double format such as 40.095965 for Lakewood, NJ.
|
|
38
|
+
* <b>Note: </b> For latitudes south of the equator, a negative value should be used.
|
|
39
|
+
* @param {number} longitude
|
|
40
|
+
* double the longitude in a double format such as -74.222130 for Lakewood, NJ.
|
|
41
|
+
* <b>Note: </b> For longitudes west of the <a href="http://en.wikipedia.org/wiki/Prime_Meridian">Prime
|
|
42
|
+
* Meridian </a> (Greenwich), a negative value should be used.
|
|
43
|
+
* @param {string} timeZoneId
|
|
44
|
+
* the <code>TimeZone</code> for the location.
|
|
45
|
+
*/
|
|
31
46
|
constructor(name: string | null, latitude: number, longitude: number, timeZoneId: string);
|
|
32
47
|
/**
|
|
33
48
|
* @private
|
|
@@ -105,7 +120,7 @@ export declare class GeoLocation {
|
|
|
105
120
|
* AstronomicalCalendar to output times in the expected offset. This situation will arise if the
|
|
106
121
|
* AstronomicalCalendar is ever {@link AstronomicalCalendar#clone() cloned}.
|
|
107
122
|
*
|
|
108
|
-
* @param {string}
|
|
123
|
+
* @param {string} timeZoneId
|
|
109
124
|
* The timeZone to set.
|
|
110
125
|
*/
|
|
111
126
|
setTimeZone(timeZoneId: string): void;
|
|
@@ -26,31 +26,7 @@ const Long_MIN_VALUE = NaN;
|
|
|
26
26
|
* @version 1.1
|
|
27
27
|
*/
|
|
28
28
|
export class GeoLocation {
|
|
29
|
-
/**
|
|
30
|
-
* GeoLocation constructor with parameters for all required fields.
|
|
31
|
-
*
|
|
32
|
-
* @param {string} name
|
|
33
|
-
* The location name for display use such as "Lakewood, NJ"
|
|
34
|
-
* @param {number} latitude
|
|
35
|
-
* the latitude in a double format such as 40.095965 for Lakewood, NJ.
|
|
36
|
-
* <b>Note: </b> For latitudes south of the equator, a negative value should be used.
|
|
37
|
-
* @param {number} longitude
|
|
38
|
-
* double the longitude in a double format such as -74.222130 for Lakewood, NJ.
|
|
39
|
-
* <b>Note: </b> For longitudes east of the <a href="http://en.wikipedia.org/wiki/Prime_Meridian">Prime
|
|
40
|
-
* Meridian </a> (Greenwich), a negative value should be used.
|
|
41
|
-
* @param {number} elevation
|
|
42
|
-
* the elevation above sea level in Meters. Elevation is not used in most algorithms used for calculating
|
|
43
|
-
* sunrise and set.
|
|
44
|
-
* @param {string} timeZoneId
|
|
45
|
-
* the <code>TimeZone</code> for the location.
|
|
46
|
-
*/
|
|
47
29
|
constructor(name, latitude, longitude, elevationOrTimeZoneId, timeZoneId) {
|
|
48
|
-
/**
|
|
49
|
-
* @private
|
|
50
|
-
* @see #getLocationName()
|
|
51
|
-
* @see #setLocationName(String)
|
|
52
|
-
*/
|
|
53
|
-
this.locationName = null;
|
|
54
30
|
let elevation = 0;
|
|
55
31
|
if (timeZoneId) {
|
|
56
32
|
elevation = elevationOrTimeZoneId;
|
|
@@ -64,6 +40,38 @@ export class GeoLocation {
|
|
|
64
40
|
this.setElevation(elevation);
|
|
65
41
|
this.setTimeZone(timeZoneId);
|
|
66
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* @private
|
|
45
|
+
* @see #getLatitude()
|
|
46
|
+
* @see #setLatitude(double)
|
|
47
|
+
* @see #setLatitude(int, int, double, String)
|
|
48
|
+
*/
|
|
49
|
+
latitude;
|
|
50
|
+
/**
|
|
51
|
+
* @private
|
|
52
|
+
* @see #getLongitude()
|
|
53
|
+
* @see #setLongitude(double)
|
|
54
|
+
* @see #setLongitude(int, int, double, String)
|
|
55
|
+
*/
|
|
56
|
+
longitude;
|
|
57
|
+
/**
|
|
58
|
+
* @private
|
|
59
|
+
* @see #getLocationName()
|
|
60
|
+
* @see #setLocationName(String)
|
|
61
|
+
*/
|
|
62
|
+
locationName = null;
|
|
63
|
+
/**
|
|
64
|
+
* @private
|
|
65
|
+
* @see #getTimeZone()
|
|
66
|
+
* @see #setTimeZone(TimeZone)
|
|
67
|
+
*/
|
|
68
|
+
timeZoneId;
|
|
69
|
+
/**
|
|
70
|
+
* @private
|
|
71
|
+
* @see #getElevation()
|
|
72
|
+
* @see #setElevation(double)
|
|
73
|
+
*/
|
|
74
|
+
elevation;
|
|
67
75
|
/**
|
|
68
76
|
* Method to get the elevation in Meters.
|
|
69
77
|
*
|
|
@@ -136,7 +144,7 @@ export class GeoLocation {
|
|
|
136
144
|
* AstronomicalCalendar to output times in the expected offset. This situation will arise if the
|
|
137
145
|
* AstronomicalCalendar is ever {@link AstronomicalCalendar#clone() cloned}.
|
|
138
146
|
*
|
|
139
|
-
* @param {string}
|
|
147
|
+
* @param {string} timeZoneId
|
|
140
148
|
* The timeZone to set.
|
|
141
149
|
*/
|
|
142
150
|
setTimeZone(timeZoneId) {
|
|
@@ -190,6 +198,39 @@ export class NOAACalculator {
|
|
|
190
198
|
this.date = date;
|
|
191
199
|
this.geoLocation = geoLocation;
|
|
192
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* The zenith of astronomical sunrise and sunset. The sun is 90° from the vertical 0°
|
|
203
|
+
* @private
|
|
204
|
+
*/
|
|
205
|
+
static GEOMETRIC_ZENITH = 90;
|
|
206
|
+
/**
|
|
207
|
+
* Default value for Sun's zenith and true rise/set Zenith (used in this class and subclasses) is the angle that the
|
|
208
|
+
* center of the Sun makes to a line perpendicular to the Earth's surface. If the Sun were a point and the Earth
|
|
209
|
+
* were without an atmosphere, true sunset and sunrise would correspond to a 90° zenith. Because the Sun is not
|
|
210
|
+
* a point, and because the atmosphere refracts light, this 90° zenith does not, in fact, correspond to true
|
|
211
|
+
* sunset or sunrise, instead the center of the Sun's disk must lie just below the horizon for the upper edge to be
|
|
212
|
+
* obscured. This means that a zenith of just above 90° must be used. The Sun subtends an angle of 16 minutes of
|
|
213
|
+
* arc (this can be changed via the {@link #setSunRadius(double)} method , and atmospheric refraction accounts for
|
|
214
|
+
* 34 minutes or so (this can be changed via the {@link #setRefraction(double)} method), giving a total of 50
|
|
215
|
+
* arcminutes. The total value for ZENITH is 90+(5/6) or 90.8333333° for true sunrise/sunset.
|
|
216
|
+
*/
|
|
217
|
+
// const ZENITH: number = GEOMETRIC_ZENITH + 5.0 / 6.0;
|
|
218
|
+
/** Sun's zenith at civil twilight (96°). */
|
|
219
|
+
static CIVIL_ZENITH = 96;
|
|
220
|
+
/** Sun's zenith at nautical twilight (102°). */
|
|
221
|
+
static NAUTICAL_ZENITH = 102;
|
|
222
|
+
/** Sun's zenith at astronomical twilight (108°). */
|
|
223
|
+
static ASTRONOMICAL_ZENITH = 108;
|
|
224
|
+
/**
|
|
225
|
+
* The Java Calendar encapsulated by this class to track the current date used by the class
|
|
226
|
+
* @private
|
|
227
|
+
*/
|
|
228
|
+
date;
|
|
229
|
+
/**
|
|
230
|
+
* the {@link GeoLocation} used for calculations.
|
|
231
|
+
* @private
|
|
232
|
+
*/
|
|
233
|
+
geoLocation;
|
|
193
234
|
/**
|
|
194
235
|
* The getSunrise method Returns a `Date` representing the
|
|
195
236
|
* {@link AstronomicalCalculator#getElevationAdjustment(double) elevation adjusted} sunrise time. The zenith used
|
|
@@ -540,6 +581,16 @@ export class NOAACalculator {
|
|
|
540
581
|
}
|
|
541
582
|
return adjustedZenith;
|
|
542
583
|
}
|
|
584
|
+
/**
|
|
585
|
+
* The <a href="http://en.wikipedia.org/wiki/Julian_day">Julian day</a> of January 1, 2000
|
|
586
|
+
* @private
|
|
587
|
+
*/
|
|
588
|
+
static JULIAN_DAY_JAN_1_2000 = 2451545;
|
|
589
|
+
/**
|
|
590
|
+
* Julian days per century
|
|
591
|
+
* @private
|
|
592
|
+
*/
|
|
593
|
+
static JULIAN_DAYS_PER_CENTURY = 36525;
|
|
543
594
|
/**
|
|
544
595
|
* @see AstronomicalCalculator#getUTCSunrise(Calendar, GeoLocation, double, boolean)
|
|
545
596
|
*/
|
|
@@ -1050,36 +1101,3 @@ export class NOAACalculator {
|
|
|
1050
1101
|
return timeUTC;
|
|
1051
1102
|
}
|
|
1052
1103
|
}
|
|
1053
|
-
/**
|
|
1054
|
-
* The zenith of astronomical sunrise and sunset. The sun is 90° from the vertical 0°
|
|
1055
|
-
* @private
|
|
1056
|
-
*/
|
|
1057
|
-
NOAACalculator.GEOMETRIC_ZENITH = 90;
|
|
1058
|
-
/**
|
|
1059
|
-
* Default value for Sun's zenith and true rise/set Zenith (used in this class and subclasses) is the angle that the
|
|
1060
|
-
* center of the Sun makes to a line perpendicular to the Earth's surface. If the Sun were a point and the Earth
|
|
1061
|
-
* were without an atmosphere, true sunset and sunrise would correspond to a 90° zenith. Because the Sun is not
|
|
1062
|
-
* a point, and because the atmosphere refracts light, this 90° zenith does not, in fact, correspond to true
|
|
1063
|
-
* sunset or sunrise, instead the center of the Sun's disk must lie just below the horizon for the upper edge to be
|
|
1064
|
-
* obscured. This means that a zenith of just above 90° must be used. The Sun subtends an angle of 16 minutes of
|
|
1065
|
-
* arc (this can be changed via the {@link #setSunRadius(double)} method , and atmospheric refraction accounts for
|
|
1066
|
-
* 34 minutes or so (this can be changed via the {@link #setRefraction(double)} method), giving a total of 50
|
|
1067
|
-
* arcminutes. The total value for ZENITH is 90+(5/6) or 90.8333333° for true sunrise/sunset.
|
|
1068
|
-
*/
|
|
1069
|
-
// const ZENITH: number = GEOMETRIC_ZENITH + 5.0 / 6.0;
|
|
1070
|
-
/** Sun's zenith at civil twilight (96°). */
|
|
1071
|
-
NOAACalculator.CIVIL_ZENITH = 96;
|
|
1072
|
-
/** Sun's zenith at nautical twilight (102°). */
|
|
1073
|
-
NOAACalculator.NAUTICAL_ZENITH = 102;
|
|
1074
|
-
/** Sun's zenith at astronomical twilight (108°). */
|
|
1075
|
-
NOAACalculator.ASTRONOMICAL_ZENITH = 108;
|
|
1076
|
-
/**
|
|
1077
|
-
* The <a href="http://en.wikipedia.org/wiki/Julian_day">Julian day</a> of January 1, 2000
|
|
1078
|
-
* @private
|
|
1079
|
-
*/
|
|
1080
|
-
NOAACalculator.JULIAN_DAY_JAN_1_2000 = 2451545;
|
|
1081
|
-
/**
|
|
1082
|
-
* Julian days per century
|
|
1083
|
-
* @private
|
|
1084
|
-
*/
|
|
1085
|
-
NOAACalculator.JULIAN_DAYS_PER_CENTURY = 36525;
|
package/package.json
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/noaa",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.8",
|
|
4
4
|
"description": "sunrise and sunset via NOAA algorithm with elevation, based on KosherJava",
|
|
5
5
|
"author": "Michael J. Radwin (https://github.com/mjradwin)",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"BehindTheMath (https://github.com/BehindTheMath)",
|
|
8
|
-
"Eliyahu Hershfeld (https://github.com/KosherJava)"
|
|
8
|
+
"Eliyahu Hershfeld (https://github.com/KosherJava)",
|
|
9
|
+
"Benny Powers (https://github.com/bennypowers)"
|
|
9
10
|
],
|
|
10
11
|
"license": "LGPL-3.0",
|
|
11
12
|
"repository": {
|
|
12
13
|
"type": "git",
|
|
13
14
|
"url": "git+https://github.com/hebcal/noaa.git"
|
|
14
15
|
},
|
|
15
|
-
"main": "dist/
|
|
16
|
-
"module": "dist/
|
|
17
|
-
"
|
|
16
|
+
"main": "dist/index.cjs",
|
|
17
|
+
"module": "dist/index.js",
|
|
18
|
+
"type": "module",
|
|
19
|
+
"exports": {
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"require": "./dist/index.cjs",
|
|
22
|
+
"types": "./dist/index.d.ts"
|
|
23
|
+
},
|
|
18
24
|
"scripts": {
|
|
19
25
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
20
|
-
"build": "npm run build:
|
|
21
|
-
"build:cjs": "tsc",
|
|
22
|
-
"build:es6": "tsc
|
|
23
|
-
"build:types": "tsc -p ./tsconfig-types.json",
|
|
26
|
+
"build": "npm run build:cjs && mv dist/index.js dist/index.cjs && npm run build:es6",
|
|
27
|
+
"build:cjs": "tsc -p ./tsconfig-cjs.json",
|
|
28
|
+
"build:es6": "tsc",
|
|
24
29
|
"lint": "gts lint",
|
|
25
30
|
"clean": "gts clean",
|
|
26
31
|
"compile": "tsc",
|
|
@@ -40,11 +45,11 @@
|
|
|
40
45
|
"dist/*"
|
|
41
46
|
],
|
|
42
47
|
"devDependencies": {
|
|
43
|
-
"@types/node": "20.
|
|
48
|
+
"@types/node": "20.10.0",
|
|
44
49
|
"gts": "^5.2.0",
|
|
45
50
|
"typescript": "^5.3.2"
|
|
46
51
|
},
|
|
47
|
-
"
|
|
52
|
+
"peerDependencies": {
|
|
48
53
|
"temporal-polyfill": "^0.1.1"
|
|
49
54
|
}
|
|
50
55
|
}
|