Post #187

A scientific weather garden

22nd January 2004, mid-afternoon | Comments (11)

Over in Holland, a guy called Roberto Antonio Ferreira De Almeida (catchy!) has taken my weather idea and got all ‘scientific on its ass’.

A snippet from Roberto's garden image

I decided to run a simulation of flowers in a garden. You can see it on the top of this page: each square is a flower. Every ten minutes a Python script parses the page for De Bilt, retrieving the local temperature. The garden is then ‘evolved’ using this temperature, and the picture of the garden is rebuilt to reflect the new garden.

The evolution of the garden is based on cellular automata and genetic algorithms. Each flower, as you can see, has a color, encoded in its DNA as an RGB code … Each flower also has an albedo, which is a measure of how dark or how light it is…

Each flower also has an ‘efficiency’, which depends on the local temperature. Black flowers do better when it’s cold, since they can absorb more light … White flowers can live in temperatures from 20 to 40 °C [but] excel at 30 °C…

Every 10 minutes, during the evolution of the garden, a flower can possibly be replaced by one of its 8 neighbours. The probability of a given flower being chosen to replace another one depends on its efficiency, a hard-coded natural selection. The consequence of this is that when it’s cold in De Bilt, dark flowers dominate the garden. On the other hand, light flowers blossom when the temperature is higher. This means that you can have an idea of the temperature here just by looking at the overall appearance of the garden.

Or, as I called it, a ‘fuzzy thermometer’.

Clever chap. See the full explanation on his site

Jump up to the start of the post

Comments (11)

Jump down to the comment form ↓

  1. David:

    Wow, I was *this close* to sending you, Dunstan, some ideas about your Safari CSS issue (downloading all div#scene bg images) when this post "cropped up." :) So add a Python script as number four:

    1) you can add an event handler to your .htaccess file to parse css files (or another extension, such as ".cssp" so the server doesn't parse all of your css files):

    AddHandler application/x-httpd-php .cssp

    then add a function to your "night.cssp" file to write a single background image to div#scene rather than 86 class declarations.

    The tip about the .htaccess handler came from this posting to [thelist] by Andy Warwick:

    A reply to Andy's message implied that no handler was necessary; just have PHP output CSS declarations, but I've tried this (using @import) and my server would not parse the CSS (.php) file:

    2) Session variable. I see you already use this feature. Would this avoid re-querying of the weather data?

    3) Use PHP to write the style declaration on each page.

    Hope these are helpful.

    Posted 26 minutes after the fact
    Inspired: ↓ Dunstan, ↓ Chris Neale
  2. DarkBlue:

    His website looks remarkably similar to yours too. Imitation is the sincerist form of plagiarism eh?

    Posted 1 hour, 42 minutes after the fact
    Inspired: ↓ Dunstan
  3. Dunstan:

    Oh, I don't think so - I certainly didn't think they looked too much alike.

    Sure the layout is similar, but there's only so many layouts you can have.

    Posted 1 hour, 56 minutes after the fact
    Inspired by: ↑ DarkBlue
  4. Dunstan:

    David, thanks for your comment - some responses:

    [1] I like the sound of that a lot. I'll check it out, thank you.

    [2] I could use a session variable you're right... I haven't up to now because I wanted people to get 'real-time' weather, not just the weather at the point they first arrived. I'll have to think about this.

    [3] I've not used this method because I only want browsers who are @importing CSS to get the header graphic. Writing it into each page using CSS will mess that up.

    [4] Python - haven't a clue about it :op

    Thanks for the ideas, I'll let you know how I get on with [1] :o)

    Posted 2 hours, 11 minutes after the fact
    Inspired by: ↑ David
  5. Lee:

    Now that is fantastic, obviously Dunst gets immense credit for his, but my scientific bent is currently curling it's toes with joy at that Dutch guys header.

    I think this could be the wave of the future - real time, real world interaction. Kinda reminds me of the days when you could send messages to the Netscape board above the dev team and view them via web cam.

    Posted 2 hours, 23 minutes after the fact
  6. Chris Vincent:

    Whoa... It's amazing what one guy's idea can inspire in others. Too bad you wouldn't know what that header was sans explanation. Still really cool though...

    Posted 3 hours, 7 minutes after the fact
    Inspired: ↓ Roberto
  7. Roberto:

    Chris: thanks for the comment. I've added some Javascript to the page. Now if you hover your mouse for half a second over the image a link leading to the explanation appears.

    Posted 17 hours, 51 minutes after the fact
    Inspired by: ↑ Chris Vincent
  8. Sans:

    Well of course now that you've set the standard for cool headers, you have to up the ante. Perhaps wireless GPRS trackers on your sheep so that their position in the header mimics that of their real counterparts? Or perhaps your could get that info from hourly satellite photography?

    I'm not sure what kind of sheep/herder privacy issues that may violate though...

    Posted 23 hours, 40 minutes after the fact
    Inspired: ↓ Dris
  9. Dris:

    Haha... Nice one.

    I actually have an idea of my own, but I don't know where to get feeds for presidential polls...

    Yes, I have malcontent.

    Posted 1 day, 5 hours after the fact
    Inspired by: ↑ Sans
  10. Chris Neale:

    you don't use php to parse .css

    you have a .php file with css declarations, and a header();



    header('Content-type: text/css');


    a {

    body {
    declaration: <?php echo $value; ?>;


    or whatever

    Posted 1 day, 7 hours after the fact
    Inspired by: ↑ David
    Inspired: ↓ David
  11. David:

    I've been wondering about that for some time now. Dunstan, I should have prefaced my comments with a sentence about my lack of expertise in PHP! Thanks for the enlightenment, Chris.

    Posted 4 days, 22 hours after the fact
    Inspired by: ↑ Chris Neale

Jump up to the start of the post

Add your comment

I'm sorry, but comments can no longer be posted to this blog.