It is currently April 27th, 2024, 6:37 pm

WebParser XMLHttpRequest for weather forecast

Get help with creating, editing & fixing problems with skins
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WebParser XMLHttpRequest for weather forecast

Post by Yincognito »

emp00 wrote: March 18th, 2024, 9:23 pm :thumbup: I am missing words, all I can say today is THANK YOU !

Promised, I will go through your excellent step-by-step intro using RegExr.com. I am not sure, if you already told me to use RegExr or regex101, I must have missed it. Sorry for that! Since I'm a working person "5 days-a-week", I will now reserve a few hours time next weekend to go through your posting. I promise, I will not just copy/paste your (probably close-to-finished) script but will try to understand how to do it myself for future projects (I already have ideas what to do next - all based on OpenMeteo weather data, so I am surely gonna need more RegExp expertise for that). Such detailed guidance is exactly what I need to be able to understand. Practical guidance - very, very well done! Thanks for the time you took for that, much appreciated.

Yesterday I was indeed really frustrated - next weekend I'm gonna make it! Nothing's impossible. Chapeau, Yincognito!
I'm really glad you think this is useful - that was the whole point in explaining it. Thanks for the appreciation, means a lot knowing that the little I can do is helpful and might lead to progress in achieving such nice goals. :thumbup:

Tell you what, take your time, don't rush it, and show that you got the ideas above (along with the last notes about scaling precipitation vertically). A few hours might be too little time to understand the principle AND copy pasting to 5000+ lines the standard / manual way, but if you make the 1st day and half of the 2nd right, I might post a "little" bonus for you afterwards (don't tell anyone about it)... :sly:

Looking forward to hear from you whenever you got the time to tackle this.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
emp00
Posts: 83
Joined: October 7th, 2022, 8:08 pm

Re: WebParser XMLHttpRequest for weather forecast

Post by emp00 »

Yincognito wrote: March 19th, 2024, 1:03 am Looking forward to hear from you whenever you got the time to tackle this.
:confetti Yes - I achieved my goal Very happy with the result!

Took me half a day of concentrated work with np++ using search/replacing and OpenOffice calc for numbering exercises etcpp.

I modified eclectic-tech 's "Open-Meteo Win10 Widgets Weather_1.2024.01.24.rmskin" and added 119 measures (ugh, yeah the "stupid" and surely not the smart way, but WTF it works, that's what counts) for the hourly 5 day forecast values of my solar "global tilted irradiance" specific to my small PV-system. For the green trend display I used your smart line graph code @Yincognito - modified so that it scales automatically to the skin height/width and the actual peak irradiance. Furthermore, my main target, I calculated the daily predicted PV output in KWh/day - based on Open-Meteo's integrated GTI (W/m², simply calculating the sum of hourly values as integral), my PV panel area and it's efficiency. Now I can see how much power will probably be generated in the coming 5 days to improve my grid independency and better planning ahead of my power consumption.

See below a pic how the skin looks as of now but I will probably add rainfall as inverse blue line graph for a precipitation prediction trend. I LOVE TREND graphics and I love how you helped me achieving this goal. MANY MANY thanks!! The skin works, but I'd like to eliminate two "Extra operation" errors in the log, especially the one coming from the trend graphics code (very strange, only appearing at each skin reload but not in running operations afterwards), I will show you in a separate posting.

Due to ecletic-tech 's skin design, it's not a single Rainmeter ini file but a whole package with a bunch of includes etcpp (took me an hour to understand the rationales behind). Is anybody interested in the code with the PV irradiation trend and power prediction? I would need to make an rmskin in order to share it. @Yincognito, you mentioned "a little bonus", not sure if I deserve anything but surely I'd appreciate ideas and insprirations.

Image EDIT: Precipitation probability, inverse scale: added in 15mins :-)
User avatar
Yincognito
Rainmeter Sage
Posts: 7178
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: WebParser XMLHttpRequest for weather forecast

Post by Yincognito »

emp00 wrote: March 23rd, 2024, 9:25 pm :confetti Yes - I achieved my goal Very happy with the result!

Took me half a day of concentrated work with np++ using search/replacing and OpenOffice calc for numbering exercises etcpp.

I modified eclectic-tech 's "Open-Meteo Win10 Widgets Weather_1.2024.01.24.rmskin" and added 119 measures (ugh, yeah the "stupid" and surely not the smart way, but WTF it works, that's what counts) for the hourly 5 day forecast values of my solar "global tilted irradiance" specific to my small PV-system. For the green trend display I used your smart line graph code @Yincognito - modified so that it scales automatically to the skin height/width and the actual peak irradiance. Furthermore, my main target, I calculated the daily predicted PV output in KWh/day - based on Open-Meteo's integrated GTI (W/m², simply calculating the sum of hourly values as integral), my PV panel area and it's efficiency. Now I can see how much power will probably be generated in the coming 5 days to improve my grid independency and better planning ahead of my power consumption.

See below a pic how the skin looks as of now but I will probably add rainfall as inverse blue line graph for a precipitation prediction trend. I LOVE TREND graphics and I love how you helped me achieving this goal. MANY MANY thanks!! The skin works, but I'd like to eliminate two "Extra operation" errors in the log, especially the one coming from the trend graphics code (very strange, only appearing at each skin reload but not in running operations afterwards), I will show you in a separate posting.

Due to ecletic-tech 's skin design, it's not a single Rainmeter ini file but a whole package with a bunch of includes etcpp (took me an hour to understand the rationales behind). Is anybody interested in the code with the PV irradiation trend and power prediction? I would need to make an rmskin in order to share it. @Yincognito, you mentioned "a little bonus", not sure if I deserve anything but surely I'd appreciate ideas and insprirations.

Image EDIT: Precipitation probability, inverse scale: added in 15mins :-)
That's great news - well done, I'm glad that we (eclectic-tech and me) were able to help! See what you can do if you try? :great:

I didn't say the manual way was stupid, just that it takes longer, that's all. The "bonus" was for the case where you found it too laborious to complete the entire job, but obviously now that you did it's no longer necessary. With a few tricks in Notepad++ (like initially copy pasting the 0 to 9 measures, then regex replacing to add 1, 2 and so on before 0..9, as well as vertical selection using CTRL+ALT and automatically numbering incrementally from the menu) you can indeed shorten the time needed to create such bunch of measures considerably.

Don't worry about the refresh error(s), sometimes they cannot be completely avoided, especially when working with Lua scripts and a few other things (not sure if eclectic-tech's skin uses them though). Of course, as I said in the other thread, the advantage of Lua is that you can simply use a single script measure, a 3 lines script with a 3 FOR loops, and 3 WebParser measures getting the whole time, precipitation and irradiance arrays from the json webpage, and you're done with both getting individual values and creating the shape's Path string, without the hassle of copy pasting tons of measures or path parts.

Anyway, as you said, it all ended up well, you're satisfied with an useful skin for your case, and that's all that matters. I'm pretty sure you'll enjoy the skin, especially since you also contributed to its final form and you now know how it works. The important thing is that you accepted the challenge and now you reap the rewards. Many times you find a nice suitable skin for your purpose, but you need more from it, and a bit of extra effort is required to achieve your goal. :thumbup:
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth