It is currently March 29th, 2024, 3:24 pm

Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7031
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by Yincognito »

pbutler6 wrote: August 27th, 2020, 9:48 pmMy skin doesn't have the jump. The top hemisphere position is based on the percent of the circle since moonrise based on the current rise and set time as 50% of the circle and in the lower hemisphere, the position is based on 50% of the circle + the percent of the current set and rise times as the other 50% of the circle.

Code: Select all

[SinceMoonrise]
Measure=Calc
Formula= #Moonup#=1 ? (TimeNowStamp-#Moonrise#)/(#Moonset#-#Moonrise#) : 1 + (TimeNowStamp-#Moonset#)/(#Moonrise#-#Moonset#)
MaxValue=2
Group=Sun&Moon
Disabled=1
DynamicVariables=1
That's more or less the same approach I used in my skin as well (don't be fooled by the more complicated formulas), so no major differences there. That being said, I don't think you do "timelapse" animation in your skin (i.e. artificially make the "now" time go faster) or keep a close eye on the position of the sun and moon at the exact time when the source you get the data from updates the rise and set time from those of "today" to those of "tomorrow" to be able to notice the jump. The jump will happen anyway if you grab only the rise and set times and do the math based on those values and the now time... unless you did some adjustments of the current day arcs based on the tomorrow's ones (which I'm not sure you did, as I didn't look in detail what you did in your skin). I know I didn't, as it would have meant adding more measures and computations and I wasn't in the mood for that.

Let's take an example, to better understand what I mean. Let's assume, for the sake of simplicity and clarity, that your "today" aka the current day variables are (the 24 hour notation is used, as it's more meaningful):

Code: Select all

TimeNowStamp = 23:59:59
Moonrise = 20:00:00
Moonset = 06:00:00
Based on that, the moon will be positioned on its 'up' arc (doesn't really matter which arc though, as it doesn't change the result), per your formulas, at:

Code: Select all

(23:59:59-20:00:00) / (06:00:00-20:00:00) = 3:59:59 / 10:00:00 = 4 / 10 = 0.40 = 40 %
of its arc (I added a second above and approximated, to make the calculation easier). At the moment of your data source changes / updates the rise set times from "today" to "tomorrow" (let's suppose this happens at 00:00:00 instead of 03:00:00 as for weather.com), the moonrise and moonset as well as the difference between moonset and moonrise (and all the related values) will change considerably... while your TimeNowStamp time will remain more or less constant (well, let's say 1 second more, as it took 1 second to update those values from the source and it's now 00:00:00, a brand new day). So now we have your "new" current day variables at (the values in this example are actually taken from the timeanddate.com values of some future days for my location, but they're simplified to round values, obviously):

Code: Select all

TimeNowStamp = 00:00:00
Moonrise = 21:00:00
Moonset = 08:00:00
What will happen is that the moon will be now positioned on its current arc at:

Code: Select all

(00:00:00-21:00:00) / (08:00:00-21:00:00) = 3:00:00 / 11:00:00 = 3 / 11 = 0.27 = 27 %
of it. So, in other words, the moon goes from being positioned at 40 % of the arc one second ago (i.e. before the source updated its rise set times) to now being positioned at 27 % of the same arc (as the data changed in the meantime) - hence the "jump".

Hopefully you understood what I meant in my simple example. Again, this does happen no matter what, unless you adjusted the position on the arc somehow taking into account the fact that "tomorrow" it will be 3 divided to 11 instead of the "old" 4 divided by 10. I have no idea if you did, so that's up for you to know.
pbutler6 wrote: August 27th, 2020, 9:48 pmI had to do some calculations and shifting to figure out which JSON "day" is the right day for "now" because the Weather.com day changes at 3 AM and there is at least one day each month when the moon doesn't have a rise time and at least one that doesn't have a set time. So the rise time and the set time often from different days. That doesn't matter so long as the current hemisphere is using the correct start and end times.
The moon always has a rise and a set time. What happens when the web source "doesn't have" a rise or a set time is that the "missing" time in question happened the previous day, or will happen the next day. And since we're at it, I believe that you have some issues regarding this in your skin, because it chooses the wrong moonrise / moonset times, as it can be seen here, where I compared to the timeanddate.com data (which display things graphically so it's very easy to understand what happens):
Comparison.jpg
So, your moonrise time is 5:36 PM (i.e. 17:36) and the moonset is 12:59 AM (i.e. 00:59). My skin's moonrise is 16:36 and the moonset is 00:59. By the way, due to how weather.com provides things, my "day 0" (the 1st forecast day) is still 2020-08-27, although it's past 00:00 aka 12:00 AM here now, so the times are displayed as if were for "yesterday" (in a way, the moontimes actually are, will get to this in a moment). What is clear from the timeanddate.com graph is that the moonset of 00:59 does not "belong" to the moonrise of 17:36 (aka 5:36 in your skin), but to the moonrise of 16:35 or 16:36, which happened yesterday, aka 2020-08-27, and similarly, the moonset of the moonrise-moonset cycle that begins at 17:36 will happen tomorrow (at 01:54). Now on the moontimes being for a day or another: since the moon cycles sometimes happen "between days" (like in this example) it is correct to say that they are either for yesterday, today or tomorrow, depending on which rise set time one considers as "of today" - that's why I don't really worry about those times being displayed for 2020-08-27 in my skin (or at weather.com, for that matter), although to be stricly correct, the moonrise and moonset times should be chosen as the ones that happen after "now", and not before it.

