@hebcal/noaa 0.8.1 → 0.8.3
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/dist/cjs/index.js +28 -34
- package/package.json +3 -3
- package/dist/esm/index.js +0 -1062
- package/dist/index.d.ts +0 -710
package/dist/cjs/index.js
CHANGED
|
@@ -119,16 +119,19 @@ exports.GeoLocation = GeoLocation;
|
|
|
119
119
|
/**
|
|
120
120
|
* The commonly used average solar refraction. Calendrical Calculations lists a more accurate global average of
|
|
121
121
|
* 34.478885263888294
|
|
122
|
+
* @private
|
|
122
123
|
*/
|
|
123
124
|
const refraction = 34 / 60;
|
|
124
125
|
// private double refraction = 34.478885263888294 / 60d;
|
|
125
126
|
/**
|
|
126
127
|
* The commonly used average solar radius in minutes of a degree.
|
|
128
|
+
* @private
|
|
127
129
|
*/
|
|
128
130
|
const solarRadius = 16 / 60;
|
|
129
131
|
/**
|
|
130
132
|
* The commonly used average earth radius in KM. At this time, this only affects elevation adjustment and not the
|
|
131
133
|
* sunrise and sunset calculations. The value currently defaults to 6356.9 KM.
|
|
134
|
+
* @private
|
|
132
135
|
*/
|
|
133
136
|
const earthRadius = 6356.9; // in KM
|
|
134
137
|
/**
|
|
@@ -429,7 +432,7 @@ class NOAACalculator {
|
|
|
429
432
|
}
|
|
430
433
|
/**
|
|
431
434
|
* Adjusts the <code>Calendar</code> to deal with edge cases where the location crosses the antimeridian.
|
|
432
|
-
*
|
|
435
|
+
* @private
|
|
433
436
|
* @see GeoLocation#getAntimeridianAdjustment()
|
|
434
437
|
* @return the adjusted Calendar
|
|
435
438
|
*/
|
|
@@ -567,7 +570,8 @@ class NOAACalculator {
|
|
|
567
570
|
if (startOfday === null || endOfDay === null) {
|
|
568
571
|
return Long_MIN_VALUE;
|
|
569
572
|
}
|
|
570
|
-
|
|
573
|
+
const delta = endOfDay.epochMilliseconds - startOfday.epochMilliseconds;
|
|
574
|
+
return Math.floor(delta / 12);
|
|
571
575
|
}
|
|
572
576
|
/**
|
|
573
577
|
* A method that returns sundial or solar noon. It occurs when the Sun is <a href
|
|
@@ -593,7 +597,7 @@ class NOAACalculator {
|
|
|
593
597
|
}
|
|
594
598
|
/**
|
|
595
599
|
* A method that returns a <code>Date</code> from the time passed in as a parameter.
|
|
596
|
-
*
|
|
600
|
+
* @protected
|
|
597
601
|
* @param time
|
|
598
602
|
* The time to be set as the time for the <code>Date</code>. The time expected is in the format: 18.75
|
|
599
603
|
* for 6:45:00 PM.
|
|
@@ -632,7 +636,7 @@ class NOAACalculator {
|
|
|
632
636
|
}
|
|
633
637
|
/**
|
|
634
638
|
* Return the <a href="http://en.wikipedia.org/wiki/Julian_day">Julian day</a> from a Java Calendar
|
|
635
|
-
*
|
|
639
|
+
* @private
|
|
636
640
|
* @param calendar
|
|
637
641
|
* The Java Calendar
|
|
638
642
|
* @return the Julian day corresponding to the date Note: Number is returned for start of day. Fractional days
|
|
@@ -655,7 +659,7 @@ class NOAACalculator {
|
|
|
655
659
|
}
|
|
656
660
|
/**
|
|
657
661
|
* Convert <a href="http://en.wikipedia.org/wiki/Julian_day">Julian day</a> to centuries since J2000.0.
|
|
658
|
-
*
|
|
662
|
+
* @private
|
|
659
663
|
* @param julianDay
|
|
660
664
|
* the Julian Day to convert
|
|
661
665
|
* @return the centuries since 2000 Julian corresponding to the Julian Day
|
|
@@ -666,7 +670,7 @@ class NOAACalculator {
|
|
|
666
670
|
}
|
|
667
671
|
/**
|
|
668
672
|
* Convert centuries since J2000.0 to <a href="http://en.wikipedia.org/wiki/Julian_day">Julian day</a>.
|
|
669
|
-
*
|
|
673
|
+
* @private
|
|
670
674
|
* @param julianCenturies
|
|
671
675
|
* the number of Julian centuries since J2000.0
|
|
672
676
|
* @return the Julian Day corresponding to the Julian centuries passed in
|
|
@@ -677,7 +681,7 @@ class NOAACalculator {
|
|
|
677
681
|
}
|
|
678
682
|
/**
|
|
679
683
|
* Returns the Geometric <a href="http://en.wikipedia.org/wiki/Mean_longitude">Mean Longitude</a> of the Sun.
|
|
680
|
-
*
|
|
684
|
+
* @private
|
|
681
685
|
* @param julianCenturies
|
|
682
686
|
* the number of Julian centuries since J2000.0
|
|
683
687
|
* @return the Geometric Mean Longitude of the Sun in degrees
|
|
@@ -694,7 +698,7 @@ class NOAACalculator {
|
|
|
694
698
|
}
|
|
695
699
|
/**
|
|
696
700
|
* Returns the Geometric <a href="http://en.wikipedia.org/wiki/Mean_anomaly">Mean Anomaly</a> of the Sun.
|
|
697
|
-
*
|
|
701
|
+
* @private
|
|
698
702
|
* @param julianCenturies
|
|
699
703
|
* the number of Julian centuries since J2000.0
|
|
700
704
|
* @return the Geometric Mean Anomaly of the Sun in degrees
|
|
@@ -704,7 +708,7 @@ class NOAACalculator {
|
|
|
704
708
|
}
|
|
705
709
|
/**
|
|
706
710
|
* Return the <a href="http://en.wikipedia.org/wiki/Eccentricity_%28orbit%29">eccentricity of earth's orbit</a>.
|
|
707
|
-
*
|
|
711
|
+
* @private
|
|
708
712
|
* @param julianCenturies
|
|
709
713
|
* the number of Julian centuries since J2000.0
|
|
710
714
|
* @return the unitless eccentricity
|
|
@@ -715,7 +719,7 @@ class NOAACalculator {
|
|
|
715
719
|
}
|
|
716
720
|
/**
|
|
717
721
|
* Returns the <a href="http://en.wikipedia.org/wiki/Equation_of_the_center">equation of center</a> for the sun.
|
|
718
|
-
*
|
|
722
|
+
* @private
|
|
719
723
|
* @param julianCenturies
|
|
720
724
|
* the number of Julian centuries since J2000.0
|
|
721
725
|
* @return the equation of center for the sun in degrees
|
|
@@ -733,7 +737,7 @@ class NOAACalculator {
|
|
|
733
737
|
}
|
|
734
738
|
/**
|
|
735
739
|
* Return the true longitude of the sun
|
|
736
|
-
*
|
|
740
|
+
* @private
|
|
737
741
|
* @param julianCenturies
|
|
738
742
|
* the number of Julian centuries since J2000.0
|
|
739
743
|
* @return the sun's true longitude in degrees
|
|
@@ -743,22 +747,9 @@ class NOAACalculator {
|
|
|
743
747
|
const center = NOAACalculator.getSunEquationOfCenter(julianCenturies);
|
|
744
748
|
return sunLongitude + center; // in degrees
|
|
745
749
|
}
|
|
746
|
-
// /**
|
|
747
|
-
// * Returns the <a href="http://en.wikipedia.org/wiki/True_anomaly">true anamoly</a> of the sun.
|
|
748
|
-
// *
|
|
749
|
-
// * @param julianCenturies
|
|
750
|
-
// * the number of Julian centuries since J2000.0
|
|
751
|
-
// * @return the sun's true anamoly in degrees
|
|
752
|
-
// */
|
|
753
|
-
// private static double getSunTrueAnomaly(double julianCenturies) {
|
|
754
|
-
// double meanAnomaly = getSunGeometricMeanAnomaly(julianCenturies);
|
|
755
|
-
// double equationOfCenter = getSunEquationOfCenter(julianCenturies);
|
|
756
|
-
//
|
|
757
|
-
// return meanAnomaly + equationOfCenter; // in degrees
|
|
758
|
-
// }
|
|
759
750
|
/**
|
|
760
751
|
* Return the apparent longitude of the sun
|
|
761
|
-
*
|
|
752
|
+
* @private
|
|
762
753
|
* @param julianCenturies
|
|
763
754
|
* the number of Julian centuries since J2000.0
|
|
764
755
|
* @return sun's apparent longitude in degrees
|
|
@@ -771,7 +762,7 @@ class NOAACalculator {
|
|
|
771
762
|
}
|
|
772
763
|
/**
|
|
773
764
|
* Returns the mean <a href="http://en.wikipedia.org/wiki/Axial_tilt">obliquity of the ecliptic</a> (Axial tilt).
|
|
774
|
-
*
|
|
765
|
+
* @private
|
|
775
766
|
* @param julianCenturies
|
|
776
767
|
* the number of Julian centuries since J2000.0
|
|
777
768
|
* @return the mean obliquity in degrees
|
|
@@ -785,7 +776,7 @@ class NOAACalculator {
|
|
|
785
776
|
/**
|
|
786
777
|
* Returns the corrected <a href="http://en.wikipedia.org/wiki/Axial_tilt">obliquity of the ecliptic</a> (Axial
|
|
787
778
|
* tilt).
|
|
788
|
-
*
|
|
779
|
+
* @private
|
|
789
780
|
* @param julianCenturies
|
|
790
781
|
* the number of Julian centuries since J2000.0
|
|
791
782
|
* @return the corrected obliquity in degrees
|
|
@@ -797,7 +788,7 @@ class NOAACalculator {
|
|
|
797
788
|
}
|
|
798
789
|
/**
|
|
799
790
|
* Return the <a href="http://en.wikipedia.org/wiki/Declination">declination</a> of the sun.
|
|
800
|
-
*
|
|
791
|
+
* @private
|
|
801
792
|
* @param julianCenturies
|
|
802
793
|
* the number of Julian centuries since J2000.0
|
|
803
794
|
* @return
|
|
@@ -814,7 +805,7 @@ class NOAACalculator {
|
|
|
814
805
|
/**
|
|
815
806
|
* Return the <a href="http://en.wikipedia.org/wiki/Equation_of_time">Equation of Time</a> - the difference between
|
|
816
807
|
* true solar time and mean solar time
|
|
817
|
-
*
|
|
808
|
+
* @private
|
|
818
809
|
* @param julianCenturies
|
|
819
810
|
* the number of Julian centuries since J2000.0
|
|
820
811
|
* @return equation of time in minutes of time
|
|
@@ -841,7 +832,7 @@ class NOAACalculator {
|
|
|
841
832
|
/**
|
|
842
833
|
* Return the <a href="http://en.wikipedia.org/wiki/Hour_angle">hour angle</a> of the sun at sunrise for the
|
|
843
834
|
* latitude.
|
|
844
|
-
*
|
|
835
|
+
* @private
|
|
845
836
|
* @param lat
|
|
846
837
|
* , the latitude of observer in degrees
|
|
847
838
|
* @param solarDec
|
|
@@ -861,7 +852,7 @@ class NOAACalculator {
|
|
|
861
852
|
* Returns the <a href="http://en.wikipedia.org/wiki/Hour_angle">hour angle</a> of the sun at sunset for the
|
|
862
853
|
* latitude. TODO: use - {@link #getSunHourAngleAtSunrise(double, double, double)} implementation to avoid
|
|
863
854
|
* duplication of code.
|
|
864
|
-
*
|
|
855
|
+
* @private
|
|
865
856
|
* @param lat
|
|
866
857
|
* the latitude of observer in degrees
|
|
867
858
|
* @param solarDec
|
|
@@ -934,7 +925,7 @@ class NOAACalculator {
|
|
|
934
925
|
/**
|
|
935
926
|
* Return the <a href="http://en.wikipedia.org/wiki/Universal_Coordinated_Time">Universal Coordinated Time</a> (UTC)
|
|
936
927
|
* of sunrise for the given day at the given location on earth
|
|
937
|
-
*
|
|
928
|
+
* @private
|
|
938
929
|
* @param julianDay
|
|
939
930
|
* the Julian day
|
|
940
931
|
* @param latitude
|
|
@@ -973,7 +964,7 @@ class NOAACalculator {
|
|
|
973
964
|
* Return the <a href="http://en.wikipedia.org/wiki/Universal_Coordinated_Time">Universal Coordinated Time</a> (UTC)
|
|
974
965
|
* of <a href="http://en.wikipedia.org/wiki/Noon#Solar_noon">solar noon</a> for the given day at the given location
|
|
975
966
|
* on earth.
|
|
976
|
-
*
|
|
967
|
+
* @private
|
|
977
968
|
* @param julianCenturies
|
|
978
969
|
* the number of Julian centuries since J2000.0
|
|
979
970
|
* @param longitude
|
|
@@ -995,7 +986,7 @@ class NOAACalculator {
|
|
|
995
986
|
/**
|
|
996
987
|
* Return the <a href="http://en.wikipedia.org/wiki/Universal_Coordinated_Time">Universal Coordinated Time</a> (UTC)
|
|
997
988
|
* of sunset for the given day at the given location on earth
|
|
998
|
-
*
|
|
989
|
+
* @private
|
|
999
990
|
* @param julianDay
|
|
1000
991
|
* the Julian day
|
|
1001
992
|
* @param latitude
|
|
@@ -1034,6 +1025,7 @@ class NOAACalculator {
|
|
|
1034
1025
|
exports.NOAACalculator = NOAACalculator;
|
|
1035
1026
|
/**
|
|
1036
1027
|
* The zenith of astronomical sunrise and sunset. The sun is 90° from the vertical 0°
|
|
1028
|
+
* @private
|
|
1037
1029
|
*/
|
|
1038
1030
|
NOAACalculator.GEOMETRIC_ZENITH = 90;
|
|
1039
1031
|
/**
|
|
@@ -1056,9 +1048,11 @@ NOAACalculator.NAUTICAL_ZENITH = 102;
|
|
|
1056
1048
|
NOAACalculator.ASTRONOMICAL_ZENITH = 108;
|
|
1057
1049
|
/**
|
|
1058
1050
|
* The <a href="http://en.wikipedia.org/wiki/Julian_day">Julian day</a> of January 1, 2000
|
|
1051
|
+
* @private
|
|
1059
1052
|
*/
|
|
1060
1053
|
NOAACalculator.JULIAN_DAY_JAN_1_2000 = 2451545;
|
|
1061
1054
|
/**
|
|
1062
1055
|
* Julian days per century
|
|
1056
|
+
* @private
|
|
1063
1057
|
*/
|
|
1064
1058
|
NOAACalculator.JULIAN_DAYS_PER_CENTURY = 36525;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hebcal/noaa",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
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": [
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"dist/*"
|
|
41
41
|
],
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@types/node": "20.9.
|
|
43
|
+
"@types/node": "20.9.3",
|
|
44
44
|
"gts": "^5.2.0",
|
|
45
|
-
"typescript": "^5.
|
|
45
|
+
"typescript": "^5.3.2"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"temporal-polyfill": "^0.1.1"
|