If not free lunch, thank you Gary for the snack (as I continue learning 
through the experience....)

1) To Database, or Not To Database
Sure, your previous mention coding would be the ideal ("sun position plot 
routine in some php a few years ago to produce a graphic file showing a 
plot of solar altitude through the day with the current sun position 
highlighted"). Indeed, this approach would address past/present/future. 

As WeeWX has pyephem and "Almanac", thought to be a normal path. 
'$almanac.sun.alt' and '$almanac.moon.alt' does provide uptime print info, 
but as said (and by trying) it breaks the Database. Was still thinking on 
rename to 'elephant' and 'giraffe', but still...

Extend database was not a chosen path, but baby-steps... would prefer to 
avoid this approach, as to avoid "another variable/extension" (which no 
meaning to PWS Observations), for a more educated track. 

Even if a dirty coding, puzzles me why '$alamanac.sun.alt" breaks the 
Database (for the sake to be just a number... but will not stress on that).

The search for an "easy recipe" (so I could make my own lunch and dinner), 
still escaping me.


2) solar_altitude
Coincidentally or not, 'solar_altitude' is in 
/usr/share/weewx/weeutil/Sun.py (not 'almanac.py'; there is a Moon.py as 
well, but no altitude). 
In fact, routine seems "fairly simple" sort to say, as the following:

def solar_altitude(latitude, year, month, day):
    """
    Compute the altitude of the sun. No atmospherical refraction taken
    in account.
    Altitude of the southern hemisphere are given relative to
    true north.
    Altitude of the northern hemisphere are given relative to
    true south.
    Declination is between 23.5° North and 23.5° South depending
    on the period of the year.
    Source of formula for altitude is PhysicalGeography.net
    http://www.physicalgeography.net/fundamentals/6h.html
    """
    # Compute declination
    N = daysSince2000Jan0(year, month, day)
    res =  sunRADec(N)
    declination = res[1]

    # Compute the altitude
    altitude = 90.0 - latitude  + declination

    # In the tropical and  in extreme latitude, values over 90 may occurs.
    if altitude > 90:
        altitude = 90 - (altitude-90)

    if altitude < 0:
        altitude = 0

    return altitude

https://github.com/weewx/weewx/blob/master/bin/weeutil/Sun.py

In my limited coding, not yet aware on how to call this variable, add to 
database or use "as is" to just call a plot (no history needed here...).

Best, Xant


-- 
You received this message because you are subscribed to the Google Groups 
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-user/805887d4-cfb3-42dd-a073-083671bdff66%40googlegroups.com.

Reply via email to