[Remind-Fans] dawn,sunrise,sunset, dusk -- solar_noon??

remind-fans at trodman.com remind-fans at trodman.com
Sun Oct 11 06:54:08 EDT 2020


|Date: Sat, 10 Oct 2020 09:38:29 -0500
|From: Tim Chase <remind at tim.thechases.com>
|To: remind-fans at trodman.com
|Cc: Users of Remind  <remind-fans at lists.skoll.ca>
|Subject: Re: [Remind-Fans] dawn,sunrise,sunset, dusk -- solar_noon??
|---
|On 2020-10-10 06:01, remind-fans at trodman.com wrote:
[...]
|> 
|> Right now, might I be able to do the math all in remind, and bisect
|> the sunrise(),sunset() interval?
|
|Indeed, you can do all the math in Remind, exactly as you describe by
|bisecting sunrise & sunset.  The only trick is that Remind doesn't
|like to add or divide TIME types, so you have to convert them to the
|minute-of-the-day, average/bisect them, and then convert it back to a
|time.  But once you know that, writing such an FSET to create
|noon_solar() isn't too bad:
|
|FSET tomins(t) (hour(t) * 60) + minute(t)
|FSET frommins(i) time(i / 60, i % 60)
|FSET noon_solar(dt) frommins(( \
|tomins(sunrise(dt)) + tomins(sunset(dt)) \
|) / 2)
|
|MSG %"Solar noon: [noon_solar($T)]%"%

Thanks Tim! It works. 

Also I did not know you could use MSG without REM and a time/date -- handy.

|Subject: Re: [Remind-Fans] dawn,sunrise,sunset, dusk -- solar_noon??
|To: remind-fans at trodman.com
|From: Dianne Skoll <dianne at skoll.ca>
|Date: Sat, 10 Oct 2020 10:34:21 -0400
|---
|On 2020-10-10 07:01, remind-fans at trodman.com wrote:
|
[...]
|
|> Right now, might I be able to do the math all in remind, and bisect the
|> sunrise(),sunset() interval?
|
|Yep.  I believe solar noon is defined as halfway between sunrise and
|sunset, so this will do the trick:
|
|FSET solarnoon(x) sunrise(x) + (sunset(x)-sunrise(x))/2
|MSG Sunrise: [sunrise($T)]; Sunset: [sunset($T)]; Solar noon: [solarnoon($T)]
|
|Note that because of how Remind converts types, the simpler:
|
|FSET solarnoon(x) (sunrise(x) + sunset(x)) / 2
|
|will not work.  You cannot divide a time by an integer, so you get:
|
|`/': Type mismatch
|
|However, subtracting two times yields an integer, which *can* be divided
|by two, and you can add an integer to a time, so it all works out.

Thanks much Dianne, and thanks for 'remind'.

--
Tom
Milwaukee  WI
--
Found out about remind years ago from Randal Schwartz's floss weekly interview.


More information about the Remind-fans mailing list