cloudy cloudy

Author Topic: Global Warming Trend Script  (Read 46431 times)

0 Members and 1 Guest are viewing this topic.

Offline drobbins

  • Posts: 1,694
  • Kentucky, USA
    • Cave Country Weather
Re: Global Warming Trend Script
« Reply #15 on: January 18, 2010, 01:04:26 AM »
I also have the troubles and when I deleted "strip_units" it gave an error on the next command "gen_difference". Also the "Current Monthly Avg" only has "F" and no temp.
http://www.cavecountryweather.com/wxglobalwarming.php

curly

  • Guest
Re: Global Warming Trend Script
« Reply #16 on: January 18, 2010, 01:29:40 AM »
Nice script Michael!

mth

  • Guest
Re: Global Warming Trend Script
« Reply #17 on: January 18, 2010, 02:40:22 AM »
I also have the troubles and when I deleted "strip_units" it gave an error on the next command "gen_difference". Also the "Current Monthly Avg" only has "F" and no temp.
http://www.cavecountryweather.com/wxglobalwarming.php

Did the script function before you deleted the "strip_units"?

Blackjack52

  • Guest
Re: Global Warming Trend Script
« Reply #18 on: January 18, 2010, 03:02:06 AM »
Very nice. This will make a nice addition to the wxtempdetail pg.

I'll incorporate tomorrow and probably call the combination "Local Climatolog".

Offline drobbins

  • Posts: 1,694
  • Kentucky, USA
    • Cave Country Weather
Re: Global Warming Trend Script
« Reply #19 on: January 18, 2010, 03:20:03 AM »
Did the script function before you deleted the "strip_units"?
No. it had the same faults as already mentioned. It looks like "strip_units" is referencing some php code that I don't have? 

mth

  • Guest
Re: Global Warming Trend Script
« Reply #20 on: January 18, 2010, 03:23:07 AM »
No. it had the same faults as already mentioned. It looks like "strip_units" is referencing some php code that I don't have? 

drobbins,

I've got some help from friends on this one.  I'm confused to why some with the carterlake templates have it working fine and a couple of people are having issues.  I will let you know when I've figured this out.  Sorry.  :oops:

Michael

Offline BfdWx

  • Posts: 1,607
  • Branford Connecticut
    • Southern CT Weather
Re: Global Warming Trend Script
« Reply #21 on: January 18, 2010, 03:31:55 AM »
This function is in my dashboard.....

Code: [Select]
// strip trailing units from a measurement
// i.e. '30.01 in. Hg' becomes '30.01'
function strip_units ($data) {
  preg_match('/([\d\.\+\-]+)/',$data,$t);
  return $t[1];
}

I think this might be what is needed?

Jack

curly

  • Guest
Re: Global Warming Trend Script
« Reply #22 on: January 18, 2010, 03:35:34 AM »
Are you sure all of the required tags are in the testtags.php file?
If a tag is missing, the function strip_units that is in the function gen_difference will fail.
« Last Edit: January 18, 2010, 03:44:05 AM by curly »

Offline i_fiorentino

  • Alessandro Bardi
  • Posts: 1,704
  • 150 mls Candeglia (Pt), Tuscany, Italy
    • Meteopistoia.it
Re: Global Warming Trend Script
« Reply #23 on: January 18, 2010, 06:51:36 AM »
Hi Michael,
i have the same issue of Jack,
It should be this function
Code: [Select]
<?php echo [b]gen_difference[/b]($avtempjannow$avtempjan$uomTemp,
     '%s'.$uomTemp.' Warmer than All-Time Average Temperature.',
   
'%s'.$uomTemp.' Colder than All-Time Average Temperature.'); ?>
on line 71

I know that i have an error in my ajax dashboard but i believe that it should interfere with this issue.
Many thanks,

Alessandro
« Last Edit: January 18, 2010, 07:00:34 AM by i_fiorentino »

Offline K3JAE

  • Posts: 1,015
  • CoCoRaHS: TN-CR-7; WxUngrd: KTNBRUCE2; CWOP: AT066
  • Carroll County, TN, USA
    • K3JAE's Weather Station
Re: Global Warming Trend Script
« Reply #24 on: January 18, 2010, 08:01:46 AM »
I'll throw my hat in the ring of those who installed the script but getting same error as those already awaiting an answer.

I absolutely verified all 24 tags in testtags.txt and they were already. So I shall await the final verdict.


73's de K3JAE
John
K3JAE Weather Station

Offline Axelvold

  • Posts: 1,081
  • Axelvold / Sweden
  • Axelvold, Sverige
    • Axelvold's weather and photo
Re: Global Warming Trend Script
« Reply #25 on: January 18, 2010, 08:39:19 AM »
Thanks for sharing, I will add this to my site tonight.



Offline Axelvold

  • Posts: 1,081
  • Axelvold / Sweden
  • Axelvold, Sverige
    • Axelvold's weather and photo
Re: Global Warming Trend Script
« Reply #26 on: January 18, 2010, 09:24:13 AM »
I have the same problem that some others also is having.

I get this error.

Code: [Select]
Fatal error: Call to undefined function gen_difference()



Offline magical46

  • Phils Weather
  • Posts: 598
  • Farnham, Surrey
    • Phils Weather
Re: Global Warming Trend Script
« Reply #27 on: January 18, 2010, 09:37:47 AM »
hi
I too am getting the same error, I know nothing about coding but a thought occured to me, I am using the "Alterative ajax-Dashboard" rather than the original which one are others with the same issue using? Could it be something to do with which version your using?
Phil

Offline pinto

  • Posts: 766
  • Belgium
    • weather station Kampenhout
Re: Global Warming Trend Script
« Reply #28 on: January 18, 2010, 10:15:17 AM »
hi
I too am getting the same error, I know nothing about coding but a thought occured to me, I am using the "Alterative ajax-Dashboard" rather than the original which one are others with the same issue using? Could it be something to do with which version your using?
Phil

Yes  :)


Code: [Select]
//=========================================================================
// strip trailing units from a measurement
// i.e. '30.01 in. Hg' becomes '30.01'
function strip_units ($data) {
  preg_match('/([\d\.\+\-]+)/',$data,$t);
  return $t[1];
}


//=========================================================================
//  generate an up/down arrow to show differences

function gen_difference( $nowTemp, $yesterTemp, $Legend, $textUP, $textDN) {
  global $imagesDir;
  $diff = round(strip_units($nowTemp) - strip_units($yesterTemp),2);
  $absDiff = abs($diff);
  $diffStr = sprintf("%01.0f",$diff);
  $absDiffStr = sprintf("%01.0f",$absDiff);
  if ($diff == 0) {
 // no change

$image = '&nbsp;';
 
  } elseif ($diff > 0) {
// today is greater
$msg = sprintf($textUP,$absDiff);
$image = "<img src=\"${imagesDir}rising.gif\" alt=\"$msg\" title=\"$msg\" width=\"7\" height=\"8\" style=\"border: 0; margin: 1px 3px;\" />";

 
  } else {
// today is lesser
$msg = sprintf($textDN,$absDiff);
$image = "<img src=\"${imagesDir}falling.gif\" alt=\"$msg\" title=\"$msg\" width=\"7\" height=\"8\" style=\"border: 0; margin: 1px 3px;\" />";
   
  }
   if ($Legend) {
       return ($diff . $Legend . $image);
} else {
   return $image;
}
}


Offline magical46

  • Phils Weather
  • Posts: 598
  • Farnham, Surrey
    • Phils Weather
Re: Global Warming Trend Script
« Reply #29 on: January 18, 2010, 10:26:16 AM »
Pinto
The code in the above post, what should I do with it?
Phil

 

cumulus