I see that there are errors in the log:
Calc: Extra operation - [MeasureSunsetMoment]
Calc: Extra operation - [MeasureSunriseMoment]
It is currently April 23rd, 2024, 5:31 am
Display image based on sunrise / sunset measures
-
- Posts: 866
- Joined: January 4th, 2018, 9:52 pm
-
- Rainmeter Sage
- Posts: 5406
- Joined: April 12th, 2012, 9:40 pm
- Location: Cedar Point, Ohio, USA
Re: Display image based on sunrise / sunset measures
Can you post your entire current code? I see only bits and pieces in prior posts...xenium wrote:I see that there are errors in the log:
Calc: Extra operation - [MeasureSunsetMoment]
Calc: Extra operation - [MeasureSunriseMoment]
:: My DA Gallery :: Rainmeter DA Gallery :: Rainmeter Workshops :: Rainmeter Documentation :: BBCode Guide ::
-
- Rainmeter Sage
- Posts: 16162
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Display image based on sunrise / sunset measures
The Calc: Extra operation message is given by the fact that when the skin is loaded, the WebPraser measures don't return nothing yet. But the values which should have to be returned by these measures should have to be used by other measures. These values being empty, the error is returned in the log: https://forum.rainmeter.net/viewtopic.php?p=119130#p119130xenium wrote:I see that there are errors in the log:
Calc: Extra operation - [MeasureSunsetMoment]
Calc: Extra operation - [MeasureSunriseMoment]
The simplest way to avoid these messages would be to complete the substitutions made on [MeasureSunriseHour] and
[MeasureSunriseMinute], respectively on [MeasureSunsetHour] and [MeasureSunsetMinute] measures, to make them to return 0 while the appropriate WebParser measures didn't return nothing yet. Replace the old Substitute options of these measures (Substitute="^(\d{1,2}):\d{1,2}$":"\1") with the following one: Substitute="^(\d{1,2}):\d{1,2}$":"\1"[color=#FF0000],"^$":"0"[/color].
As eclectic-tech said, probably a complete code would be useful now. Post it please.
-
- Posts: 866
- Joined: January 4th, 2018, 9:52 pm
Re: Display image based on sunrise / sunset measures
It's done! Errors are no longer displayed in the logbalala wrote:The Calc: Extra operation message is given by the fact that when the skin is loaded, the WebPraser measures don't return nothing yet. But the values which should have to be returned by these measures should have to be used by other measures. These values being empty, the error is returned in the log: https://forum.rainmeter.net/viewtopic.php?p=119130#p119130
The simplest way to avoid these messages would be to complete the substitutions made on [MeasureSunriseHour] and
[MeasureSunriseMinute], respectively on [MeasureSunsetHour] and [MeasureSunsetMinute] measures, to make them to return 0 while the appropriate WebParser measures didn't return nothing yet. Replace the old Substitute options of these measures (Substitute="^(\d{1,2}):\d{1,2}$":"\1") with the following one: Substitute="^(\d{1,2}):\d{1,2}$":"\1"[color=#FF0000],"^$":"0"[/color].
As eclectic-tech said, probably a complete code would be useful now. Post it please.
I noticed a small problem:
after 00:00, the text "until sunrise" changes to "until sunset"
Code: Select all
[Rainmeter]
Update=1000
[Variables]
UpdateRateSeconds=600
URL=https://www.foreca.com/Bulgaria/Sofia
[MeasureSunrise]
Measure=WebParser
Url=#URL#
RegExp=(?siU)Sun rise: <strong>(.*)</strong>.*Sun set: <strong>(.*)</strong>
UpdateRate=#UpdateRateSeconds#
StringIndex=1
[MeasureSunriseHour]
Measure=String
String=[MeasureSunrise]
RegExpSubstitute=1
Substitute="^(\d{1,2}):\d{1,2}$":"\1","^$":"0"
DynamicVariables=1
[MeasureSunriseMinute]
Measure=String
String=[MeasureSunrise]
RegExpSubstitute=1
Substitute="^\d{1,2}:(\d{1,2})$":"\1","^$":"0"
DynamicVariables=1
[MeasureSunriseMoment]
Measure=Calc
Formula=( 60 * [MeasureSunriseHour] + [MeasureSunriseMinute] )
DynamicVariables=1
[MeasureSunset]
Measure=WebParser
Url=[MeasureSunrise]
StringIndex=2
[MeasureSunsetHour]
Measure=String
String=[MeasureSunset]
RegExpSubstitute=1
Substitute="^(\d{1,2}):\d{1,2}$":"\1","^$":"0"
DynamicVariables=1
[MeasureSunsetMinute]
Measure=String
String=[MeasureSunset]
RegExpSubstitute=1
Substitute="^\d{1,2}:(\d{1,2})$":"\1","^$":"0"
DynamicVariables=1
[MeasureSunsetMoment]
Measure=Calc
Formula=( 60 * [MeasureSunsetHour] + [MeasureSunsetMinute] )
DynamicVariables=1
[MeasureHour]
Measure=Time
Format=%#H
[MeasureMinute]
Measure=Time
Format=%#M
[MeasureTime]
Measure=Calc
Formula=( 60 * MeasureHour + MeasureMinute )
IfCondition=((#CURRENTSECTION#>=MeasureSunriseMoment)&&(#CURRENTSECTION#<=MeasureSunsetMoment))
IfTrueAction=[!ShowMeter "SUN"]
IfFalseAction=[!HideMeter "SUN"]
[MeasureCurrent]
Measure=Calc
Formula=(60 * MeasureHour + MeasureMinute)
[MeasureToSunrise]
Measure=Calc
Formula=(MeasureSunriseMoment - MeasureCurrent)
[MeasureToSunset]
Measure=Calc
Formula=(MeasureSunsetMoment - MeasureCurrent)
IfCondition=MeasureToSunset > 0
IfTrueAction=[!SetVariable "upordown" "sunset"]
IfFalseAction=[!SetVariable "upordown" "sunrise"]
DynamicVariables=1
[MeasureLeft]
Measure=Calc
Formula=(((MeasureToSunrise < 0) && (MeasureToSunset < 0)) ? ( 1440 + MeasureToSunrise ) : (((MeasureToSunrise < 0) && (MeasureToSunset > 0)) ? MeasureToSunset : MeasureToSunrise))
[MeasureLeftHours]
Measure=Calc
Formula=(Floor(MeasureLeft / 60))
IfCondition=MeasureLeftHours > 1
IfTrueAction=[!SetVariable "hour" "[MeasureLeftHours] hrs"]
IfFalseAction=[!SetVariable "hour" "[MeasureLeftHours] hr"]
IfConditionMode=1
[MeasureLeftMin]
Measure=Calc
Formula=(MeasureLeft - 60 * MeasureLeftHours)
IfCondition=(MeasureLeftMin > 1)
IfTrueAction=[!SetVariable "min" "[MeasureLeftMin] mins"]
IfFalseAction=[!SetVariable "min" "[MeasureLeftMin] min"]
IfConditionMode=1 ]
[MeterSunrise]
Meter=String
MeasureName=MeasureSunrise
X=0
Y=0
W=120
H=60
FontSize=8
FontColor=250,250,250,250
StringStyle=Normal
StringEffect=SHADOW
FontFace=arial
StringAlign=Left
FontEffectColor=0,0,0,80
AntiAlias=1
Prefix="Sunrise: "
[MeterSunset]
Meter=String
MeasureName=MeasureSunset
X=0
Y=15r
W=120
H=60
FontSize=8
FontColor=250,250,250,250
StringStyle=Normal
StringEffect=SHADOW
FontFace=arial
StringAlign=Left
FontEffectColor=0,0,0,80
AntiAlias=1
Prefix="Sunset: "
[SUN]
Meter=String
FontSize=20
FontWeight=400
x=0
y=50r
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=SUN
Hidden=1
[MeterHoursRem]
Meter=String
MeasureName=MeasureLeftHours
MeasureName2=MeasureLeftMin
FontColor=255,255,255,255
FontSize=10
StringStyle=Normal
StringEffect=SHADOW
FontFace=arial
StringAlign=Left
FontEffectColor=0,0,0,80
AntiAlias=1
ClipString=1
StringAlign=center
X=0
Y=50r
Text=#hour# #min# #CRLF# until #upordown#
DynamicVariables=1
-
- Rainmeter Sage
- Posts: 16162
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Display image based on sunrise / sunset measures
Yes, because the string, before sunset, always is set to "until sunset". This means it also is set to "until sunset" daytime, but also before Sunrise.xenium wrote:I noticed a small problem:
after 00:00, the text "until sunrise" changes to "until sunset"
To fix this, replace the IfCondition option of the [MeasureToSunset] measure, to the following one: IfCondition=((MeasureCurrent>MeasureSunriseMoment)&&(MeasureCurrent<MeasureSunsetMoment)).
-
- Posts: 866
- Joined: January 4th, 2018, 9:52 pm
Re: Display image based on sunrise / sunset measures
balala wrote:Yes, because the string, before sunset, always is set to "until sunset". This means it also is set to "until sunset" daytime, but also before Sunrise.
To fix this, replace the IfCondition option of the [MeasureToSunset] measure, to the following one: IfCondition=((MeasureCurrent>MeasureSunriseMoment)&&(MeasureCurrent<MeasureSunsetMoment)).
Thank you very much !
-
- Rainmeter Sage
- Posts: 16162
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
-
- Posts: 866
- Joined: January 4th, 2018, 9:52 pm
Re: Display image based on sunrise / sunset measures
Hi,
I have a problem
I have a pie chart (24 hours) that shows the size of the day and the size of the night.
I noticed that for a location where the length of the day and the length of the night are very close in size, the pie chart does not display correctly (the day appears larger, although it is shorter than the night)
What is wrong?
I have a problem
I have a pie chart (24 hours) that shows the size of the day and the size of the night.
I noticed that for a location where the length of the day and the length of the night are very close in size, the pie chart does not display correctly (the day appears larger, although it is shorter than the night)
What is wrong?
Code: Select all
[Rainmeter]
Update=1000
[Variables]
URL=https://www.foreca.com/Papua_New_Guinea/Kieta
;https://www.foreca.com/Gibraltar/Gibraltar
;https://www.foreca.com/New_Zealand/Auckland
UpdateRateSeconds=600
=======================Measure===========================
[MeasureSunrise]
Measure=WebParser
Url=#URL#
RegExp=(?siU)Sun rise: <strong>(.*)</strong>.*Sun set: <strong>(.*)</strong>
UpdateRate=#UpdateRateSeconds#
StringIndex=1
[MeasureSunriseHour]
Measure=String
String=[MeasureSunrise]
RegExpSubstitute=1
Substitute="^(\d{1,2}):\d{1,2}$":"\1","^$":"0"
DynamicVariables=1
[MeasureSunriseMinute]
Measure=String
String=[MeasureSunrise]
RegExpSubstitute=1
Substitute="^\d{1,2}:(\d{1,2})$":"\1","^$":"0"
DynamicVariables=1
[MeasureSunriseMoment]
Measure=Calc
Formula=( 60 * [MeasureSunriseHour] + [MeasureSunriseMinute] )
DynamicVariables=1
MaxValue=720
MinValue=0
[MeasureSunset]
Measure=WebParser
Url=[MeasureSunrise]
StringIndex=2
[MeasureSunsetHour]
Measure=String
String=[MeasureSunset]
RegExpSubstitute=1
Substitute="^(\d{1,2}):\d{1,2}$":"\1","^$":"0"
DynamicVariables=1
[MeasureSunsetMinute]
Measure=String
String=[MeasureSunset]
RegExpSubstitute=1
Substitute="^\d{1,2}:(\d{1,2})$":"\1","^$":"0"
DynamicVariables=1
[MeasureSunsetMoment]
Measure=Calc
Formula=( 60 * [MeasureSunsetHour] + [MeasureSunsetMinute] )
DynamicVariables=1
MaxValue=720
MinValue=0
[MeasureDayLengthText]
Measure=Calc
Formula=( MeasureSunsetMoment - MeasureSunriseMoment )
[MeasureDayLengthHour]
Measure=Calc
Formula=( Floor ( MeasureDayLengthText / 60 ))
[MeasureDayLengthMinute]
Measure=Calc
Formula=( MeasureDayLengthText % 60 )
[MeasureNightLengthText]
Measure=Calc
Formula=( 1440 - MeasureSunsetMoment + MeasureSunriseMoment )
[MeasureNightLengthHour]
Measure=Calc
Formula=( Floor ( MeasureNightLengthText / 60 ))
[MeasureNightLengthMinute]
Measure=Calc
Formula=( MeasureNightLengthText % 60 )
[MeasureSunRisePercent]
Measure=Calc
Formula=( 3600 * MeasureSunriseHour + 60 * MeasureSunRiseMinute )
MinValue=0
MaxValue=86400
[MeasureSunSetPercent]
Measure=Calc
Formula=( 3600 * MeasureSunsetHour + 60 * MeasureSunSetMinute )
MinValue=0
MaxValue=86400
[MeasureDayLength]
Measure=Calc
Formula=( MeasureSunSetPercent - MeasureSunRisePercent )
MinValue=0
MaxValue=86400
=======================Meters======================================
[MeterPieChart]
Meter=Roundline
X=0
Y=0
W=200
H=200
StartAngle=4.7124
RotationAngle=6.283
LineLength=75
LineColor=13,13,13,255
Solid=1
AntiAlias=1
DynamicVariables=1
[MeterDayPieChart]
Meter=Roundline
MeasureName=MeasureDayLength
X=0
Y=0
W=200
H=200
StartAngle=(6.283*([MeasureSunRisePercent]/86400-0.25))
RotationAngle=6.283
LineLength=75
LineColor=32,64,132
Solid=1
AntiAlias=1
DynamicVariables=1
[MeterSunRiseLine]
Meter=ROUNDLINE
MeasureName=MeasureSunRisePercent
X=0
Y=0
W=200
H=200
LineLength=75
LineColor=255,255,0
LineWidth=2
AntiAlias=1
StartAngle=4.7124
RotationAngle=6.2832
[MeterSunSetLine]
Meter=ROUNDLINE
MeasureName=MeasureSunSetPercent
X=0r
Y=0r
W=200
H=200
LineLength=75
LineColor=255,111,0
LineWidth=2
AntiAlias=1
StartAngle=4.7124
RotationAngle=6.2832
[MeterNightLengthText]
Meter=String
MeasureName=MeasureNightLengthHour
MeasureName2=MeasureNightLengthMinute
X=65
Y=55
W=120
H=60
FontSize=7
FontColor=255,255,255,255
StringStyle=Bold
StringEffect=SHADOW
FontFace=century gothic
StringAlign=Left
FontEffectColor=0,0,0,50
AntiAlias=1
Prefix="NL: "
Text="%1 h %2 min"
InlineSetting=Color | 255,255,255,190
InlinePattern=(?U)^(.*):.*
InlineSetting2=Size | 6
InlinePattern2=h
InlineSetting3=Size | 6
InlinePattern3=min
[MeterDayLengthText]
Meter=String
MeasureName=MeasureDayLengthHour
MeasureName2=MeasureDayLengthMinute
X=65
Y=75r
W=120
H=60
FontSize=7
FontColor=255,255,255,255
StringStyle=Bold
StringEffect=SHADOW
FontFace=century gothic
StringAlign=Left
FontEffectColor=0,0,0,50
AntiAlias=1
Prefix="DL: "
Text="%1 h %2 min"
InlineSetting=Color | 255,255,255,190
InlinePattern=(?U)^(.*):.*
InlineSetting2=Size | 6
InlinePattern2=h
InlineSetting3=Size | 6
InlinePattern3=min
-
- Rainmeter Sage
- Posts: 16162
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Display image based on sunrise / sunset measures
There is a small problem with the Formula options of the [MeasureSunRisePercent] and [MeasureSunSetPercent] measures. These formulas are using the values returned by the [MeasureSunriseHour] and [MeasureSunRiseMinute], respectively by the [MeasureSunsetHour] and [MeasureSunSetMinute] measures. But these measures are WebParser measures, which means they are returning strings, even if those values are in fact numbers. You have to convert those strings into numbers. To do this, include the measure names into brackets. In paralel, you have to add the DynamicVariables=1 option to both measures:xenium wrote:I have a pie chart (24 hours) that shows the size of the day and the size of the night.
I noticed that for a location where the length of the day and the length of the night are very close in size, the pie chart does not display correctly (the day appears larger, although it is shorter than the night)
Code: Select all
[MeasureSunRisePercent]
Measure=Calc
Formula=( 3600 * [MeasureSunriseHour] + 60 * [MeasureSunRiseMinute] )
DynamicVariables=1
MinValue=0
MaxValue=86400
[MeasureSunSetPercent]
Measure=Calc
Formula=( 3600 * [MeasureSunsetHour] + 60 * [MeasureSunSetMinute] )
DynamicVariables=1
MinValue=0
MaxValue=86400
-
- Posts: 866
- Joined: January 4th, 2018, 9:52 pm
Re: Display image based on sunrise / sunset measures
balala wrote:There is a small problem with the Formula options of the [MeasureSunRisePercent] and [MeasureSunSetPercent] measures. These formulas are using the values returned by the [MeasureSunriseHour] and [MeasureSunRiseMinute], respectively by the [MeasureSunsetHour] and [MeasureSunSetMinute] measures. But these measures are WebParser measures, which means they are returning strings, even if those values are in fact numbers. You have to convert those strings into numbers. To do this, include the measure names into brackets. In paralel, you have to add the DynamicVariables=1 option to both measures:Code: Select all
[MeasureSunRisePercent] Measure=Calc Formula=( 3600 * [MeasureSunriseHour] + 60 * [MeasureSunRiseMinute] ) DynamicVariables=1 MinValue=0 MaxValue=86400 [MeasureSunSetPercent] Measure=Calc Formula=( 3600 * [MeasureSunsetHour] + 60 * [MeasureSunSetMinute] ) DynamicVariables=1 MinValue=0 MaxValue=86400
Thank you very much !