[GRASS-user] Difference in sunset/sunrise time between r.sun and r.sunmask

Markus Neteler neteler at osgeo.org
Wed Jan 4 10:33:51 EST 2012


On Wed, Jan 4, 2012 at 8:26 AM,  <thomas.huld at jrc.ec.europa.eu> wrote:
> Hello,
>
> Sorry for the late reply, I tried to send this once but something must have
> gone wrong.
>
> By default r.sun calculates times as true solar time, whereby solar noon is
> always exactly 12 o'clock everywhere. Depending on where you are in your time
> zone, this may cause differences of up to an hour, in some cases (like Western
> Spain) even more. On top of this, the offset varies during the year according
> to the Equation of Time.
>
> You can use the option civiltime=<timezone_offset> in r.sun to make it use
> wall clock time. For Central Europe the timezone offset is +1, +2 when
> daylight saving time is in effect.

I'll add the upper part slightly modified to the manual, thanks for
the insights.

> I'm not completely sure about this, but if you use civiltime you may have to
> supply the longitude as a raster with the "longin" option. With latlon
> projection you can make a longitude raster simply with
>
> r.mapcalc lon_raster='x()'

The source code of 6.4+ contains:

grass64/raster/r.sun2/main.c line 749:

    if ((latin != NULL || longin != NULL) && (G_projection() == PROJECTION_LL))
        G_warning(_("latin and longin raster maps have no effect when
in a Lat/Lon location"));
        /* true about longin= when civiltime is used? */
        /* civiltime needs longin= but not latin= for non-LL projections -
            better would be it just use pj_proj() if it needs those?? */
    if (latin != NULL && longin == NULL)
        G_fatal_error(_("Both latin and longin raster maps must be
given, or neither"));

More investigations needed...
Markus


More information about the grass-user mailing list