Skip to content

Commit 044138f

Browse files
authored
Merge pull request #41 from AssessingSolar/numeric-delta_t_dtype
Change delta_t dtype to numeric
2 parents b46406c + 3ae0473 commit 044138f

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

src/solposx/solarposition/noaa.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def noaa(times, latitude, longitude, delta_t=67.0):
3030
longitude : float
3131
Longitude in decimal degrees. Positive east of prime meridian,
3232
negative to west. [degrees]
33-
delta_t : float or array, default 67.0
33+
delta_t : numeric, default 67.0
3434
Difference between terrestrial time and UT1.
3535
If delta_t is None, uses spa.calculate_deltat
3636
using time.year and time.month from pandas.DatetimeIndex.

src/solposx/solarposition/usno.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ def usno(times, latitude, longitude, delta_t=67.0, gmst_option=1):
2222
longitude : float
2323
Longitude in decimal degrees. Positive east of prime meridian,
2424
negative to west. [degrees]
25-
delta_t : float or array, default 67.0
25+
delta_t : numeric, default 67.0
2626
Difference between terrestrial time and UT1.
2727
If delta_t is None, uses spa.calculate_deltat
2828
using time.year and time.month from pandas.DatetimeIndex.
2929
For most simulations the default delta_t is sufficient.
3030
The USNO has historical and forecasted delta_t [2]_. [seconds]
31-
gmst_option : numeric, default 1
32-
Different ways of calculating the Greenwich mean sidereal time. See
33-
[1]_.
31+
gmst_option : int, default 1
32+
Different ways of calculating the Greenwich mean sidereal time.
33+
`gmst_option` needs to be either 1, 2, or 3. See [1]_.
3434
3535
Returns
3636
-------

tests/test_solarposition.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,3 +489,17 @@ def test_noaa_refraction_85_degrees():
489489
latitude=0, longitude=0,
490490
)
491491
assert angles['elevation'].iloc[0] == angles['apparent_elevation'].iloc[0]
492+
493+
494+
def test_delta_t_array_input():
495+
# test that delta_t can be specified as either an array or float
496+
times = pd.date_range('2020-03-23 12', periods=10, tz='UTC')
497+
delta_t = np.ones(len(times)) * 67.0
498+
# test noaa
499+
noaa_array = noaa(times, 50, 10, delta_t=delta_t)
500+
noaa_float = noaa(times, 50, 10, delta_t=67.0)
501+
pd.testing.assert_frame_equal(noaa_array, noaa_float)
502+
# test usno
503+
usno_array = usno(times, 50, 10, delta_t=delta_t)
504+
usno_float = usno(times, 50, 10, delta_t=67.0)
505+
pd.testing.assert_frame_equal(usno_array, usno_float)

0 commit comments

Comments
 (0)