[rrd-users] VRULE for sunset, sunrise

Kimball, Conrad conrad.kimball at boeing.com
Mon Aug 27 18:47:32 CEST 2007


Something to consider...  (maybe the original poster is already aware of
this, but perhaps others on the list are not).

The time of sunrise/sunset is inherently tied to a specific geographic
location.  Within the same time zone sunrise/sunset varies from place to
place - consider that a time zone is nominally one hour wide, so
sunrise/sunset will occur one hour earlier at the eastern edge of a time
zone than at its western edge (indeed, for any given latitude, a
difference of 15 minutes of longitude results in a one minute difference
in sunrise/sunset).  And even at the same longitude sunrise/sunset
varies by latitude - as a limiting case consider the June 21 solstice,
in which the sun never sets at the north pole and never rises at the
south pole.

So one can't even pose a well-defined sunrise/sunset question without
choosing some specific geographic reference point.

Assuming the objective is to graph sunrise/sunset with respect to the
data sources, then...

If all the data you want to display in any one particular graph is
collected from sources within some suitably small distance of your
reference point then you can generate a graph in which sunrise/sunset is
reasonably well-defined.  But as the distance of your sources from the
reference point increases then the idea of plotting sunrise/sunset
becomes increasingly ill-defined.  For example, consider a graph
composed of data from sources across the continental US, or a graph
composed of data from sources in Stockholm and Cape Town which are
nearly the same longitude (roughly 20 minute difference), but on Aug 27,
2007 Stockholm sunrise was 5:32 AM and Cape Town sunrise was 7:12 AM -
both times are UTC+2 (from the very interesting site
http://www.timeanddate.com/worldclock/sunrise.html).

Conrad Kimball

-----Original Message-----
From: Jason Fesler [mailto:jfesler at gigo.com] 
Sent: Monday, August 27, 2007 8:05 AM
To: Joseph Mack NA3T
Cc: rrd-users at lists.oetiker.ch
Subject: Re: [rrd-users] VRULE for sunset, sunrise

> I want it in the RRD, so I can plot it as a graph, for the
> year graph, but I'd like to show the day/night somehow for
> any particular day.

At whatever interval you store regular data, do a lookup and also store 
into RRD, whether it is day or night (perhaps as 1 and 0, or 1 and
NaN?).
Using that, you can have have an RRD graph that loads your data, + day
or 
night, and a CDEF can make a choice what to show based on that.

That'll make it so that you only have to worry about the changing time
for 
sunrise/sunset at the time of insert, and not for any of your later 
graphs.

_______________________________________________
rrd-users mailing list
rrd-users at lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users



More information about the rrd-users mailing list