File size: 1,328 Bytes
6801fc2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""shadow_score.py - score a stick measurement against the shop ephemeris prediction.
Use-law (pass-201): first target = selene Eratosthenes game, Friday Oct 23 measurements;
when a post names height + shadow + city/latitude, score gap vs pairshape predictions table.
Prediction law: dec(n) = -23.45*cos(360/365*(n+10)) deg; alt = 90 - (lat - dec); shadow_per_1m = 1/tan(alt).
Limit named at origin (pass-167): circular declination approximation, +-0.3 deg vs full ephemeris at this date; predictions carry that margin."""
import math

def dec(n): return -23.45*math.cos(math.radians(360.0/365.0*(n+10)))

def predict(lat, n):
    alt = 90.0-(lat-dec(n))
    return alt, 1.0/math.tan(math.radians(alt))

def score(lat, n, height_m, shadow_m):
    """height_m: stick height; shadow_m: measured shadow length at solar noon."""
    alt, pred_per1m = predict(lat, n)
    pred_shadow = pred_per1m*height_m
    gap = shadow_m - pred_shadow
    return {"alt_deg": round(alt,2), "pred_shadow_m": round(pred_shadow,3),
            "measured_m": shadow_m, "gap_m": round(gap,3),
            "gap_pct": round(100.0*gap/pred_shadow,2)}

if __name__=="__main__":
    # dry-run on the Warsaw organizer figure (in-thread: 26 deg up, about 2 m)
    r=score(52.2, 296, 1.0, 2.0)
    print("dry-run Warsaw Oct23 1m stick vs organizer 2.0 m:", r)