P.S. I guess one can get those arc angles from the link posted here as well, they are one for each hour of the 24 hour day, and they are under the "elevation" section in the JSON. The angles in between hours are obviously not presnt, but they could be approximated based on the minute and the values for the previous and the next hour.

P.S.S. The moonrise / moonset choice issue in your skin happens for the moonset as well, not just for the moonrise, as it can be seen below, where the moonset should be 01:54 but it's instead the 00:59 of the previous day (in this one, weather.com finally updated its data to reflect today's date of 2020-08-28 and my skin grabs the moonrise happening after the "now" moment of 05:16:11):
Comparison 2.jpg
You do not have the required permissions to view the files attached to this post.
Last edited by Yincognito on August 29th, 2020, 1:36 pm, edited 1 time in total.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by Mor3bane »

pbutler6 wrote: August 26th, 2020, 11:11 pm I have an image of the moon that changes with the phase. Unfortunately, the image has a black square background. If I can have a container at the end of the rotator arm that is a circle for the right size of the image I want to show, then I can mask the black background and just show the image of the moon.
The images should ideally have a transparent background.

GIMP does that rather easily.
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
pbutler6
Posts: 100
Joined: April 27th, 2020, 8:10 pm

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by pbutler6 »

Yincognito --

I still trying to digest your explanation of the rise and set time. My logic is not to worry about yesterday, today and tomorrow but rather to find the Moonrise and Moonset times (or Moonset and Moonrise times) that bracket Timenow. The rise and set time often span two days.

Screenshot 2020-08-28 202727.jpg
Screenshot 2020-08-28 203001.jpg

I see your concern and I'm still working to check my logic.

Your image rotates logic does now keep the moon in the same orientation throughout the full circle. However, the image is upside down. While the current image is a waxing moon (shadow on the left for North America), the image displayed has the shadow on the right. I tried to switch pluses and minuses to make it flip, but I couldn't figure it out. The current image is correct for the view from Australia (waxing with shadow on the right), but upside down for North America. I don't know if it is possible to have a variable to flip the orientation.
You do not have the required permissions to view the files attached to this post.
pbutler6
Posts: 100
Joined: April 27th, 2020, 8:10 pm

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by pbutler6 »

Ah! I just figured it out. The rotate line should be ImageRotate=(180-[SinceMoonrise]/(24*60*60)*360) instead of ImageRotate=(-([SinceMoonrise]/(24*60*60))*360).
User avatar
Yincognito
Rainmeter Sage
Posts: 7031
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by Yincognito »

pbutler6 wrote: August 29th, 2020, 1:08 am Ah! I just figured it out. The rotate line should be ImageRotate=(180-[SinceMoonrise]/(24*60*60)*360) instead of ImageRotate=(-([SinceMoonrise]/(24*60*60))*360).
Ah, yes - glad you figured it out, I couldn't help you with that as I was sleeping at the time, LOL. The reason I didn't set it correctly was because my concern at the time of writing was just to keep the image static from a rotation point of view, and I wasn't aware of how exactly the original image looked like unflipped since I didn't care about it in my skin.

