It is currently March 29th, 2024, 6:41 am

"Minimal Typography" - Weather constantly displaying wrong

Get help with creating, editing & fixing problems with skins
cutethulhoo

"Minimal Typography" - Weather constantly displaying wrong

Post by cutethulhoo »

Hey folks,
I did a quick search through this fourm to see if anyone else had an issue like this, but I was unable to find a soultion.
I am wanting to use The Minimal Typography skin for Weather. However, no matter what I do, it will only show the weather as -18C (which, while it does get that cold here, I promise you its not that cold today!)

Here is the base code; the only thing I have changed here is the information for my location.

Code: Select all

[Rainmeter]
@include=#@#/var.txt
LeftMouseUpAction=["https://www.google.com/search?q=weather+#location#"]

[Metadata]
Author=http://joeRob2468.deviantart.com | http://lysy1993lbn.deviantart.com
Information=Part of Minimal Typography suite by http://lysy1993lbn.deviantart.com/

;----------MEASURES----------

[MeasureWeatherRSS]
Measure=Plugin
Plugin=WebParser
Url=http://wxdata.weather.com/wxdata/weather/local/CAXX0126?cc=*&unit=m&dayf=0
RegExp=(?siU)<link.*>(.*)</link>.*city=\"(.*)\".*sunrise=\"(.*)\".*sunset=\"(.*)\".*<image>.*<url>(.*)</url>.*<title>.*:.*m .*(.*)</title>.*lat>(.*)<.*long>(.*)<.*yweather:condition.*text=\"(.*)\".*code=\"(.*)\".*temp=\"(.*)\".*yweather:forecast.*day=\"(.*)\".*high=\"(.*)\".*code=\"(.*)\".*yweather:forecast.*day=\"(.*)\".*high=\"(.*)\".*code=\"(.*)\".*
FinishAction=!SetOption "MString" "Text" "%1°#unit# %2"
UpdateRate=3000

[MeasureF]
Measure=Plugin
Plugin=WebParser
Url=[MeasureWeatherRSS]
StringIndex=11

[MeasureC]
Measure=Calc
Formula=(MeasureF - 32) / 1.8
Substitute=" ":""

[MeasureCondition]
Measure=Plugin
Plugin=WebParser
Url=[MeasureWeatherRSS]
StringIndex=9

[Mtitle]
Meter=String
MeterStyle=Style1
Text=#location#

[Mstring]
X=[Mtitle:W]
DynamicVariables=1
Meter=String
MeterStyle=Style2
MeasureName=Measure#unit#
MeasureName2=MeasureCondition
NumOfDecimals=0
Text=loading
There is also a VAR file, where the weather variables look like this (again, only edit was to have my location displayed)

Code: Select all

;WEATHER
;Go to http://www.weather.com to get city-code.
WeatherCode=CAXX012
;Your city name; it's for display purposes only. You can type just weather
Location=Edmonton
;Use either "C" for "Celcius" or "F" for "Farenheit" in Unit.
unit=C
Any help is appreciated!
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: "Minimal Typography" - Weather constantly displaying wrong

Post by balala »

That's happening because your RegExp option, used on the [MeasureWeatherRSS] measure is wrong. Due this, the [MeasureF] (and neither the [MeasureCondition]) can't return a value. In such cases, Rainmeter treats its value as being 0. The value returned by the [MeasureC] measure is calculated based on this (nonexistent or zero) value. The rounded value of (0-32)/1.8 is equal with -18, that's why the [MeasureC] measure always returns -18, no matter what is the real temperature.
First a simple fix: replace the RegExp option with the following one

Code: Select all

[MeasureWeatherRSS]
Measure=Plugin
...
RegExp=(?siU)<weather ver="(.*)">.*<dnam>(.*)</dnam>.*<lat>(.*)</lat>.*<lon>(.*)</lon>.*<sunr>(.*)</sunr>.*<suns>(.*)</suns>.*<zone>(.*)</zone>.*<tmp>(.*)</tmp>.*<flik>(.*)</flik>.*<t>(.*)</t>.*<icon>(.*)</icon>.*<moon>.*<icon>(.*)</icon>.*<t>(.*)</t>.*</moon>
Leave untouched the other options of the [MeasureWeatherRSS] measure.
Then replace the StringIndex options of the [MeasureF] and [MeasureCondition] measure, as it follows:

Code: Select all

[MeasureF]
...
StringIndex=8

[MeasureCondition]
...
StringIndex=10
Theoretically this would be the solution. however I'm not sure why you want to convert the Fahrenheit temperatures to Celsius, because from the first moment, you're using the metric system, which returns the temperatures in Celsius degrees. I'd remove the [MeasureC] measure and would replace the name of the [MeasureF] measure with [MeasureC], getting the temperatures directly in Celsius degrees. I suppose initially the Minimal Typography skin have used the imperial system, getting the temperatures in Fahrenheit degrees, then converting them. But there's no need of such action any more.
User avatar
FreeRaider
Posts: 826
Joined: November 20th, 2012, 11:58 pm

Re: "Minimal Typography" - Weather constantly displaying wrong

Post by FreeRaider »

It's normal, the RegExp option is not good for wxdata. You need to change it.

Edit: balala beats me.

P.S.: you can use "m" for Celsius or "f" for Fahrenheit.
cutethulhoo

Re: "Minimal Typography" - Weather constantly displaying wrong

Post by cutethulhoo »

balala wrote:That's happening because your RegExp option, used on the [MeasureWeatherRSS] measure is wrong. Due this, the [MeasureF] (and neither the [MeasureCondition]) can't return a value. In such cases, Rainmeter treats its value as being 0. The value returned by the [MeasureC] measure is calculated based on this (nonexistent or zero) value. The rounded value of (0-32)/1.8 is equal with -18, that's why the [MeasureC] measure always returns -18, no matter what is the real temperature.
First a simple fix: replace the RegExp option with the following one.

This worked! Thank you so much! I know very little about the inner workings/coding of Rainmeter, so I'm glad even I could understand this fix.
Thank you again!
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: "Minimal Typography" - Weather constantly displaying wrong

Post by balala »

I'm glad if you understood my explanation.
If you'll keep working, after a while you'll be able to write / modify these options, but be careful: Rainmeter can become addictive. Believe me, I know...