It is currently October 11th, 2024, 2:25 am

How to change weather location

Get help with creating, editing & fixing problems with skins
catfive
Posts: 3
Joined: December 4th, 2013, 3:23 am

How to change weather location

Post by catfive »

Hello!
I have been trying to change my weather location, but haven't succeeded. My weather code is USSC0140, and the skin i have is this one: http://squirrel-slayer.deviantart.com/art/Discovery-1-2-for-Rainmeter-now-in-HD-too-410263355?q=gallery%3ARainmeter%2F23941137&qo=14
Any and all help will be greatly appreciated!! Thanks :)
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: How to change weather location

Post by moshi »

the problem is this:

weather.com changed it's feed a few weeks ago. that means for today everything in <part p="d"> tags will no longer be part of the feed in the late afternoon and night. which makes sense, as who needs a "forecast" for the past anyways.

that means that this particular regular expression somebody wrote years ago and many, many people copied and pasted will only work for the earlier part of the day. most skins do not even need 10% of that regular expression btw.

there can be two solutions:

- either somebody writes a clever new regular expression with lookahead assertions that would continue to work in the afternoon.
- or, if your skin does not even need the data in the <part p="d">, <part p="n"> tags, write a regular expression that parses the needed data only

now, i don't know whether your skin needs that data or not. and to be honest i don't want to know as well. my suggestion is using a skin that uses a different service.
i am sure others might be more interested in that problem though.
User avatar
jsmorley
Developer
Posts: 22849
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How to change weather location

Post by jsmorley »

So Moshi, they literally changed the feed? As I recall (It has been years since I used Weather.com) what they used to do was put "N/A" or something like that in the values for the "day" part of the current day forecast, when some hour in the afternoon was reached.

So now they remove the "day" part of the feed entirely at some point in the afternoon? That was unhelpful. Whether or not a "forecast" for the morning makes sense in the evening (it doesn't), having a feed that is of variable composition depending on the time of day certainly means for a slightly more complicated approach to parsing it, and is going to break a lot of older skins that just reacted to the "N/A" with some kind of substitute.

Make no mistake, it's not rocket science to create a skin that parses that variable feed correctly and displays the correct stuff, It's just that for an existing broken skin, it's not as simple as writing a look-ahead assertion in the RegExp, the StringIndex numbers of the child measures are also going to then be variable. At least it needs to be taken into consideration in the design, which of course all those older skins won't have.

Oh well. I far prefer the Yahoo weather approach. They just have a consistent "today forecast" that just changes values in the afternoon, rather than having separate day / night forecasts. I went with Yahoo a couple of years ago, and have never had a lick of trouble.

Edit: Yeah, I see that is what they did. Not sure how we can react to the questions we are going to get in the forums that is the most helpful we can be, while not hand-fixing every old skin that stops working. Each skin is going to have it's own challenges, depending on what parts of the feed the actually use and display.
catfive
Posts: 3
Joined: December 4th, 2013, 3:23 am

Re: How to change weather location

Post by catfive »

Thank you both for your help! I figured out how to fix it. I ended up just going back to the welcome screen of the skin, where it let you input your weather code. Thanks for the advice anyway!
User avatar
jsmorley
Developer
Posts: 22849
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How to change weather location

Post by jsmorley »

catfive wrote:Thank you both for your help! I figured out how to fix it. I ended up just going back to the welcome screen of the skin, where it let you input your weather code. Thanks for the advice anyway!
Wait til it is nighttime where you are, and be sure the skin continues to work. I have no idea what the particular skin is parsing or using, it may be fine.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: How to change weather location

Post by fonpaolo »

I had this problem, since many weather skins I have seen were similar and I started with something similar to have a starting point on how make mine, I had no need to change anything, only a few lookahead assertions to skip "today" when it disappears and now it's fine.
User avatar
moshi
Posts: 1740
Joined: November 13th, 2012, 9:53 pm

Re: How to change weather location

Post by moshi »

jsmorley wrote:So Moshi, they literally changed the feed?
yep, here's the relevant part for right now:

Boston (it's morning):

Code: Select all

<dayf>
        <lsup>12/04/13 8:32 AM EST</lsup>
        <day d="0" t="Wednesday" dt="Dec 4">
        <hi>8</hi>
        <low>2</low>
        <sunr>6:57 AM</sunr>
        <suns>4:12 PM</suns>
        
        <part p="d">
        <icon>32</icon>
        <t>Sunny</t>
        <wind>
      <s>16</s>
      <gust>N/A</gust>
      <d>290</d>
      <t>WNW</t>
    </wind>
        <bt>Sunny</bt>
        <ppcp>0</ppcp>
        <hmid>57</hmid>
      </part>
        <part p="n">
        <icon>45</icon>
        <t>Showers Late</t>
        <wind>
      <s>10</s>
      <gust>N/A</gust>
      <d>159</d>
      <t>SSE</t>
    </wind>
        <bt>Shwrs Late</bt>
        <ppcp>30</ppcp>
        <hmid>75</hmid>
      </part>
      </day>
      </dayf>
Moscow (it's afternoon)

Code: Select all

<dayf>
        <lsup>12/04/13 5:31 PM MSK</lsup>
        <day d="0" t="Wednesday" dt="Dec 4">
        <hi>N/A</hi>
        <low>0</low>
        <sunr>9:40 AM</sunr>
        <suns>5:00 PM</suns>
        
        
        <part p="n">
        <icon>16</icon>
        <t>Snow</t>
        <wind>
      <s>11</s>
      <gust>N/A</gust>
      <d>224</d>
      <t>SW</t>
    </wind>
        <bt>Snow</bt>
        <ppcp>80</ppcp>
        <hmid>92</hmid>
      </part>
      </day>
      </dayf>
User avatar
jsmorley
Developer
Posts: 22849
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How to change weather location

Post by jsmorley »

Yeah, I was just looking at it with Fairfax and Tokyo.

I think I will work up a nice "all items" template that folks can use for Weather.com, although no matter how much we provide in the way of "how to fix it", it will depend on how much the person with the broken skin is willing to put into getting just a bit familiar with changing / creating skins as to how much it help.

I'll do a new thread somewhere in a little bit.
User avatar
fonpaolo
Moderator
Posts: 1387
Joined: April 11th, 2013, 8:08 pm
Location: Italy

Re: How to change weather location

Post by fonpaolo »

I'm interested in the new thread. :thumbup:
As I said it's not that hard to fix (at least if you know how to manage RegExp).
I don't post my code only for a reason, it's designed mostly for my skin, I still parse some data I don't use (maybe in a future...), but a simple copy and paste may not work on other skins.
User avatar
jsmorley
Developer
Posts: 22849
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: How to change weather location

Post by jsmorley »

fonpaolo wrote:I'm interested in the new thread. :thumbup:
As I said it's not that hard to fix (at least if you know how to manage RegExp).
I don't post my code only for a reason, it's designed mostly for my skin, I still parse some data I don't use (maybe in a future...), but a simple copy and paste may not work on other skins.
http://rainmeter.net/forum/viewtopic.php?p=94966#p94966