Civil twilight list for a year

58 views
Skip to first unread message

P C

unread,
Apr 3, 2021, 6:28:34 AM4/3/21
to weewx-user
Hello,
I would like to be able to generate a CSV file with the 365 or 366 days of any year with the dusk civilians (6 °) of the sun:
I include "hard" the year, and so these 3 output values:

date;
$almanac(horizon=-6).sun(use_center=1).rise;
$almanac(horizon=-6).sun(use_center=1).set


I know you have to use a model of the genre "crepuscules.csv.tmpl" etc.

It is of course at the level of the code that I am blocked: I do not see how to browse the dates.

Well to you,
Pascal

Tom Keffer

unread,
Apr 3, 2021, 9:15:10 AM4/3/21
to weewx-user
Something like this (NOT TESTED) should give you a table of sunrise and sunset:

    <table>
    #for $day in $year.days
      <tr>
        <td>$day.dateTime.format("%Y-%m-%d")</td>
        <td>$almanac(almanac_time=$day.dateTime.raw, horizon=-6).sun(use_center=1).rise</td>
        <td>$almanac(almanac_time=$day.dateTime.raw, horizon=-6).sun(use_center=1).set</td>
      </tr>
    #end for
    </table>

-tk

--
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 weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/968a02fe-6806-4141-a0aa-594a79b332e6n%40googlegroups.com.

Blaise

unread,
Apr 3, 2021, 10:35:52 AM4/3/21
to weewx...@googlegroups.com

Ah Yesss, perfect !

#for $day in $year.days
$day.dateTime.format("%d/%m/%Y");$almanac(almanac_time=$day.dateTime.raw, horizon=-6).sun(use_center=1).rise;$almanac(almanac_time=$day.dateTime.raw, horizon=-6).sun(use_center=1).set
#end for

I'm starting to apprehend language (I was gone in a loop for Each)

However, the result takes into account the time zone but also summer / winter hours. Is it possible to have that in UTC 0?
And how to choose another year?

Thank you again, it's great for my automatons!


Le 03-04-21 à 15:14, Tom Keffer a écrit :
You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/RX9r8kX_oN4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/CAPq0zEBNq9GKZBqvGCmuph%3DMxWTOibyRnUf6xzy3pOnhKzyF0g%40mail.gmail.com.

Tom Keffer

unread,
Apr 3, 2021, 9:40:54 PM4/3/21
to weewx-user
There is no programmatic way to get the results in UTC, although I suppose you could subtract your UTC offset from the results.

For prior years, you can use the argument "years_ago". For example, for last year:

#for $day in $year(years_ago=1).days
$day.dateTime.format("%d/%m/%Y");$almanac(almanac_time=$day.dateTime.raw, horizon=-6).sun(use_center=1).rise;$almanac(almanac_time=$day.dateTime.raw, horizon=-6).sun(use_center=1).set
#end for
You really should look at the Customizing Guide. It's all in there.

-tk


Reply all
Reply to author
Forward
0 new messages