It is currently March 29th, 2024, 9:21 am

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: 7029
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: September 3rd, 2020, 10:26 am I'm glad to hear it's in the works. :) I'm still working to get the rotator part working the way I want (I'm also trying for perfection).
But I though the rotator part was done like you wanted, based on your previous replies. :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 »

Oh, there are always things to change. I made the Arcs independent of the Image size -

Code: Select all

[UpArc]
Meter=Roundline
W=(#ImageW#+#Radius#*2)
H=(#ImageW#+#Radius#*2)
becomes

Code: Select all

[UpArc]
Meter=Roundline
W=(#Radius#*2)
H=(#Radius#*2)
and

Code: Select all

[Moon]
Meter=Rotator
MeasureName=SinceMoonrise
ImageName=#@#Moon.png
X=(#Radius#)
Y=(#Radius#)
W=(#ImageW#)
H=(#ImageW#)
OffsetX=(-(#Radius#-#ImageW#/2))
OffsetY=(#ImageW#/2)
StartAngle=(PI)
RotationAngle=(PI*2)
DynamicVariables=1
becomes

Code: Select all

[Moon]
Meter=Rotator
MeasureName=SinceMoonrise
ImageName=#@#Moon.png
ImageRotate=(180-[SinceMoonrise]/(24*60*60)*360)
X=(#Radius#*1.25-#ImageW#/2)
Y=(#Radius#*1.25-#ImageW#/2)
W=(#ImageW#)
H=(#ImageW#)
OffsetX=(-(#Radius#-#ImageW#/2-Abs(Sin(([SinceMoonrise]/(24*60*60))*PI*2*2))*(Sqrt(#ImageW#**2*2)/2-#ImageW#/2)))
OffsetY=           (#ImageW#/2+Abs(Sin(([SinceMoonrise]/(24*60*60))*PI*2*2))*(Sqrt(#ImageW#**2*2)/2-#ImageW#/2))
StartAngle=(PI)
RotationAngle=(PI*2)
DynamicVariables=1
Then things to simplify:

Code: Select all

[SinceSunrise]
Group=IntervalsGroup
Measure=Calc
Formula=((((((24*60*60)+#Nowtime#-#Sunrise#)%(24*60*60))*((12*60*60)/[Suntime]))>=(12*60*60))?(((12*60*60))+((((24*60*60)+#Nowtime#-#Sunset#)%(24*60*60))*((12*60*60)/((24*60*60)-[Suntime])))):((((24*60*60)+#Nowtime#-#Sunrise#)%(24*60*60))*((12*60*60)/[Suntime])))
MaxValue=(24*60*60)
DynamicVariables=1
Becomes:

Code: Select all

[SinceSunrise]
Measure=Calc
Formula= #Sunup#=1 ? (TimeNowStamp-#Sunrise#)/(#Sunset#-#Sunrise#)/2 :(0.5+(TimeNowStamp-#Sunset#)/(#Sunrise#-#Sunset#)/2)
Group=Sun&Moon
Disabled=1
DynamicVariables=1
and the moon meter becomes:

Code: Select all

[Moon]
Meter=Rotator
MeasureName=SinceMoonrise
ImageName=#@#\Moon Images\m[MoonImage]-#ImageM#.png
ImageRotate=(180-[SinceMoonrise]*360)
ImageTint=(255-#Tint#+#Moonup#*#Tint#),(255-#Tint#+#Moonup#*#Tint#),(255-#Tint#+#Moonup#*#Tint#)
X=(#size#*#XCenter#+#Radius#-#ImageM#/2)
Y=(#size#*#YCenter#+#Radius#-#ImageM#/2)
W=(#ImageM#)
H=(#ImageM#)
OffsetX= (-#Radius#+#ImageM#/2+Abs(Sin([SinceMoonrise]*PI*2*2))*(Sqrt(#ImageM#**2*2)/2-#ImageM#/2))
OffsetY=           (#ImageM#/2+Abs(Sin([SinceMoonrise]*PI*2*2))*(Sqrt(#ImageM#**2*2)/2-#ImageM#/2))
StartAngle=(PI)
RotationAngle=(PI*2)
DynamicVariables=1
to flip the moon image upright, to change the moon image to the current phase daily, to allow the size on the moon image to be changed, and to have the moon darken on the lower arc.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
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: September 3rd, 2020, 1:40 pmOh, there are always things to change.
Good changes, indeed - some of them obviously suit your needs (like inverse rotating to keep the moon image static when travelling the arc), and some of them very nice approaches to simplification (like the since sunrise / moonrise formulas, which were already simplified in a similar manner in your original code, if I'm not mistaken).

However:
pbutler6 wrote: September 3rd, 2020, 1:40 pm[...] I made the Arcs independent of the Image size [...]
That's ok, a different approach and you probably had your reasons, but that #ImageW# was there just to ensure a "padding" of (#ImageW#/2) on each side of the arc, in order for the rotated sun and moon images to fit within the coordinates of the arc meters (which is basically also used as a "background" in my version). So, if by any chance you did that to allow images of a different size to be used as sun and moon images in the Rotators, I don't believe this modification was absolutely required (unless, of course, you had other reasons for it).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
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 »

Some good news, if anyone is interested: today I approached the sundial thing from a slightly different perspective, and made the whole thing work as I wanted to (it will need some small changes to work for the poles as well, but at least this approach permits it). Still have to correct some minor inconsistencies related to the "timelapse" I use, but later today I'll post the result. ;-)
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
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 »

So, this is the rewritten version of the skin here, without any "jumps" and such whatsoever...

Skin:
SunDial24H_2.0.0.rmskin
Code:

Code: Select all

[Variables]
UpdateRate=3600
Lat=51.50
Lon=-0.12
Days=15
APIKey=6532d6454b8aa370768e63d6ba5a832e
AstroURL=https://api.weather.com/v2/astro?geocode=#Lat#,#Lon#&days=[&RiseSetDays]&date=[&PrevDate]&format=json&apiKey=#APIKey#
Extractor='(?siU)^.*(?:".*"[,\]]){0,[#Index]}+(".*")[,\]].*$':"_\1_"
Cleaner="(?:^[^_].*|.*[^_]$)":"","(?:^_|_$)":"","(?:^\\\d+|\\\d+$)":"","(?:^\s+|\s+$)":"",'(?:^"|"$)':""
Defaulter="(?:^$|^null$|^N\/A$|^.*doesn't exist.*$)":"1601-01-01T00:00:00.000+00:00"
ExtractorE='(?siU)^.*(?:.*[,\]]){0,[#Index]}+(.*)[,\]].*$':"_\1_"
Index=0
Day=1

NowEvent=0
SunItems=""
SunEvent0=0
SunEvent1=0
SunUp=0
MoonItems=""
MoonEvent0=0
MoonEvent1=0
MoonUp=0

Update=25
NTStep=300

Radius=95
ImageW=32
DialSW=2

[Rainmeter]
Update=#Update#
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=0,0,0,80

---Measures Time---

[RiseSetDays]
Measure=Calc
Formula=(1+#Days#+1)
UpdateDivider=(#UpdateRate#*1000/#Update#)
DynamicVariables=1

[CurrDate]
Measure=Time
UpdateDivider=(#UpdateRate#*1000/#Update#)
DynamicVariables=1

[PrevDate]
Measure=Time
TimeStamp=([CurrDate:TimeStamp]-(24*60*60))
Format=%Y%m%d
UpdateDivider=(#UpdateRate#*1000/#Update#)
DynamicVariables=1

---Measures Counter---

[CounterTimeStamp]
Disabled=1
Measure=Calc
Formula=((CounterTimeStamp+#NTStep#)%(#Days#*(24*60*60)))
OnUpdateAction=[!SetVariable Day (Trunc([CounterTimeStamp]/(24*60*60))+1)]
DynamicVariables=1

---Measures Astro---

[Astro]
Measure=WebParser
Url=#AstroURL#
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36
RegExp=^.*$
UpdateRate=(#UpdateRate#*1000/#Update#)
FinishAction=[!UpdateMeasureGroup "AstroGroup"][!UpdateMeasureGroup "ItemsGroup"][!UpdateMeasureGroup "NowGroup"][!UpdateMeasureGroup "EventsGroup"][!UpdateMeasureGroup "IntervalsGroup"][!UpdateMeter *][!Redraw]
OnConnectErrorAction=[!UpdateMeasureGroup "AstroGroup"][!UpdateMeasureGroup "ItemsGroup"][!UpdateMeasureGroup "NowGroup"][!UpdateMeasureGroup "EventsGroup"][!UpdateMeasureGroup "IntervalsGroup"][!UpdateMeter *][!Redraw]
OnRegExpErrorAction=[!UpdateMeasureGroup "AstroGroup"][!UpdateMeasureGroup "ItemsGroup"][!UpdateMeasureGroup "NowGroup"][!UpdateMeasureGroup "EventsGroup"][!UpdateMeasureGroup "IntervalsGroup"][!UpdateMeter *][!Redraw]
DynamicVariables=1

[Sunrises]
Group=AstroGroup
Measure=String
String=[Astro]
UpdateDivider=-1
RegExpSubstitute=1
Substitute='(?siU)(?:(?:^|,).*(?:"sun":\{"riseSet":\{.*"riseLocal":(?=".*")|$))':",","^,":"[",",$":"]"
DynamicVariables=1

[Sunsets]
Group=AstroGroup
Measure=String
String=[Astro]
UpdateDivider=-1
RegExpSubstitute=1
Substitute='(?siU)(?:(?:^|,).*(?:"sun":\{"riseSet":\{.*"setLocal":(?=".*")|$))':",","^,":"[",",$":"]"
DynamicVariables=1

[Moonrises]
Group=AstroGroup
Measure=String
String=[Astro]
UpdateDivider=-1
RegExpSubstitute=1
Substitute='(?siU)(?:(?:^|,).*(?:"moon":\{"riseSet":\{.*"riseLocal":(?=".*")|$))':",","^,":"[",",$":"]"
DynamicVariables=1

[Moonsets]
Group=AstroGroup
Measure=String
String=[Astro]
UpdateDivider=-1
RegExpSubstitute=1
Substitute='(?siU)(?:(?:^|,).*(?:"moon":\{"riseSet":\{.*"setLocal":(?=".*")|$))':",","^,":"[",",$":"]"
DynamicVariables=1

---Measures Items---

[ResetItems]
Group=ItemsGroup
Measure=Calc
UpdateDivider=-1
OnUpdateAction=[!SetVariable SunItems ""][!SetVariable MoonItems ""]
DynamicVariables=1

[SunriseItem]
Group=ItemsGroup | SunItemsGroup
Measure=String
String=[Sunrises]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#"
DynamicVariables=1

[SunriseItemTime]
Group=ItemsGroup | SunItemsGroup
Measure=Time
TimeStamp=[SunriseItem]
TimeStampFormat=%Y-%m-%dT%H:%M:%S
Format=%Y-%m-%dT%H:%M:%S
UpdateDivider=-1
DynamicVariables=1

[SunsetItem]
Group=ItemsGroup | SunItemsGroup
Measure=String
String=[Sunsets]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#"
DynamicVariables=1

[SunsetItemTime]
Group=ItemsGroup | SunItemsGroup
Measure=Time
TimeStamp=[SunsetItem]
TimeStampFormat=%Y-%m-%dT%H:%M:%S
Format=%Y-%m-%dT%H:%M:%S
UpdateDivider=-1
IfCondition=(#Index#<(1+#Days#+1)) && ([SunriseItemTime:TimeStamp]<=[SunsetItemTime:TimeStamp])
IfTrueAction=[!SetVariable SunItems "#SunItems#AM [SunriseItemTime],PM [SunsetItemTime],"]
IfCondition2=(#Index#<(1+#Days#+1)) && ([SunriseItemTime:TimeStamp]>[SunsetItemTime:TimeStamp])
IfTrueAction2=[!SetVariable SunItems "#SunItems#PM [SunsetItemTime],AM [SunriseItemTime],"]
IfCondition3=(#Index#<(1+#Days#+1))
IfTrueAction3=[!SetVariable Index (#Index#+1)][!UpdateMeasureGroup SunItemsGroup]
IfFalseAction3=[!SetVariable Index 0]
IfConditionMode=1
DynamicVariables=1

[MoonriseItem]
Group=ItemsGroup | MoonItemsGroup
Measure=String
String=[Moonrises]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#"
DynamicVariables=1

[MoonriseItemTime]
Group=ItemsGroup | MoonItemsGroup
Measure=Time
TimeStamp=[MoonriseItem]
TimeStampFormat=%Y-%m-%dT%H:%M:%S
Format=%Y-%m-%dT%H:%M:%S
UpdateDivider=-1
DynamicVariables=1

[MoonsetItem]
Group=ItemsGroup | MoonItemsGroup
Measure=String
String=[Moonsets]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#"
DynamicVariables=1

[MoonsetItemTime]
Group=ItemsGroup | MoonItemsGroup
Measure=Time
TimeStamp=[MoonsetItem]
TimeStampFormat=%Y-%m-%dT%H:%M:%S
Format=%Y-%m-%dT%H:%M:%S
UpdateDivider=-1
IfCondition=(#Index#<(1+#Days#+1)) && ([MoonriseItemTime:TimeStamp]<=[MoonsetItemTime:TimeStamp])
IfTrueAction=[!SetVariable MoonItems "#MoonItems#AM [MoonriseItemTime],PM [MoonsetItemTime],"]
IfCondition2=(#Index#<(1+#Days#+1)) && ([MoonriseItemTime:TimeStamp]>[MoonsetItemTime:TimeStamp])
IfTrueAction2=[!SetVariable MoonItems "#MoonItems#PM [MoonsetItemTime],AM [MoonriseItemTime],"]
IfCondition3=(#Index#<(1+#Days#+1))
IfTrueAction3=[!SetVariable Index (#Index#+1)][!UpdateMeasureGroup MoonItemsGroup]
IfFalseAction3=[!SetVariable Index 0]
IfConditionMode=1
DynamicVariables=1

---Measures Now---

[NowTime]
Group=NowGroup
Measure=Time
Format=%Y-%m-%d %H:%M:%S
IfCondition=(([NowTime:TimeStamp]>=#SunEvent1#) && (#SunEvent1#>0)) || (([NowTime:TimeStamp]>=#MoonEvent1#) && (#MoonEvent1#>0)) || (([NowTime:TimeStamp]-[NowTime:TimeStamp]%(24*60*60))<>(#NowEvent#-#NowEvent#%(24*60*60)))
IfTrueAction=[!SetVariable NowEvent [NowTime:TimeStamp]][!UpdateMeasureGroup EventsGroup]
IfFalseAction=[!SetVariable NowEvent [NowTime:TimeStamp]]
IfConditionMode=1
DynamicVariables=1

---Measures Events---

[SunEvent]
Group=EventsGroup | SunEventsGroup
Measure=String
String=#SunItems#
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#ExtractorE#,"#Cleaner#","#Defaulter#"
DynamicVariables=1

[SunEventTime]
Group=EventsGroup | SunEventsGroup
Measure=Time
TimeStamp=[SunEvent]
TimeStampFormat=%p %Y-%m-%dT%H:%M:%S
Format=%Y-%m-%dT%H:%M:%S
UpdateDivider=-1
IfCondition=([SunEventTime:TimeStamp]<=[NowTime:TimeStamp]) && (#Index#<((1+#Days#+1)*2-1))
IfTrueAction=[!SetVariable SunEvent0 [SunEventTime:TimeStamp]][!SetVariable Index (#Index#+1)][!UpdateMeasureGroup SunEventsGroup]
IfFalseAction=[!SetVariable SunEvent1 [SunEventTime:TimeStamp]][!SetVariable Index 0]
IfConditionMode=1
DynamicVariables=1

[SunUp]
Group=EventsGroup
Measure=String
String=[SunEvent]
UpdateDivider=-1
OnUpdateAction=[!SetVariable SunUp [SunUp]]
RegExpSubstitute=1
Substitute="^AM .*$":"0","^PM .*$":"1"
DynamicVariables=1

[MoonEvent]
Group=EventsGroup | MoonEventsGroup
Measure=String
String=#MoonItems#
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#ExtractorE#,"#Cleaner#","#Defaulter#"
DynamicVariables=1

[MoonEventTime]
Group=EventsGroup | MoonEventsGroup
Measure=Time
TimeStamp=[MoonEvent]
TimeStampFormat=%p %Y-%m-%dT%H:%M:%S
Format=%Y-%m-%dT%H:%M:%S
UpdateDivider=-1
IfCondition=([MoonEventTime:TimeStamp]<=[NowTime:TimeStamp]) && (#Index#<((1+#Days#+1)*2-1))
IfTrueAction=[!SetVariable MoonEvent0 [MoonEventTime:TimeStamp]][!SetVariable Index (#Index#+1)][!UpdateMeasureGroup MoonEventsGroup]
IfFalseAction=[!SetVariable MoonEvent1 [MoonEventTime:TimeStamp]][!SetVariable Index 0]
IfConditionMode=1
DynamicVariables=1

[MoonUp]
Group=EventsGroup
Measure=String
String=[MoonEvent]
UpdateDivider=-1
OnUpdateAction=[!SetVariable MoonUp [MoonUp]]
RegExpSubstitute=1
Substitute="^AM .*$":"0","^PM .*$":"1"
DynamicVariables=1

---Measures Additional Events---

[SunEvent0Time]
Group=EventsGroup
Measure=Time
TimeStamp=#SunEvent0#
Format=%Y-%m-%d %H:%M:%S
UpdateDivider=-1
DynamicVariables=1

[SunEvent1Time]
Group=EventsGroup
Measure=Time
TimeStamp=#SunEvent1#
Format=%Y-%m-%d %H:%M:%S
UpdateDivider=-1
DynamicVariables=1

[MoonEvent0Time]
Group=EventsGroup
Measure=Time
TimeStamp=#MoonEvent0#
Format=%Y-%m-%d %H:%M:%S
UpdateDivider=-1
DynamicVariables=1

[MoonEvent1Time]
Group=EventsGroup
Measure=Time
TimeStamp=#MoonEvent1#
Format=%Y-%m-%d %H:%M:%S
UpdateDivider=-1
DynamicVariables=1

[DayIndex]
Group=EventsGroup
Measure=Calc
UpdateDivider=-1
OnUpdateAction=[!SetVariable Index #Day#]
DynamicVariables=1

[Sunrise]
Group=EventsGroup
Measure=String
String=[Sunrises]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#","(?siU)^.*(\d{2}:\d{2}:\d{2}).*$":"\1"
DynamicVariables=1

[Sunset]
Group=EventsGroup
Measure=String
String=[Sunsets]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#","(?siU)^.*(\d{2}:\d{2}:\d{2}).*$":"\1"
DynamicVariables=1

[Moonrise]
Group=EventsGroup
Measure=String
String=[Moonrises]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#","(?siU)^.*(\d{2}:\d{2}:\d{2}).*$":"\1"
DynamicVariables=1

[Moonset]
Group=EventsGroup
Measure=String
String=[Moonsets]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#","(?siU)^.*(\d{2}:\d{2}:\d{2}).*$":"\1"
DynamicVariables=1

[ResetIndex]
Group=EventsGroup
Measure=Calc
UpdateDivider=-1
OnUpdateAction=[!SetVariable Index 0]
DynamicVariables=1

---Measures Intervals---

[SinceSunEvent]
Group=IntervalsGroup
Measure=Calc
Formula=(((#SunUp#=1)?(0):(0.5))+(#NowEvent#-#SunEvent0#)/(#SunEvent1#-#SunEvent0#)/2)
DynamicVariables=1

[SinceMoonEvent]
Group=IntervalsGroup
Measure=Calc
Formula=(((#MoonUp#=1)?(0):(0.5))+(#NowEvent#-#MoonEvent0#)/(#MoonEvent1#-#MoonEvent0#)/2)
DynamicVariables=1

[SinceDayEvent]
Group=IntervalsGroup
Measure=Calc
Formula=(#NowEvent#%(24*60*60))/(24*60*60)
DynamicVariables=1

---Meters---

[UpArc]
Meter=Roundline
W=(#ImageW#+#Radius#*2)
H=(#ImageW#+#Radius#*2)
StartAngle=(PI)
RotationAngle=(PI)
LineStart=(#Radius#-#DialSW#/2)
LineLength=(#Radius#+#DialSW#/2)
LineColor=255,255,255,255
Solid=1
AntiAlias=1
DynamicVariables=1

[DownArc]
Meter=Roundline
W=(#ImageW#+#Radius#*2)
H=(#ImageW#+#Radius#*2)
StartAngle=(0)
RotationAngle=(PI)
LineStart=(#Radius#-#DialSW#/2)
LineLength=(#Radius#+#DialSW#/2)
LineColor=96,96,96,255
Solid=1
AntiAlias=1
DynamicVariables=1

[Sun]
Meter=Rotator
MeasureName=SinceSunEvent
ImageName=#@#Sun.png
X=(#Radius#)
Y=(#Radius#)
W=(#ImageW#)
H=(#ImageW#)
OffsetX=(-(#Radius#-#ImageW#/2))
OffsetY=(#ImageW#/2)
StartAngle=(PI)
RotationAngle=(PI*2)
DynamicVariables=1

[Moon]
Meter=Rotator
MeasureName=SinceMoonEvent
ImageName=#@#Moon.png
X=(#Radius#)
Y=(#Radius#)
W=(#ImageW#)
H=(#ImageW#)
OffsetX=(-(#Radius#-#ImageW#/2))
OffsetY=(#ImageW#/2)
StartAngle=(PI)
RotationAngle=(PI*2)
DynamicVariables=1

[Earth]
Meter=Rotator
MeasureName=SinceDayEvent
ImageName=#@#Earth.png
X=(#Radius#)
Y=(#Radius#)
W=(#ImageW#)
H=(#ImageW#)
OffsetX=(#ImageW#/2)
OffsetY=(#ImageW#/2)
StartAngle=(0)
RotationAngle=(PI*2)
LeftMouseUpAction=[!SetVariable Index 0][!SetVariable Day 1][!ToggleMeasure CounterTimeStamp][!UpdateMeasure CounterTimeStamp][!SetOption NowTime TimeStamp """(([*CurrDate:TimeStamp*]-[*CurrDate:TimeStamp*]%(24*60*60))+[*CounterTimeStamp*])"""][!UpdateMeasureGroup "NowGroup"][!UpdateMeasureGroup "EventsGroup"][!UpdateMeter *][!Redraw]
DynamicVariables=1

[Text]
Meter=String
X=(#CURRENTCONFIGWIDTH#/2)
Y=(#CURRENTCONFIGHEIGHT#/2)
W=(#ImageW#+#Radius#*2)
H=(#ImageW#+#Radius#*2)
FontFace=Tahoma
FontColor=255,255,255,255
FontSize=8
StringAlign=CenterCenter
StringEffect=Shadow
FontEffectColor=0,0,0,255
AntiAlias=1
Text="Sun [SinceSunEvent:%,2]%#CRLF#Sun: [Sunrise] - [Sunset]#CRLF#Now: [NowTime]#CRLF##CRLF##CRLF##CRLF#Elapsed: [SinceDayEvent:%,2]% of day #Day##CRLF#Moon: [Moonrise] - [Moonset]#CRLF#Moon [SinceMoonEvent:%,2]%"
DynamicVariables=1
Preview:
ezgif.com-optimize.gif
Summary:
A bit too many changes to describe them all in one post, but the long and short of it is that the grabbed data is initially the 4 sun and moon rise and set ordered lists, which are then merged into just 2 ordered lists corresponding to the sun and moon "items" - basically 2 lists where the sun or the moon rise and set times alternate in chronological order, just like it happens in reality. These lists, although containing the full local times, are not limited and don't care for a certain or single day rise and set times, but the idea is to have the rise and set "bounds" or "events" (more on this below) ready to be iterated in order to find exactly which [rise to set] or [set to rise] interval the "now" time belongs to - something that happens in the next step.

Once the "current" interval has been identified, the timestamps are not stored as "rise" or "set", but as sun or moon "Event0" and "Event1", i.e. the events occurring before and after "now", in other words the 0 degree and 180 degree of the arcs on which the sun and the moon currently are. The "up" and "down" states of the sun and moon are stored in the timestamp format itself, as "AM" and "PM" indicators (placed before the time to avoid confusion), which are then properly transformed into the #SunUp# and #MoonUp# variables. For convenience, all the "events" / rises / sets are formatted into human readable form in the additional events measures, after which the [Since...] measures are calculated. Considering that now we don't really care which is the rise and which is the set (since these things are already stored from transforming the fake AM and PM indicators), we can safely subtract just the Event0 from Now and divide to (Event1-Event0) for both the sun and the moon, further simplifying the excellent pbutler6 formulas. After this, it's just a matter of displaying the results.

Notes:
Time measures are extensively used in this version, not just for convenience but also because when identifying the interval the "now" time belongs to, we need to compare the times in order to choose the right "bounds" / "events". Both the merging of the 4 lists into just 2 lists and the identifying of interval the "now" time belongs to are done by iterating in native Rainmeter code (but but but Rainmeter doesn't have a FOR or WHILE or REPEAT statement, folks say, LOL - oh yes, it has, even though it's basically more of a hack than "normal" and "recommended" coding). This iterating is done by "recursively self updating" measure groups until a condition is met, and even though it very much works, it isn't really the "standard" way to do things and it's CPU intensive on longer iterations - so it is only applied when necessary, to avoid overload (e.g. at the end of parsing when merging the 4 lists into 2 and then looking for the interval the "now" time belongs to, at interval or day change moments in the [NowTime] measure, etc).

Also, the 15 day plus the day before and the day after is requested from the weather.com's Astro API source, so that on "normal" (i.e. not the polar) latitudes, each rise to set or set to rise interval that spans over 2 days can have its "bounds" / "events" available. Regarding the source, even though the Astro API appeared to be the best choice for this kind of skins, it seems that on days where only a (moon) rise or a set event exists, that event is missing in the Astro JSON (it is present in the Weather.com's regular JSON API though, but one can't get the events from the day before or the day after the 15 forecast days there, so...) - you can check the date of 12.09.2020 by clicking to run the timelapse in this skin and you'll see what I mean. This is really unfortunate and I have no idea if it's incompetence or there is some reason for that kind of loophole in their data, but, well, this time it's not my fault, the source is that way. I used to get the rise and set times from NASA a couple of years ago, but right now it appears they go through a "modernization" process which will supposedly end this fall, depending on COVID-19, after which they will resume the "normal" activity. Maybe then that will be a better alternative - as long as one can manipulate the source data to grab the sun and moon rise and set times in those 4 ordered lists, this skin should be able to handle any source, so it's not like a rewrite is needed.
You do not have the required permissions to view the files attached to this post.
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 »

Looks great! :D You have really distilled the code. I look forward to trying to figure out what is really going on.

What are you extracting with the Extractor, Cleaner, Defaulter. and ExtractorE substitutions? :confused: (They look complicated - Just a simple explantion will do.)
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
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: September 6th, 2020, 12:51 am Looks great! :D You have really distilled the code. I look forward to trying to figure out what is really going on.
Glad you like it - I like it too. :lol: If you have any questions about it, just ask. ;-)
pbutler6 wrote: September 6th, 2020, 12:51 am What are you extracting with the Extractor, Cleaner, Defaulter. and ExtractorE substitutions? :confused: (They look complicated - Just a simple explantion will do.)
Extractor, Cleaner and Defaulter all belong to the same extraction process, just like the slightly modified ExtractorE, Cleaner, Defaulter set are.

- Extractor just extracts the [#Index]-th riseset time from a ["RiseSetTime0","RiseSetTime1","RiseSetTime2",...] list (Index starting at 0)
- Cleaner removes the _, \1, space and " leftovers (the _ were added by Extractor just to "mark" if the match has been found, which is why Cleaner empties the string only if the _ hence the match are not found in it) from the string
- Defaulter simply "defaults" any empty, invalid or non-existent elements in the list to 1 Jan 1601, aka timestamp 0

As for ExtractorE, this is (and does) basically the same as Extractor, but without the quotes used as anchors in the regex substitution. Its purpose is to extract the "events" (hence the "E" at the end), and since they were already stripped of quotes in the previous etraction process, such a substitution is suited for them. In the initial code, the "events" were just numeric timestamps, so it made even more sense for the format of the substitution. I ended up using the humanly readable times though, as it's easier to identify potential mistakes when looking at them in the Log.
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 »

Thanks for the explanation.

I note that you have a small timing issue with SinceMoonEvent and SinceSunEvent --
Screenshot 2020-09-06 090513.jpg
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 »

I double-checked Lat & Lon --
Screenshot 2020-09-06 094756.jpg
Screenshot 2020-09-06 100923.jpg
www.timeanddate.com shows the moonset for tonight at 21:25, but when the screenshot was taken the last moonset was on 9/5.

I am getting my times from www.wunderground.com/weather/, not https://api.weather.com/v2/


Sunrise & Sunset:
Screenshot 2020-09-06 094734.jpg
Moonrise & Moonset:
Screenshot 2020-09-06 094851.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
Yincognito
Rainmeter Sage
Posts: 7029
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: September 6th, 2020, 1:07 pm Thanks for the explanation.

I note that you have a small timing issue with SinceMoonEvent and SinceSunEvent --

Screenshot 2020-09-06 090513.jpg
Yeah, I know about it. It's no big deal and not a timing issue, just a division by 0, due to (Event1-Event0) for the sun and moon being 0 in those measures at the start (since Event1 and Event0 for the sun and moon are themselves 0 at skin refresh, thus 0-0=0 and one can't divide by 0). It's not affecting the calculations in any way, it's more a matter of comfort for the user to not see those harmless errors popping up in the Log.

The updated code below deals with the division by 0 errors AND allows correctly viewing the movements of sun and moon on their arcs near the poles (or even at the poles themselves, assuming an appropriate number of #SideDays# and #Days# has been configured in the [Variables] section, so that the far from each other rise and set events at the beginning and end of the forecast interval are captured from the source).

#Days# is just the number of normal forecast days to get, while #SideDays# is the number of days added to the "sides" of that #Days# interval (i.e. before and after) in order to capture more distant rise and set times from the beginning and end of the #Days# interval's bounds, for cases where the [rise to set] or [set to rise] intervals span over multiple days (aka sun or moon stay "up" or "down" for multiple days near the poles). Graphically it looks like this, assuming #Days# is 15 and #SideDays# is 3:
...................|................................ Requested from the source ............................................................|.....................
.............Day0 - 3 days.............Day0.......................................................................Day14.............Day14 + 3 days............
...................|......SideDays.......|....................................Days...................................|......SideDays.......|.....................
...................|...outside events...|......................Included in the Timelapse.......................|...outside events...|.....................

Code:

Code: Select all

[Variables]
UpdateRate=3600
Lat=67.00
Lon=26.40
Days=15
SideDays=1
APIKey=6532d6454b8aa370768e63d6ba5a832e
AstroURL=https://api.weather.com/v2/astro?geocode=#Lat#,#Lon#&date=[&SideDate]&days=[&RiseSetDays]&format=json&apiKey=#APIKey#
Extractor='(?siU)^.*(?:".*"[,\]]){0,[#Index]}+(".*")[,\]].*$':"_\1_"
Cleaner="(?:^[^_].*|.*[^_]$)":"","(?:^_|_$)":"","(?:^\\\d+|\\\d+$)":"","(?:^\s+|\s+$)":"",'(?:^"|"$)':""
Defaulter="(?:^$|^null$|^N\/A$|^.*doesn't exist.*$)":"1601-01-01T00:00:00.000+00:00"
ExtractorE='(?siU)^.*(?:.*[,\]]){0,[#Index]}+(.*)[,\]].*$':"_\1_"
Index=0
Day=0

NowEvent=0
SunItems=""
SunEvent0=0
SunEvent1=0
SunUp=0
MoonItems=""
MoonEvent0=0
MoonEvent1=0
MoonUp=0

Update=25
NTStep=300

Radius=95
ImageW=32
DialSW=2

[Rainmeter]
Update=#Update#
DynamicWindowSize=1
AccurateText=1
BackgroundMode=2
SolidColor=0,0,0,80

---Measures Time---

[RiseSetDays]
Measure=Calc
Formula=(#SideDays#+#Days#+#SideDays#)
UpdateDivider=(#UpdateRate#*1000/#Update#)
DynamicVariables=1

[CurrDate]
Measure=Time
UpdateDivider=(#UpdateRate#*1000/#Update#)
DynamicVariables=1

[SideDate]
Measure=Time
TimeStamp=([CurrDate:TimeStamp]-(24*60*60)*#SideDays#)
Format=%Y%m%d
UpdateDivider=(#UpdateRate#*1000/#Update#)
DynamicVariables=1

---Measures Counter---

[CounterTimeStamp]
Disabled=1
Measure=Calc
Formula=((CounterTimeStamp+#NTStep#)%(#Days#*(24*60*60)))
OnUpdateAction=[!SetVariable Day (Trunc([CounterTimeStamp]/(24*60*60)))]
DynamicVariables=1

---Measures Astro---

[Astro]
Measure=WebParser
Url=#AstroURL#
UserAgent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36
RegExp=^.*$
UpdateRate=(#UpdateRate#*1000/#Update#)
FinishAction=[!UpdateMeasureGroup "AstroGroup"][!UpdateMeasureGroup "ItemsGroup"][!UpdateMeasureGroup "NowGroup"][!UpdateMeasureGroup "EventsGroup"][!UpdateMeasureGroup "IntervalsGroup"][!UpdateMeter *][!Redraw]
OnConnectErrorAction=[!UpdateMeasureGroup "AstroGroup"][!UpdateMeasureGroup "ItemsGroup"][!UpdateMeasureGroup "NowGroup"][!UpdateMeasureGroup "EventsGroup"][!UpdateMeasureGroup "IntervalsGroup"][!UpdateMeter *][!Redraw]
OnRegExpErrorAction=[!UpdateMeasureGroup "AstroGroup"][!UpdateMeasureGroup "ItemsGroup"][!UpdateMeasureGroup "NowGroup"][!UpdateMeasureGroup "EventsGroup"][!UpdateMeasureGroup "IntervalsGroup"][!UpdateMeter *][!Redraw]
DynamicVariables=1

[Sunrises]
Group=AstroGroup
Measure=String
String=[Astro]
UpdateDivider=-1
RegExpSubstitute=1
Substitute='(?siU)(?:(?:^|,).*(?:"sun":\{"riseSet":\{.*"riseLocal":(?=".*")|$))':",","^,":"[",",$":"]"
DynamicVariables=1

[Sunsets]
Group=AstroGroup
Measure=String
String=[Astro]
UpdateDivider=-1
RegExpSubstitute=1
Substitute='(?siU)(?:(?:^|,).*(?:"sun":\{"riseSet":\{.*"setLocal":(?=".*")|$))':",","^,":"[",",$":"]"
DynamicVariables=1

[Moonrises]
Group=AstroGroup
Measure=String
String=[Astro]
UpdateDivider=-1
RegExpSubstitute=1
Substitute='(?siU)(?:(?:^|,).*(?:"moon":\{"riseSet":\{.*"riseLocal":(?=".*")|$))':",","^,":"[",",$":"]"
DynamicVariables=1

[Moonsets]
Group=AstroGroup
Measure=String
String=[Astro]
UpdateDivider=-1
RegExpSubstitute=1
Substitute='(?siU)(?:(?:^|,).*(?:"moon":\{"riseSet":\{.*"setLocal":(?=".*")|$))':",","^,":"[",",$":"]"
DynamicVariables=1

---Measures Items---

[ResetItems]
Group=ItemsGroup
Measure=Calc
UpdateDivider=-1
OnUpdateAction=[!SetVariable SunItems ""][!SetVariable MoonItems ""]
DynamicVariables=1

[SunriseItem]
Group=ItemsGroup | SunItemsGroup
Measure=String
String=[Sunrises]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#"
DynamicVariables=1

[SunriseItemTime]
Group=ItemsGroup | SunItemsGroup
Measure=Time
TimeStamp=[SunriseItem]
TimeStampFormat=%Y-%m-%dT%H:%M:%S
Format=%Y-%m-%dT%H:%M:%S
UpdateDivider=-1
DynamicVariables=1

[SunsetItem]
Group=ItemsGroup | SunItemsGroup
Measure=String
String=[Sunsets]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#"
DynamicVariables=1

[SunsetItemTime]
Group=ItemsGroup | SunItemsGroup
Measure=Time
TimeStamp=[SunsetItem]
TimeStampFormat=%Y-%m-%dT%H:%M:%S
Format=%Y-%m-%dT%H:%M:%S
UpdateDivider=-1
IfCondition=(#Index#<(#SideDays#+#Days#+#SideDays#)) && ([SunriseItemTime:TimeStamp]<=[SunsetItemTime:TimeStamp])
IfTrueAction=[!SetVariable SunItems "#SunItems#AM [SunriseItemTime],PM [SunsetItemTime],"]
IfCondition2=(#Index#<(#SideDays#+#Days#+#SideDays#)) && ([SunriseItemTime:TimeStamp]>[SunsetItemTime:TimeStamp])
IfTrueAction2=[!SetVariable SunItems "#SunItems#PM [SunsetItemTime],AM [SunriseItemTime],"]
IfCondition3=(#Index#<(#SideDays#+#Days#+#SideDays#))
IfTrueAction3=[!SetVariable Index (#Index#+1)][!UpdateMeasureGroup SunItemsGroup]
IfFalseAction3=[!SetVariable Index 0]
IfConditionMode=1
DynamicVariables=1

[MoonriseItem]
Group=ItemsGroup | MoonItemsGroup
Measure=String
String=[Moonrises]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#"
DynamicVariables=1

[MoonriseItemTime]
Group=ItemsGroup | MoonItemsGroup
Measure=Time
TimeStamp=[MoonriseItem]
TimeStampFormat=%Y-%m-%dT%H:%M:%S
Format=%Y-%m-%dT%H:%M:%S
UpdateDivider=-1
DynamicVariables=1

[MoonsetItem]
Group=ItemsGroup | MoonItemsGroup
Measure=String
String=[Moonsets]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#"
DynamicVariables=1

[MoonsetItemTime]
Group=ItemsGroup | MoonItemsGroup
Measure=Time
TimeStamp=[MoonsetItem]
TimeStampFormat=%Y-%m-%dT%H:%M:%S
Format=%Y-%m-%dT%H:%M:%S
UpdateDivider=-1
IfCondition=(#Index#<(#SideDays#+#Days#+#SideDays#)) && ([MoonriseItemTime:TimeStamp]<=[MoonsetItemTime:TimeStamp])
IfTrueAction=[!SetVariable MoonItems "#MoonItems#AM [MoonriseItemTime],PM [MoonsetItemTime],"]
IfCondition2=(#Index#<(#SideDays#+#Days#+#SideDays#)) && ([MoonriseItemTime:TimeStamp]>[MoonsetItemTime:TimeStamp])
IfTrueAction2=[!SetVariable MoonItems "#MoonItems#PM [MoonsetItemTime],AM [MoonriseItemTime],"]
IfCondition3=(#Index#<(#SideDays#+#Days#+#SideDays#))
IfTrueAction3=[!SetVariable Index (#Index#+1)][!UpdateMeasureGroup MoonItemsGroup]
IfFalseAction3=[!SetVariable Index 0]
IfConditionMode=1
DynamicVariables=1

---Measures Now---

[NowTime]
Group=NowGroup
Measure=Time
Format=%Y-%m-%d %H:%M:%S
IfCondition=(([NowTime:TimeStamp]>=#SunEvent1#) && (#SunEvent1#>0)) || (([NowTime:TimeStamp]>=#MoonEvent1#) && (#MoonEvent1#>0)) || (([NowTime:TimeStamp]-[NowTime:TimeStamp]%(24*60*60))<>(#NowEvent#-#NowEvent#%(24*60*60)))
IfTrueAction=[!SetVariable NowEvent [NowTime:TimeStamp]][!UpdateMeasureGroup EventsGroup]
IfFalseAction=[!SetVariable NowEvent [NowTime:TimeStamp]]
IfConditionMode=1
DynamicVariables=1

---Measures Events---

[InitEvents]
Group=EventsGroup
Measure=Calc
UpdateDivider=-1
OnUpdateAction=[!SetVariable SunEvent0 0][!SetVariable SunEvent1 0][!SetVariable MoonEvent0 0][!SetVariable MoonEvent1 0]
DynamicVariables=1

[SunEvent]
Group=EventsGroup | SunEventsGroup
Measure=String
String=#SunItems#
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#ExtractorE#,"#Cleaner#","#Defaulter#"
DynamicVariables=1

[SunEventTime]
Group=EventsGroup | SunEventsGroup
Measure=Time
TimeStamp=[SunEvent]
TimeStampFormat=%p %Y-%m-%dT%H:%M:%S
Format=%Y-%m-%dT%H:%M:%S
UpdateDivider=-1
IfCondition=([SunEventTime:TimeStamp]<=[NowTime:TimeStamp]) && (#Index#<((#SideDays#+#Days#+#SideDays#)*2-1))
IfTrueAction=[!SetVariable SunEvent0 (([SunEventTime:TimeStamp]=0)?(#SunEvent0#):([SunEventTime:TimeStamp]))][!SetVariable Index (#Index#+1)][!UpdateMeasureGroup SunEventsGroup]
IfFalseAction=[!SetVariable SunEvent1 [SunEventTime:TimeStamp]][!SetVariable Index 0]
IfConditionMode=1
DynamicVariables=1

[SunUp]
Group=EventsGroup
Measure=String
String=[SunEvent]
UpdateDivider=-1
OnUpdateAction=[!SetVariable SunUp [SunUp]]
RegExpSubstitute=1
Substitute="^AM .*$":"0","^PM .*$":"1"
DynamicVariables=1

[MoonEvent]
Group=EventsGroup | MoonEventsGroup
Measure=String
String=#MoonItems#
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#ExtractorE#,"#Cleaner#","#Defaulter#"
DynamicVariables=1

[MoonEventTime]
Group=EventsGroup | MoonEventsGroup
Measure=Time
TimeStamp=[MoonEvent]
TimeStampFormat=%p %Y-%m-%dT%H:%M:%S
Format=%Y-%m-%dT%H:%M:%S
UpdateDivider=-1
IfCondition=([MoonEventTime:TimeStamp]<=[NowTime:TimeStamp]) && (#Index#<((#SideDays#+#Days#+#SideDays#)*2-1))
IfTrueAction=[!SetVariable MoonEvent0 (([MoonEventTime:TimeStamp]=0)?(#MoonEvent0#):([MoonEventTime:TimeStamp]))][!SetVariable Index (#Index#+1)][!UpdateMeasureGroup MoonEventsGroup]
IfFalseAction=[!SetVariable MoonEvent1 [MoonEventTime:TimeStamp]][!SetVariable Index 0]
IfConditionMode=1
DynamicVariables=1

[MoonUp]
Group=EventsGroup
Measure=String
String=[MoonEvent]
UpdateDivider=-1
OnUpdateAction=[!SetVariable MoonUp [MoonUp]]
RegExpSubstitute=1
Substitute="^AM .*$":"0","^PM .*$":"1"
DynamicVariables=1

---Measures Additional Events---

[SunEvent0Time]
Group=EventsGroup
Measure=Time
TimeStamp=#SunEvent0#
Format=%Y-%m-%d %H:%M:%S
UpdateDivider=-1
DynamicVariables=1

[SunEvent1Time]
Group=EventsGroup
Measure=Time
TimeStamp=#SunEvent1#
Format=%Y-%m-%d %H:%M:%S
UpdateDivider=-1
DynamicVariables=1

[MoonEvent0Time]
Group=EventsGroup
Measure=Time
TimeStamp=#MoonEvent0#
Format=%Y-%m-%d %H:%M:%S
UpdateDivider=-1
DynamicVariables=1

[MoonEvent1Time]
Group=EventsGroup
Measure=Time
TimeStamp=#MoonEvent1#
Format=%Y-%m-%d %H:%M:%S
UpdateDivider=-1
DynamicVariables=1

[InitIndex]
Group=EventsGroup
Measure=Calc
UpdateDivider=-1
OnUpdateAction=[!SetVariable Index (#SideDays#+#Day#)]
DynamicVariables=1

[Sunrise]
Group=EventsGroup
Measure=String
String=[Sunrises]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#","(?siU)^.*(\d{2}:\d{2}:\d{2}).*$":"\1"
DynamicVariables=1

[Sunset]
Group=EventsGroup
Measure=String
String=[Sunsets]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#","(?siU)^.*(\d{2}:\d{2}:\d{2}).*$":"\1"
DynamicVariables=1

[Moonrise]
Group=EventsGroup
Measure=String
String=[Moonrises]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#","(?siU)^.*(\d{2}:\d{2}:\d{2}).*$":"\1"
DynamicVariables=1

[Moonset]
Group=EventsGroup
Measure=String
String=[Moonsets]
UpdateDivider=-1
RegExpSubstitute=1
Substitute=#Extractor#,"#Cleaner#","#Defaulter#","(?siU)^.*(\d{2}:\d{2}:\d{2}).*$":"\1"
DynamicVariables=1

[ResetIndex]
Group=EventsGroup
Measure=Calc
UpdateDivider=-1
OnUpdateAction=[!SetVariable Index 0]
DynamicVariables=1

---Measures Intervals---

[SinceSunEvent]
Group=IntervalsGroup
Measure=Calc
Formula=(((#SunUp#=1)?(0):(0.5))+(#NowEvent#-#SunEvent0#)/((#SunEvent1#-#SunEvent0#=0)?(1):(#SunEvent1#-#SunEvent0#))/2)
DynamicVariables=1

[SinceMoonEvent]
Group=IntervalsGroup
Measure=Calc
Formula=(((#MoonUp#=1)?(0):(0.5))+(#NowEvent#-#MoonEvent0#)/((#MoonEvent1#-#MoonEvent0#=0)?(1):(#MoonEvent1#-#MoonEvent0#))/2)
DynamicVariables=1

[SinceDayEvent]
Group=IntervalsGroup
Measure=Calc
Formula=(#NowEvent#%(24*60*60))/(24*60*60)
DynamicVariables=1

---Meters---

[UpArc]
Meter=Roundline
W=(#ImageW#+#Radius#*2)
H=(#ImageW#+#Radius#*2)
StartAngle=(PI)
RotationAngle=(PI)
LineStart=(#Radius#-#DialSW#/2)
LineLength=(#Radius#+#DialSW#/2)
LineColor=255,255,255,255
Solid=1
AntiAlias=1
DynamicVariables=1

[DownArc]
Meter=Roundline
W=(#ImageW#+#Radius#*2)
H=(#ImageW#+#Radius#*2)
StartAngle=(0)
RotationAngle=(PI)
LineStart=(#Radius#-#DialSW#/2)
LineLength=(#Radius#+#DialSW#/2)
LineColor=96,96,96,255
Solid=1
AntiAlias=1
DynamicVariables=1

[Sun]
Meter=Rotator
MeasureName=SinceSunEvent
ImageName=#@#Sun.png
X=(#Radius#)
Y=(#Radius#)
W=(#ImageW#)
H=(#ImageW#)
OffsetX=(-(#Radius#-#ImageW#/2))
OffsetY=(#ImageW#/2)
StartAngle=(PI)
RotationAngle=(PI*2)
DynamicVariables=1

[Moon]
Meter=Rotator
MeasureName=SinceMoonEvent
ImageName=#@#Moon.png
X=(#Radius#)
Y=(#Radius#)
W=(#ImageW#)
H=(#ImageW#)
OffsetX=(-(#Radius#-#ImageW#/2))
OffsetY=(#ImageW#/2)
StartAngle=(PI)
RotationAngle=(PI*2)
DynamicVariables=1

[Earth]
Meter=Rotator
MeasureName=SinceDayEvent
ImageName=#@#Earth.png
X=(#Radius#)
Y=(#Radius#)
W=(#ImageW#)
H=(#ImageW#)
OffsetX=(#ImageW#/2)
OffsetY=(#ImageW#/2)
StartAngle=(0)
RotationAngle=(PI*2)
LeftMouseUpAction=[!SetVariable Index 0][!SetVariable Day 0][!ToggleMeasure CounterTimeStamp][!UpdateMeasure CounterTimeStamp][!SetOption NowTime TimeStamp """(([*CurrDate:TimeStamp*]-[*CurrDate:TimeStamp*]%(24*60*60))+[*CounterTimeStamp*])"""][!UpdateMeasureGroup "NowGroup"][!UpdateMeasureGroup "EventsGroup"][!UpdateMeter *][!Redraw]
DynamicVariables=1

[Text]
Meter=String
X=(#CURRENTCONFIGWIDTH#/2)
Y=(#CURRENTCONFIGHEIGHT#/2)
W=(#ImageW#+#Radius#*2)
H=(#ImageW#+#Radius#*2)
FontFace=Tahoma
FontColor=255,255,255,255
FontSize=8
StringAlign=CenterCenter
StringEffect=Shadow
FontEffectColor=0,0,0,255
AntiAlias=1
Text="Sun [SinceSunEvent:%,2]%#CRLF#Sun: [Sunrise] - [Sunset]#CRLF#Now: [NowTime]#CRLF##CRLF##CRLF##CRLF#Elapsed: [SinceDayEvent:%,2]% of day #Day##CRLF#Moon: [Moonrise] - [Moonset]#CRLF#Moon [SinceMoonEvent:%,2]%"
DynamicVariables=1
The latitude here is already set to 67 degrees north, so you can see the sun and moon movements closer to the poles. You can clearly see that between 10.09.2020 19:52:00 (rise) and 13.09.2020 21:15:00 (set) the moon stays 'up' the entire day and its movement on the 'up' arc spans over 3 days, consistent with the data at TimeAndDate.com for these coordinates. Unfortunately, as previously mentioned, on 14.09.2020 (where there is only one rise or set time as it can be seen at TimeAndDate.com) there is no moonrise or moonset time present in the source, so the timelapse (and normal positioning, of course) is messed up. Given a source where the rise and set times are all present and correct, it will work flawlessly.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth