Menu

phpWeather

Help
2002-08-01
2002-08-17
  • Beckie Pack

    Beckie Pack - 2002-08-01

    It seems the phpWeather module is having problems with the humidity and pow functions?

    The error:
    Warning: Invalid argument(s) passed to pow() in /Users/sites/js.westcentralwisconsin.net/phpwebsite_en/mod/phpweather/phpweather.inc on line 585
    (and each line below)

    Is generated from these lines:

    $decoded_metar['rel_humidity'] = number_format(100 *
        (
         610.710701 +
         44.4293573 * $decoded_metar['dew_c'] +
         1.41696846 * pow($decoded_metar['dew_c'], 2) +
         0.0274759545 * pow($decoded_metar['dew_c'], 3) +
         2.61145937E-4 * pow($decoded_metar['dew_c'], 4) +
         2.85993708E-6 * pow($decoded_metar['dew_c'], 5)
         )
        /
        (
         610.710701 +
         44.4293573 * $decoded_metar['temp_c'] +
         1.41696846 * pow($decoded_metar['temp_c'], 2) +
         0.0274759545 * pow($decoded_metar['temp_c'], 3) +
         2.61145937E-4 * pow($decoded_metar['temp_c'], 4) +
         2.85993708E-6 * pow($decoded_metar['temp_c'], 5)
         ), 1);
               
    Any ideas? The new version of phpweather is different from the module.

    Thanks!
    Beckie
    http://www.westcentralwisconsin.net

     
    • Beckie Pack

      Beckie Pack - 2002-08-01

      okay, i have an idea what is going on.  In my version of php the array variable is not passing as an integer because the pow() function is expecting a number.  I have no idea how to change this because I thought php loosely declared  variables.  I'll be back. Any ideas would be greatly appreciated. Thanks!

       
      • Beckie Pack

        Beckie Pack - 2002-08-01

        okay, i think i fixed it.  i changed it by adding (float) before the $decoded_metar variable. I have no idea if this is really calculating the correct humidity :-).  If you are a weather person, see it at http://js.westcentralwisconsin.net and let me know.

          $decoded_metar['rel_humidity'] = number_format(100 *
            (
             610.710701 +
             44.4293573 * $decoded_metar['dew_c'] +
             1.41696a846 * pow((float)$decoded_metar['dew_c'], intval(2)) +
             0.0274759545 * pow((float)$decoded_metar['dew_c'], 3) +
             2.61145937E-4 * pow((float)$decoded_metar['dew_c'], 4) +
             2.85993708E-6 * pow((float)$decoded_metar['dew_c'], 5)
             )
            /
            (
             610.710701 +
             44.4293573 * $decoded_metar['temp_c'] +
             1.41696846 * pow((float)$decoded_metar['temp_c'], 2) +
             0.0274759545 * pow((float)$decoded_metar['temp_c'], 3) +
             2.61145937E-4 * pow((float)$decoded_metar['temp_c'], 4) +
             2.85993708E-6 * pow((float)$decoded_metar['temp_c'], 5)
             ), 1);
                            
          return $decoded_metar;

         
    • Amgine Neilson

      Amgine Neilson - 2002-08-06

      And you're asking us for help? (shaking head in presence of superior geekiness)

      Amgine

       
      • Beckie Pack

        Beckie Pack - 2002-08-06

        I enjoy figuring things out but being a "geekmom" and having 3 kids always yakking it's difficult to get anything done. So, I ask first, hoping that someone has come across it while trying to figure it out and then I post what I find, hoping that it will help someone else later.

        :-)

        Beckie
        http://www.geekmom.net

         
    • Richard Fedders

      Richard Fedders - 2002-08-11

      Just curious - Where can I get  an updated php weather module?? 

       
    • Paivi

      Paivi - 2002-08-17

      the original phpweather is at http://gimpster.com. the phpws module can be found at my site (http://phpgirl.com). that is the latest one available as far as i know. the changes from the original phpws module are the install/uninstall and $table_prefix support.

      I was working on a new version for this module but i cannot get it (it being the latest from gimpster.com) to update the database or an xml file. so its shelved for now :)

       

Log in to post a comment.