|Date: Sat, 10 Oct 2020 09:38:29 -0500
|From: Tim Chase <[email protected]>
|To: [email protected]
|Cc: Users of Remind  <[email protected]>
|Subject: Re: [Remind-Fans] dawn,sunrise,sunset, dusk -- solar_noon??
|---
|On 2020-10-10 06:01, [email protected] 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: [email protected]
|From: Dianne Skoll <[email protected]>
|Date: Sat, 10 Oct 2020 10:34:21 -0400
|---
|On 2020-10-10 07:01, [email protected] 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.
_______________________________________________
Remind-fans mailing list
[email protected]
https://dianne.skoll.ca/mailman/listinfo/remind-fans
Remind is at https://dianne.skoll.ca/projects/remind/

Reply via email to