[GRASS5] r.sunmask: how to avoid hh:60 output for sunset/sunrise?
Markus Neteler
neteler at itc.it
Mon Dec 6 05:28:06 EST 2004
Hi,
small C programming question:
r.sunmask -sg el=dtm.10meters timezone=1 output=vuoto east=1694215 north=5104320 year=1998 month=12 day=23 hour=12 minute=15 sec=0
Calculating sun position... (using solpos (V. 11 April 2001) from NREL)
WARNING: Specified point 1694215.000000, 5104320.000000 outside of current
window, is that intended? Anyway, it will be used.
date=1998.12.23
daynum=357
time=12:15:00
decimaltime=12.250000
longitudine=11.510999
latitude=46.063343
timezone=1.000000
sunazimuth=180.501633
sunangleabovehorzizont=20.544914
sunrise=07:60 <------- ! Would like to see 8:00 here
sunset=16:26
The related code looks like this:
fprintf (stdout, "sunrise=%02.0f:%02.0f\n", floor(pdat->sretr/60.), fmod(pdat->sretr, 60.));
fprintf (stdout, "sunset=%02.0f:%02.0f\n", floor(pdat->ssetr/60.), fmod(pdat->ssetr, 60.));
Should I add 'if' (if minutes >=60) conditions or is there a better way
to avoid 07:60 output?
Thanks
Markus
More information about the grass-dev
mailing list