Regarding the rise and set times, I believe we should in fact use the previous and the next rise and set times to be able to solve the issue. The problem is that in the case of weather.com, while the next rise and set times are easily available, the previous rise and set times are not. One needs both to correctly set the arcs having one of their end points not happening "today" and position the sun and moon appropriately on them.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by Mor3bane »

All of that math - Im totally lost...

I would love for perhaps a share at some time, if that is possible?

Perhaps pbutler6's version since his math isn't so far out there :oops:
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
Yincognito
Rainmeter Sage
Posts: 7031
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by Yincognito »

Mor3bane wrote: August 29th, 2020, 5:29 pm All of that math - Im totally lost...

I would love for perhaps a share at some time, if that is possible?

Perhaps pbutler6's version since his math isn't so far out there :oops:
Math? What math? :rolmfao:
Easy peasy lemon squeezy... 8-)

I will probably change a bit the source I get the data from, to be able to get the rise set times from "yesterday", so I can get rid of the "jump" once and for all and do things "by the book". No deadline though, I'll work on it tonight if I'm in the mood (not likely) or tomorrow. Will see if I can simplify the math as well, possibly use Time measures...

P.S. I don't know how you thought you can do rotating the sun and moon on their arcs without math though... :???: I mean, math goes without saying in these kind of scenarios. Be happy that you don't have to actually CALCULATE :o the rise and set times, cause if this seemed complicated for you, then that would have been untouchable, really. I do like some math from time to time (not to often though, LOL) - but I wouldn't think of touching calculating those values, especially when others already did that for folks like us.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by Mor3bane »

Yincognito wrote: August 29th, 2020, 5:52 pm P.S. I don't know how you thought you can do rotating the sun and moon on their arcs without math though... :???:
I never thought that for a second - even with a duped time measure!

I remember earlier in this thread my mentioning the need for math - only that I do not have that trig in my brain like you and pbutler6 do...
My DevArt Gallery

There are many ways to be different - there is only one way to be yourself - be amazing at it

The law of averages says what it means; even if you get everything right, you will get something wrong. Therefore; self managing error trapping initiates another set of averages - amongst the errors, some of them will not be errors, instead those instances will appear to be "luck". One cannot complain of the 'appearance' of 'infinite regress of causation', even if it does not have a predictable pattern, only that it requires luck to achieve.
User avatar
Yincognito
Rainmeter Sage
Posts: 7031
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by Yincognito »

Mor3bane wrote: August 29th, 2020, 11:01 pm I never thought that for a second - even with a duped time measure!

I remember earlier in this thread my mentioning the need for math - only that I do not have that trig in my brain like you and pbutler6 do...
Ah, yes, that's ok, everybody is good at certain things and less so at others - no problem about that. ;-) My point was that I don't see where the math is too complicated in my versions. :confused: I mean, the only place where there is a bit more math is in [SinceSunrise] and [SinceMoonrise], and that's it. Even so, I wrote every piece so one can understand where it comes from, e.g. (24*60*60) instead of plain 86400 and such. Also, when it comes to trigonometry, it's actually pbutler6 that needs the moon having the same direction and thus inverse rotating around its center at the same time as rotating around the "sundial" center, I don't. So, from that point of view, again, I actually do things simpler.

Anyway, that's not important, what's important is that the skins (all of them) work as expected. I finally got some time for approaching the rise set times updates and their influence on the bodies' movements, so I'll probably look to "finish it off" later today. I'm thinking of getting everything from the weather.com's API (similarly to how jsmorley does in its Weather.com skin, albeit grabbing only the rise set times and no actual weather), but take either one or more "previous days" from the astro API in order to have the rise set times of "yesterday", "today" and "tomorrow" for each of the forecast days, including the current day.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather Json [new stuff] Moon Position on a 24 hour Roundline/Rotator ?

Post by balala »

Hello everybody,
Just got home from my holiday. As such, I have to admit I didn't follow closely this topic (and nor any other), so I have to appologise. Accordingly, now my question is if is there anything I can / have to do related to this topic.
Sorry about this...