From f9107de893d6e61026d8376ccd4ab17972a010a6 Mon Sep 17 00:00:00 2001 From: Peter Hinch Date: Sat, 16 Dec 2023 19:11:46 +0000 Subject: [PATCH] Temp commit --- astronomy/README.md | 4 ++++ astronomy/sun_moon.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/astronomy/README.md b/astronomy/README.md index c9a5ea0..8a08938 100644 --- a/astronomy/README.md +++ b/astronomy/README.md @@ -126,6 +126,10 @@ time (`MT`). not computed, saving some processor time. Offsets are positive numbers representing degrees below the horizon where twilight is deemed to start and end. +By default when an application instantiates `RiSet` for the first time the +constructor prints the system date and time. This can be inhibited by setting +the class variable `verbose` to `False`. + ## 2.2 Methods * `set_day(day: int = 0)` `day` is an offset in days from the current system diff --git a/astronomy/sun_moon.py b/astronomy/sun_moon.py index c90b4e2..683ca86 100644 --- a/astronomy/sun_moon.py +++ b/astronomy/sun_moon.py @@ -201,6 +201,8 @@ def minimoon(t): class RiSet: + verbose = True + def __init__(self, lat=LAT, long=LONG, lto=0, tl=None): # Local defaults self.sglat = sin(radians(lat)) self.cglat = cos(radians(lat)) @@ -213,6 +215,10 @@ class RiSet: # [sunrise, sunset, moonrise, moonset, cvend, cvstart] self._times = [None] * 6 self.set_day() # Initialise to today's date + if RiSet.verbose: + t = time.localtime() + print(f"Machine time: {t[2]:02}/{t[1]:02}/{t[0]:4} {t[3]:02}:{t[4]:02}:{t[5]:02}") + RiSet.verbose = False # ***** API start ***** # Examine Julian dates either side of current one to cope with localtime.