It is currently December 7th, 2021, 12:10 pm

How to parse this info?

Help with creating, editing & fixing problems with skins
User avatar
LazieWouters
Posts: 61
Joined: August 29th, 2021, 11:11 am

How to parse this info?

Post by LazieWouters »

Hi,

is it possible to parse the information that I marked on the right of the image below: the pixels of the left and top position?
If possible, it is much easier to build something similar: a circle showing the current position of the sun in relation to the terrestrial observer.
Rather than figuring out what the formula that calculates the sun's position using degrees of azimuth and altitude is like (I've been trying this for days, lol), it's much simpler to use a Cartesian system.

The site is here: https://www.suncalc.org/#/-29.2055,-51.4016,12/2021.06.30/10:53/1/3
Untitled-1.png
You do not have the required permissions to view the files attached to this post.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4499
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: How to parse this info?

Post by eclectic-tech »

Sorry, but that info is obtained by a script and does not appear in the HTML code the WebParser has access to read.
The text: <div title="Position of, which contains the values you want, does not exist in the source code.

suncalc.png
You do not have the required permissions to view the files attached to this post.
User avatar
SilverAzide
Rainmeter Sage
Posts: 1674
Joined: March 23rd, 2015, 5:26 pm

Re: How to parse this info?

Post by SilverAzide »

LazieWouters wrote: October 11th, 2021, 8:33 pm Hi,

is it possible to parse the information that I marked on the right of the image below: the pixels of the left and top position?
If possible, it is much easier to build something similar: a circle showing the current position of the sun in relation to the terrestrial observer.
Rather than figuring out what the formula that calculates the sun's position using degrees of azimuth and altitude is like (I've been trying this for days, lol), it's much simpler to use a Cartesian system.

The site is here: https://www.suncalc.org/#/-29.2055,-51.4016,12/2021.06.30/10:53/1/3
Maybe I don't understand your end goal, but if you want to calculate the sun's relative position in the sky (like a sun dial), all you need to know is the sunrise time, the sunset time, and the current time. These I think you already have (from TWC). If instead you are attempting to calculate the sun's elevation above the horizon, and/or the azimuth, that's a lot more complicated, but it is possible with Lua.
Gadgets Wiki GitHub More Gadgets...
User avatar
LazieWouters
Posts: 61
Joined: August 29th, 2021, 11:11 am

Re: How to parse this info?

Post by LazieWouters »

eclectic-tech wrote: October 11th, 2021, 8:59 pm Sorry, but that info is obtained by a script and does not appear in the HTML code the WebParser has access to read.
The text: <div title="Position of, which contains the values you want, does not exist in the source code.

suncalc.png
Thanks for trying, eclectic-tec !!!

SilverAzide wrote: October 11th, 2021, 9:26 pm Maybe I don't understand your end goal, but if you want to calculate the sun's relative position in the sky (like a sun dial), all you need to know is the sunrise time, the sunset time, and the current time. These I think you already have (from TWC). If instead you are attempting to calculate the sun's elevation above the horizon, and/or the azimuth, that's a lot more complicated, but it is possible with Lua.
I think it's probably the second option SilverAzide, lol.
Let's see:
What I currently have is the sun calculation as shown in the figure on the left, and it's based on the AstroWeather skin (by xxenium). This calculation shows only the location of the sun's height/elevation.
I am intending to add something like the figure on the right. The viewer, in the center of the figure, is looking at the sky above him, and can see exactly where the sun and moon are positioned in the sky. If he goes outside and looks at the sky, he will see the sun in quadrant 1 and the moon in quadrant 3, in the exact position shown by the graph.
Untitled-1.png

In 3D (just to clarify better):
Untitled-2.png
You do not have the required permissions to view the files attached to this post.
User avatar
SilverAzide
Rainmeter Sage
Posts: 1674
Joined: March 23rd, 2015, 5:26 pm

Re: How to parse this info?

Post by SilverAzide »

LazieWouters wrote: October 12th, 2021, 11:15 am I think it's probably the second option SilverAzide, lol.
Let's see:
What I currently have is the sun calculation as shown in the figure on the left, and it's based on the AstroWeather skin (by xxenium). This calculation shows only the location of the sun's height/elevation.
I am intending to add something like the figure on the right. The viewer, in the center of the figure, is looking at the sky above him, and can see exactly where the sun and moon are positioned in the sky. If he goes outside and looks at the sky, he will see the sun in quadrant 1 and the moon in quadrant 3, in the exact position shown by the graph.
OK, I see... well, you sure do like challenges, don't you? ;) Fortunately, you might be in luck. There are a few folks who have tackled this already. You might want to look at skins by Mordasius. He's done quite a number of steampunk-style skins that show sun and moon positions, and the code in some of them include the azimuth and elevations you need. Another source are the astro skins by buckb here on the forums. He's created some amazing skins, including some with code you can use to calculate just about anything, including positions of certain stars.

However, the simplest and easiest code to adapt is probably from raiguard's ModernGadgets 1.6.3 weather skin. Unfortunately, this skin no longer works since it uses the DarkSky API which is no longer available to new users, and more unfortunately, he removed all the sun/moon functionality from the later versions that do work. But what you want is the Lua script in the package. It has clearly defined and easily usable functions for calculating the positions of the sun and moon. There will be slight deviations from what is shown on SunCalc.org and MoonCalc.org, but it is about as accurate as any skin you can find.

Lastly, you might want to look at my Weather Meter skin in the Gadgets suite. The Lua script is a combination of Mordasius' code, raiguard's code, and Mordasius' mods of raiguard's code, and my mods of all of the above. I removed the sun positioning code from raiguard's script in mine since I didn't need it, but the moon code you need is in there.
Gadgets Wiki GitHub More Gadgets...
User avatar
LazieWouters
Posts: 61
Joined: August 29th, 2021, 11:11 am

Re: How to parse this info?

Post by LazieWouters »

SilverAzide wrote: October 12th, 2021, 12:03 pm OK, I see... well, you sure do like challenges, don't you? ;) Fortunately, you might be in luck. There are a few folks who have tackled this already. You might want to look at skins by Mordasius. He's done quite a number of steampunk-style skins that show sun and moon positions, and the code in some of them include the azimuth and elevations you need. Another source are the astro skins by buckb here on the forums. He's created some amazing skins, including some with code you can use to calculate just about anything, including positions of certain stars.

However, the simplest and easiest code to adapt is probably from raiguard's ModernGadgets 1.6.3 weather skin. Unfortunately, this skin no longer works since it uses the DarkSky API which is no longer available to new users, and more unfortunately, he removed all the sun/moon functionality from the later versions that do work. But what you want is the Lua script in the package. It has clearly defined and easily usable functions for calculating the positions of the sun and moon. There will be slight deviations from what is shown on SunCalc.org and MoonCalc.org, but it is about as accurate as any skin you can find.

Lastly, you might want to look at my Weather Meter skin in the Gadgets suite. The Lua script is a combination of Mordasius' code, raiguard's code, and Mordasius' mods of raiguard's code, and my mods of all of the above. I removed the sun positioning code from raiguard's script in mine since I didn't need it, but the moon code you need is in there.
Muito obrigado pela ajuda amigo! (Thank you very much for your help friend!)
I'm going to dive into these skins until I understand how to do it!
User avatar
LazieWouters
Posts: 61
Joined: August 29th, 2021, 11:11 am

Re: How to parse this info?

Post by LazieWouters »

SilverAzide wrote: October 12th, 2021, 12:03 pm OK, I see... well, you sure do like challenges, don't you? ;) Fortunately, you might be in luck. There are a few folks who have tackled this already. You might want to look at skins by Mordasius. He's done quite a number of steampunk-style skins that show sun and moon positions, and the code in some of them include the azimuth and elevations you need. Another source are the astro skins by buckb here on the forums. He's created some amazing skins, including some with code you can use to calculate just about anything, including positions of certain stars.

However, the simplest and easiest code to adapt is probably from raiguard's ModernGadgets 1.6.3 weather skin. Unfortunately, this skin no longer works since it uses the DarkSky API which is no longer available to new users, and more unfortunately, he removed all the sun/moon functionality from the later versions that do work. But what you want is the Lua script in the package. It has clearly defined and easily usable functions for calculating the positions of the sun and moon. There will be slight deviations from what is shown on SunCalc.org and MoonCalc.org, but it is about as accurate as any skin you can find.

Lastly, you might want to look at my Weather Meter skin in the Gadgets suite. The Lua script is a combination of Mordasius' code, raiguard's code, and Mordasius' mods of raiguard's code, and my mods of all of the above. I removed the sun positioning code from raiguard's script in mine since I didn't need it, but the moon code you need is in there.
Finally I started to get some results to display the position of the sun and moon in a circular diagram (north, south, east and west) as the image in one of my previous posts.
Right now I'm using a library called CoordinateSharp, which helps me get a lot of information about the sun and moon, from values like latitude, longitude, time, and many other input possibilities.
Even so, I needed help from someone with more experience for the final part, which is to calculate the x and y position (lots of trigonometry!!!), with code in C#. And that's the bad part for now, because it's a lot of stuff done separately in another language and not with Rainmeter and Lua scripts, and I think it starts to not be a Rainmeter skin anymore, I'm not sure.
There's still a lot to do, and when I have something more conclusive, I'll publish it again here.
User avatar
SilverAzide
Rainmeter Sage
Posts: 1674
Joined: March 23rd, 2015, 5:26 pm

Re: How to parse this info?

Post by SilverAzide »

It should be possible to convert the C# to Lua, as long as it is just math. Otherwise, you can turn the C# code into a plugin; this would be a very interesting exercise. Hmm. The code seems pretty accurate, the results are very close to SunCalc.org and MoonCalc.org (assuming either of those is a definitive source).
Gadgets Wiki GitHub More Gadgets...