Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Help with script/weather station project

  • 16-12-2015 10:01am
    #1
    Registered Users, Registered Users 2 Posts: 23,157 ✭✭✭✭


    Hey guys, not too sure if this is the right place to put this, but sure I'll give it a go.

    I have a raspberry pi 1 that I've setup as a weather station. It has a small 3" screen, and is setup to display the current weather. It's working well, and thanks to some projects found on google I have my own version running nicely.

    Next on my list is to incorporate an image of a rainfall radar over Dublin. My plan was to use this image found on:

    http://www.met.ie/latest/rainfall_radar.asp

    And crop/resize and place in the corner of the screen. However, my issue is that I can't wget the image. If you right click on the image, and copy it's location, you get:

    http://www.met.ie/weathermaps/radar2/WEB_radar4_201512160930.png

    Which looks very promising, however you receive a 404 error when you try to directly access it. I've done a wget -p to download everything on the page and it didn't work either. Anyone have any ideas on how to approach this?


Comments

  • Registered Users, Registered Users 2 Posts: 1,110 ✭✭✭Skrynesaver


    Include a referer header...
     wget  "http://www.met.ie/weathermaps/radar2/WEB_radar4_201512161030.png" --referer "http://www.met.ie/latest/rainfall_radar.asp"
    
    seems to work here


  • Registered Users, Registered Users 2 Posts: 9,605 ✭✭✭gctest50


    ............ you get:

    http://www.met.ie/weathermaps/radar2/WEB_radar4_201512160930.png

    Which looks very promising.......

    2015...12..16...0930


  • Registered Users, Registered Users 2 Posts: 9,605 ✭✭✭gctest50


    little widgety thing maybe ?

    http://www.met.ie/widgets/latest-mini.asp
    <iframe src="http://www.met.ie/widgets/latest-mini.asp&quot; style=" border-width:0 " width="134" height="222" frameborder="0" scrolling="no"></iframe>


  • Registered Users, Registered Users 2 Posts: 23,157 ✭✭✭✭Alanstrainor


    Include a referer header...
     wget  "http://www.met.ie/weathermaps/radar2/WEB_radar4_201512161030.png" --referer "http://www.met.ie/latest/rainfall_radar.asp"
    
    seems to work here

    This looks interesting! Hopefully this will work, I'll only get a chance this evening to test. I'll post up my results, and hopefully my working weather station widget!


  • Registered Users, Registered Users 2 Posts: 23,157 ✭✭✭✭Alanstrainor


    Include a referer header...
     wget  "http://www.met.ie/weathermaps/radar2/WEB_radar4_201512161030.png" --referer "http://www.met.ie/latest/rainfall_radar.asp"
    
    seems to work here

    Boom! We're in business, this is exactly what I was looking for! Thanks a lot!


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 23,157 ✭✭✭✭Alanstrainor


    Alright, so this is what I've been up to.

    I have a raspberry pi 1 that was sitting idle. And it also has a small touch screen that sits on top of it. So I could use it to display whatever information I wanted.

    I came across this project for a weather forecast display for just my setup:

    http://blog.jacobean.net/?p=1016

    I implemented this guys code and had a nice little setup, but instead of having a random weather icon in the corner, I wanted an image of the rainfall radar over Dublin.

    Now, my scripting/logic is pretty terrible, but I have it working now:

    http://imgur.com/gZnSmmL

    There are probably bugs, mostly due to the way the met rainfall radar updates. Essentially, the radar doesn't update at a set time, and it's random as far as I can tell. So I just try and scrape the latest image I can find on met for my script.

    Then once I have a full image of the entire country, I crop/convert the image and then can display it on my small low res screen.

    So thanks for the help! Much appreciated.


  • Registered Users, Registered Users 2 Posts: 1,065 ✭✭✭Snowbat


    radar4_6hr.xml lists the images for the last 6 hours (needs referrer string as above).
    wget -O - "http://www.met.ie/weathermaps/radar2/radar4_6hr.xml"  --referer "http://www.met.ie/latest/rainfall_radar.asp"
    

    Filename of the most recent png:
    wget -q -O - "http://www.met.ie/weathermaps/radar2/radar4_6hr.xml" --referer "http://www.met.ie/latest/rainfall_radar.asp" | grep ".png" | tail -1 | awk -F'"' '{print $8}'
    


  • Closed Accounts Posts: 18,966 ✭✭✭✭syklops


    Alright, so this is what I've been up to.

    I have a raspberry pi 1 that was sitting idle. And it also has a small touch screen that sits on top of it. So I could use it to display whatever information I wanted.

    I came across this project for a weather forecast display for just my setup:

    http://blog.jacobean.net/?p=1016

    I implemented this guys code and had a nice little setup, but instead of having a random weather icon in the corner, I wanted an image of the rainfall radar over Dublin.

    Now, my scripting/logic is pretty terrible, but I have it working now:

    http://imgur.com/gZnSmmL

    There are probably bugs, mostly due to the way the met rainfall radar updates. Essentially, the radar doesn't update at a set time, and it's random as far as I can tell. So I just try and scrape the latest image I can find on met for my script.

    Then once I have a full image of the entire country, I crop/convert the image and then can display it on my small low res screen.

    So thanks for the help! Much appreciated.

    Let us know if theres anything else you need help with. I love chipping in on projects like this.

    EDIT: Also, Moar pics please. I really want to see this touchscreen module for the R-Pi.


  • Registered Users, Registered Users 2 Posts: 23,157 ✭✭✭✭Alanstrainor


    Snowbat wrote: »
    radar4_6hr.xml lists the images for the last 6 hours (needs referrer string as above).
    wget -O - "http://www.met.ie/weathermaps/radar2/radar4_6hr.xml"  --referer "http://www.met.ie/latest/rainfall_radar.asp"
    

    Filename of the most recent png:
    wget -q -O - "http://www.met.ie/weathermaps/radar2/radar4_6hr.xml" --referer "http://www.met.ie/latest/rainfall_radar.asp" | grep ".png" | tail -1 | awk -F'"' '{print $8}'
    
    syklops wrote: »
    Let us know if theres anything else you need help with. I love chipping in on projects like this.

    EDIT: Also, Moar pics please. I really want to see this touchscreen module for the R-Pi.

    Sorry guys! Completely forgot this thread, and I wasn't expecting more replies!

    Snowbat, that looks amazing! Definitely better than my current messy implementation! I had a script that tries different download strings, and works back through the times until it has an image! Not efficient, and pretty messy in terms of logging!

    I'll post up some more pics if people want! But it's a very simple setup really. And it's been pretty reliable actually, it's had a few hiccups where Weather.com seems to return str instead of int for wind speed values etc. But after a while it all comes back and shows my lovely weather screen. I do actually use this in the mornings as I get ready to cycle to work. Far handier than I had originally thought.


  • Closed Accounts Posts: 18,966 ✭✭✭✭syklops


    it's had a few hiccups where Weather.com seems to return str instead of int for wind speed values etc. But after a while it all comes back and shows my lovely weather screen. I do actually use this in the mornings as I get ready to cycle to work. Far handier than I had originally thought.

    Why not change to int, regardless of what weather.com gives you?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 23,157 ✭✭✭✭Alanstrainor


    syklops wrote: »
    Why not change to int, regardless of what weather.com gives you?

    Weather.com was giving 'calm' as it's return for wind speed! I'm actually not sure what the hell happened with it. As it seemed to work again about 6 hours later.


  • Registered Users, Registered Users 2 Posts: 23,157 ✭✭✭✭Alanstrainor


    Snowbat wrote: »
    radar4_6hr.xml lists the images for the last 6 hours (needs referrer string as above).
    wget -O - "http://www.met.ie/weathermaps/radar2/radar4_6hr.xml"  --referer "http://www.met.ie/latest/rainfall_radar.asp"
    

    Filename of the most recent png:
    wget -q -O - "http://www.met.ie/weathermaps/radar2/radar4_6hr.xml" --referer "http://www.met.ie/latest/rainfall_radar.asp" | grep ".png" | tail -1 | awk -F'"' '{print $8}'
    

    Well, that worked a charm. My 20 line script is now 2 lines! Cheers, where do you come across this XML? I tried googling for info on all this and didn't get too much info!

    And some info on the screen i have attached to the pi:
    http://www.banggood.com/3_2-Inch-TFT-LCD-Display-Module-Touch-Screen-For-Raspberry-Pi-B-B-A-p-1011516.html

    It seems like there are a lot better options for screens if you're willing to spend a bit more. Just search "pi screen" or similar on that site!

    The Pi is just sitting infront of my TV, balancing on it's side and not in any case. It has ethernet and power connected. I could make things better with a cheap wifi adapter perhaps.


  • Registered Users, Registered Users 2 Posts: 1,065 ✭✭✭Snowbat


    I found the XML by right-clicking on the graphic, inspect element. Then I reloaded the site with the network tab of the browser dev tools open to see which files were being retrieved, looking for the one that generated the html. It took a little while to find but I was curious :)


Advertisement