What happened?
|
def get_next_moon(moontype="full"): |
|
""" |
|
Get time of the next closest moon phase of given moon type (full, half or new). |
|
""" |
|
times = Time.now() + np.linspace(0, 30, 1000)*u.day |
|
phases = get_moon_phase(times) |
|
flis = get_moon_fli(phases) |
|
next_full = times[np.argmax(flis)] |
|
next_new = times[np.argmin(flis)] |
|
prev_full = next_full - 29.53*u.day |
|
prev_new = next_new - 29.53*u.day |
|
if min(next_new, next_full) - Time.now() > Time.now() - max(prev_new, prev_full): |
|
next_half = min(next_new, next_full) - 7.38*u.day |
|
else: |
|
next_half = min(next_new, next_full) + 7.38*u.day |
|
if moontype == "full": |
|
return next_full.isot.split('T')[0]+"T00:00:00" |
|
elif moontype == "new": |
|
return next_new.isot.split('T')[0]+"T00:00:00" |
|
elif moontype == "half": |
|
return next_half.isot.split('T')[0]+"T00:00:00" |
|
else: |
|
raise ValueError(f"Invalid moon type: {moontype}, should be 'full', 'new' or 'half'.") |
Likely should be location aware
Code to reproduce
Exception traceback
ScopeSim bug_report()
IRDB installation
I'm creating my own instrument package
Use case
Other
What happened?
ScopeSim/scopesim/utils.py
Lines 1218 to 1240 in 595a86b
Likely should be location aware
Code to reproduce
Exception traceback
ScopeSim bug_report()
IRDB installation
I'm creating my own instrument package
Use case
Other