returns height of something you give a shadow by using sun angle
This commit is contained in:
SpudGunMan
2025-09-26 19:23:12 -07:00
parent 6dc54abf43
commit 47e0276f0c
3 changed files with 5 additions and 4 deletions
+1
View File
@@ -140,6 +140,7 @@ git clone https://github.com/spudgunman/meshing-around
| `satpass` | returns the pass info from API for defined NORAD ID in config or Example: `satpass 25544,33591`| |
| `wiki:` | Searches Wikipedia and returns the first few sentences of the first result if a match. Example: `wiki: lora radio` |
| `howfar` | returns the distance you have traveled since your last HowFar. `howfar reset` to start over | ✅ |
| `howtall` | returns height of something you give a shadow by using sun angle | ✅ |
### CheckList
| Command | Description | |
+3 -3
View File
@@ -237,16 +237,16 @@ def measureHeight(lat=0, lon=0, shadow=0):
sun.compute(obs)
sun_altitude = sun.alt * 180 / ephem.pi
if sun_altitude <= 0:
return NO_ALERTS
return "☀️Sun is below horizon, I dont belive your shadow measurement"
try:
if use_metric:
height = float(shadow) * (1 / math.tan(sun.alt))
return f"Object Height: {height:.2f} m (Shadow: {shadow} m, Sun Alt: {sun_altitude:.2f}°)"
return f"📏Object Height: {height:.2f} m (Shadow: {shadow} m, 📐Sun Alt: {sun_altitude:.2f}°)"
else:
# Assume shadow is in feet if imperial, otherwise convert from meters to feet
shadow_ft = float(shadow)
height_ft = shadow_ft * (1 / math.tan(sun.alt))
return f"Object Height: {height_ft:.2f} ft (Shadow: {shadow_ft} ft, Sun Alt: {sun_altitude:.2f}°)"
return f"📏Object Height: {height_ft:.2f} ft (Shadow: {shadow_ft} ft, 📐Sun Alt: {sun_altitude:.2f}°)"
except Exception as e:
logger.error(f"Space: Error calculating height: {e}")
return NO_ALERTS
+1 -1
View File
@@ -59,7 +59,7 @@ if whoami_enabled:
if solar_conditions_enabled:
from modules.space import * # from the spudgunman/meshing-around repo
trap_list = trap_list + trap_list_solarconditions # items hfcond, solar, sun, moon
help_message = help_message + ", sun, hfcond, solar, moon"
help_message = help_message + ", sun, hfcond, solar, moon, howtall"
if n2yoAPIKey != "":
help_message = help_message + ", satpass"
else: