It is currently April 19th, 2024, 8:38 am

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

Get help with creating, editing & fixing problems with skins
User avatar
Mor3bane
Posts: 943
Joined: May 7th, 2016, 7:32 am

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

Post by Mor3bane »

Hello,

So I was wondering if the new weather Json configs can be used to position the moon on the 24 hour 'dial' in accordance to the sun position?

So here is my little Skin for reference. It doesnt use jsmorley's settings file so the lat and long have to be edited into the variables ini manually. Or just use my location - anyway, is it possible?
Solar Time_0xx.0xx.rmskin
You do not have the required permissions to view the files attached to this post.
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
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

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

Post by jsmorley »

I have not done anything with the detailed "astro" stuff from the API yet.

It wouldn't be hard to parse from:

https://api.weather.com/v2/astro?apiKey=6532d6454b8aa370768e63d6ba5a832e&geocode=37.26%2C-122.03&days=15&date=20200821&format=json

Change the &days=15 to whatever you need, and the "starting" &date to the current YYYYMMDD.

This does return both degrees and radians, which is a nice fit for Roundline / Rotator.

While pretty simple to parse, I caution that getting all of this detailed data for say 15 days is going to be a bunch of data...

Having said that, there are apparently some standard ways to "calculate" these values without parsing a remote site. I have in no way even looked at that, but I think balala has a solution.
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 »

jsmorley wrote: August 21st, 2020, 1:00 pm I have not done anything with the detailed "astro" stuff from the API yet.

It wouldn't be hard to parse from:

https://api.weather.com/v2/astro?apiKey=6532d6454b8aa370768e63d6ba5a832e&geocode=37.26%2C-122.03&days=15&date=20200821&format=json

Change the &days=15 to whatever you need, and the "starting" &date to the current YYYYMMDD.

This does return both degrees and radians, which is a nice fit for Roundline / Rotator.

While pretty simple to parse, I caution that getting all of this detailed data for say 15 days is going to be a bunch of data...

Having said that, there are apparently some standard ways to "calculate" these values without parsing a remote site. I have in no way even looked at that, but I think balala has a solution.
Thanks, that's a start.

Xenium does the hemispherical version, but I am hoping to get the position for a 'full sphere' so to speak - to match the 24 hour sun position of my Solar TIme skin. Ideally both would appear on the same 24 hour 'dial'.

Best part is the sun is easy since time is based on the sun. But The position of the moon relative to the time (anywhere really) would be the real try. Only the bearing on it if it was relative to the day cycle or the night cycle.
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
balala
Rainmeter Sage
Posts: 16144
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 »

jsmorley wrote: August 21st, 2020, 1:00 pm Having said that, there are apparently some standard ways to "calculate" these values without parsing a remote site. I have in no way even looked at that, but I think balala has a solution.
Many thanks for the trust. Unfortunately (or fortunately for me) I'm spending my holiday, so can't help right now, but if still will be needed, I'll be happy to help, if I can, on the first day of September.
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
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 »

Yeah, I don't think this is easy or even possible in a 2D system (like a 24h 'dial'), since these positions happen in a 3D system (space, sky, whatever), after all. You might take a look at TimeAndDate Night Astronomy though, maybe that helps. :confused:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
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 »

Here is my skin to display a view of the sun and moon for both day and night. This is part of a larger skin, so I don't have a fancy background.

This skin uses the Weather Underground site because it is pulling some fields that are not included in JSMorley's WeatherComJSONMoon file. I would expect that his file can be modified to include these extra data items.

At times this skin requires sun and moon data from yesterday. I have not been able to find an easy on-line source for this, so I have calculated estimates of the required data. My estimates are normally off by only a couple of minutes, but there may be a way to download this data directly.

Is this what you are looking for?
Sun & Moon_1.0.rmskin
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
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 22nd, 2020, 1:30 am Here is my skin to display a view of the sun and moon for both day and night. This is part of a larger skin, so I don't have a fancy background.

This skin uses the Weather Underground site because it is pulling some fields that are not included in JSMorley's WeatherComJSONMoon file. I would expect that his file can be modified to include these extra data items.

At times this skin requires sun and moon data from yesterday. I have not been able to find an easy on-line source for this, so I have calculated estimates of the required data. My estimates are normally off by only a couple of minutes, but there may be a way to download this data directly.

Is this what you are looking for?

Sun & Moon_1.0.rmskin
That's a very nice looking skin - probably just what Mor3bane is looking for. I guess my idea of what a 24h 'dial' between the Sun and the Moon would mean from my previous reply was way off, LOL. :oops:
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 22nd, 2020, 1:30 am Here is my skin to display a view of the sun and moon for both day and night. This is part of a larger skin, so I don't have a fancy background.

This skin uses the Weather Underground site because it is pulling some fields that are not included in JSMorley's WeatherComJSONMoon file. I would expect that his file can be modified to include these extra data items.

At times this skin requires sun and moon data from yesterday. I have not been able to find an easy on-line source for this, so I have calculated estimates of the required data. My estimates are normally off by only a couple of minutes, but there may be a way to download this data directly.

Is this what you are looking for?

Sun & Moon_1.0.rmskin
First off, that looks awesome!

I will really enjoy figuring it out and incorporating it into my skin style.

I really appreciate you sharing your great code! :thumbup:
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
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 »

Hey Yincognito,

I am hoping your math skills might help me here.

There is this line of pbutler6's code describes how a shape traverses a semi circle.

Code: Select all

Shape=Ellipse ((#size#*12.5)+(#size#*200)*[SinceSunrise]),((#size#*25)*(Abs([SinceSunrise]-0.5))+(#size#*12.5)*(1-Abs(2*[SinceSunrise]-1.2))-(#size#*100)*Sin(Acos(2*[SinceSunrise]-1))),(#size#*12.5) | StrokeWidth (#size#*0.5) | Stroke Color 255,120,0 | Fill RadialGradient SunDayGradient
Well extrapolating from that and setting a start position like so:

Code: Select all

[MoonDay]
Meter=Rotator
MeasureName=SinceMoonrise
ImageName=#@#moon.png
X=0
Y=0
W=350
H=350
ImageTint=
StartAngle=(RAD(225))
RotationAngle=???
ValueReminder=???
OffsetX=90
OffsetY=90
Hidden=0
What would the RAD version of all the cos sin abs Acos stuff be? Also presuming that there are a fairly wide array of measures that capture moonrise, moonset, and similar quantifiers.

And, do I really need a ValueRemainder, and if so what would it be set to?

Thanks as always.
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: 7125
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 22nd, 2020, 2:04 pm Hey Yincognito,

I am hoping your math skills might help me here.

There is this line of pbutler6's code describes how a shape traverses a semi circle.

Code: Select all

Shape=Ellipse ((#size#*12.5)+(#size#*200)*[SinceSunrise]),((#size#*25)*(Abs([SinceSunrise]-0.5))+(#size#*12.5)*(1-Abs(2*[SinceSunrise]-1.2))-(#size#*100)*Sin(Acos(2*[SinceSunrise]-1))),(#size#*12.5) | StrokeWidth (#size#*0.5) | Stroke Color 255,120,0 | Fill RadialGradient SunDayGradient
Well extrapolating from that and setting a start position like so:

Code: Select all

[MoonDay]
Meter=Rotator
MeasureName=SinceMoonrise
ImageName=#@#moon.png
X=0
Y=0
W=350
H=350
ImageTint=
StartAngle=(RAD(225))
RotationAngle=???
ValueReminder=???
OffsetX=90
OffsetY=90
Hidden=0
What would the RAD version of all the cos sin abs Acos stuff be? Also presuming that there are a fairly wide array of measures that capture moonrise, moonset, and similar quantifiers.

And, do I really need a ValueRemainder, and if so what would it be set to?

Thanks as always.
Thanks for the trust, but maybe the designers of the skin are better suited to explain what's happening there. Personally, I find it natural to have sin() or cos() in setting the CenterY of the ellipse, but I'm a bit surprised that there aren't any of those in the CenterX formula - so that's something I don't quite understand, maybe folks wanted to simplify things there, but IMHO it's wrong from a mathematical point of view (could be mistaken though).

Anyway, to get to the point, [SinceSunrise] is basically a percentual value (i.e. ranging from 0.00 to 1.00, with 0.50 meaning 50%) expressing how much time passed since sunrise, and this is obvious from its formula in the posted skin. Thus, nothing else should be needed for a Rotator to place the image, other than the value of the measure. To better visualize that, take a look at this basic sample, where #TimeNowStamp# (in that skin, this is a measure instead of a variable, and the values are obviously time based unlike in my sample) ranges from #Sunrise# to #Sunset# over and over again...

Code:

Code: Select all

[Variables]
Sunrise=0
Sunset=100
TimeNowStamp=0

[Rainmeter]
Update=25
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=47,47,247,255

---Measures---

[SinceSunrise]
Paused=1
Measure=Calc
Formula=((#TimeNowStamp#-#Sunrise#)/(#Sunset#-#Sunrise#))
OnUpdateAction=[!SetVariable TimeNowStamp ((#TimeNowStamp#+1)%(#Sunset#-#Sunrise#))]
DynamicVariables=1

---Meters---

[SunDay]
Meter=Rotator
MeasureName=SinceSunrise
ImageName=#@#a.png
X=0
Y=0
W=350
H=350
StartAngle=(RAD(225))
OffsetX=90
OffsetY=90
Hidden=0
LeftMouseUpAction=[!TogglePauseMeasure "SinceSunrise"]
MiddleMouseUpAction=[!UnpauseMeasure "SinceSunrise"][!SetVariable TimeNowStamp 0][!UpdateMeasure "SinceSunrise"][!UpdateMeter *][!Redraw][!PauseMeasure "SinceSunrise"]
DynamicVariables=1
Image (placed in the @Resources folder):
a.png
I believe this works similarly for the moon.

Can't say much about ValueRemainder though, as I never worked with it, but from the looks of it, it indeed wouldn't be needed here, as I suppose all these variables have values based on the number of seconds, and you're not drawing an actual clock to need the remainders, you're only interested in how those seconds differences relate to each other in terms of percents.

EDIT: If we're only rotating things on a semicircle instead of a full circle, then obviously RotationAngle must be set to PI instead of the default PI*2.
You do not have the required permissions to view the files attached to this post.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth