Author Topic: Thermometer Autoscale  (Read 1424 times)

0 Members and 1 Guest are viewing this topic.

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1226
  • BismarckWeather.net
    • BismarckWeather.net
Thermometer Autoscale
« on: October 31, 2017, 02:53:32 PM »
I was noticing today that my thermometer on my mainpage doesn't scale.  I looked at the thermometer.php file and it is set to autoscale=true.

I've did tweak the max and min numbers to reflect it does get hotter and colder here in ND that the defaults.  But that's all I've tweaked in that file.
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8884
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Thermometer Autoscale
« Reply #1 on: October 31, 2017, 04:16:10 PM »
I'd suggest you use
Code: [Select]
$TmaxF = 110;     // maximum F temperature on thermometer
$TminF = -30;      // minimum F temperature on thermometer
$TincrF = 5;      // increment number of degrees F for major/minor ticks on thermometer
which is the default setting.  The thermometer will autoscale up or down depending on the min/max temperatures so there will be a $TincrF value below the min temp displayed and the scale will autorange. 

You can test it by using ?current=nnn&max=nnn&min=nnn like

http://www.bismarckweather.net/thermometer.php?current=-15&min=-25&max=32

to see how the script reacts.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1226
  • BismarckWeather.net
    • BismarckWeather.net
Re: Thermometer Autoscale
« Reply #2 on: October 31, 2017, 04:23:06 PM »
I flipped the thermometer.php file back to those settings.  It still doesn't appear to be autoscaling.
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1226
  • BismarckWeather.net
    • BismarckWeather.net
Re: Thermometer Autoscale
« Reply #3 on: October 31, 2017, 04:24:40 PM »
I had another thought.  I recently flipped my site up from PHP 5.4 to PHP 7.0.  Could that be causing it?
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8884
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Thermometer Autoscale
« Reply #4 on: October 31, 2017, 04:31:26 PM »
Your thermometer.php is at V1.13 and current is V1.15, but that shouldn't change the WD display (both work with PHP 7+).

The autoscale is engaged only when the max is above the $TmaxF setting, or the min is below the $TminF setting -- then the scale is adjusted by $TincrF degrees (up for max, down for min) but a new min won't change the max displayed value and vice versa -- the scale doesn't shrink, it only expands.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8884
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Thermometer Autoscale
« Reply #5 on: October 31, 2017, 04:32:57 PM »
Correction,
Try
Code: [Select]
$TmaxF = 105;     // maximum F temperature on thermometer
$TminF = 25;      // minimum F temperature on thermometer
$TincrF = 5;      // increment number of degrees F for major/minor ticks on thermometer
and let the scale do it's autoadjust as needed.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1226
  • BismarckWeather.net
    • BismarckWeather.net
Re: Thermometer Autoscale
« Reply #6 on: October 31, 2017, 04:48:38 PM »
I re-downloaded the USA Template and grabbed the latest thermometer.php file from the ZIP.  I left all the settings as is.  105/25/5  Uploaded the file.  Still not scaling.
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8884
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Thermometer Autoscale
« Reply #7 on: October 31, 2017, 06:08:35 PM »
I'm not sure I understand what you mean by 'Still not scaling'.

Looking at my thermometer on my site, the top tick is 105 F, the bottom tick is 25 F aligning with the $TmaxF/$TminF settings.

Your current thermometer (with a red max at 41F and a blue min at 21F) shows top tick at 105F and bottom tick on the scale at 15F.  So your current conditions/min/max have caused the scale to expand downward from 25F to 15F as the bottom tick.  That's what autoscale does.

So I'm puzzled.... help me to better understand your concern.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1226
  • BismarckWeather.net
    • BismarckWeather.net
Re: Thermometer Autoscale
« Reply #8 on: October 31, 2017, 06:21:10 PM »
Maybe I'm not understanding the autoscale and max/min settings.

In my mind, I thought auto scale would adjust the top/bottom numbers so that the current temp was more in the middle. 

Since we can get 100 degrees in summer and -30 in winter, should I adjust my numbers?
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8884
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Thermometer Autoscale
« Reply #9 on: November 01, 2017, 12:11:49 AM »
The default settings of 105F max and 25F min puts 'comfortable' 65to70F in the midpoint (by design).  I'd recommend you keep the default settings, and have the autoscale expand the range as needed based on your min/max/current for the day.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1226
  • BismarckWeather.net
    • BismarckWeather.net
Re: Thermometer Autoscale
« Reply #10 on: November 01, 2017, 08:42:28 AM »
So you're saying when we get below zero temps here, the bottom end of the thermometer will autoscale downward then?
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

Offline saratogaWX

  • Administrator
  • Forecaster
  • *****
  • Posts: 8884
  • Saratoga, CA, USA Weather - free PHP scripts
    • Saratoga-Weather.org
Re: Thermometer Autoscale
« Reply #11 on: November 01, 2017, 12:02:36 PM »
Correct.  You can see that effect by adding current,min,max arguments to the thermometer.php script like:

http://www.bismarckweather.net/thermometer.php?current=-24&min=-27&max=-5

When testing that way, just make sure that current is >= min and <= max.
Ken True/Saratoga, CA, USA main site: saratoga-weather.org
Davis VP1+ FARS, Blitzortung RED, GRLevel3, WD, WL, VWS, Cumulus, Meteobridge
Free weather PHP scripts/website templates - update notifications on Twitter saratogaWXPHP

Offline 92merc

  • BismarckWeather.net
  • Forecaster
  • *****
  • Posts: 1226
  • BismarckWeather.net
    • BismarckWeather.net
Re: Thermometer Autoscale
« Reply #12 on: November 01, 2017, 12:33:17 PM »
OK, that makes sense then.  When I saw "autoscale" I pictured it keeping the red in the middle and sliding top/bottom as needed.

So it's working as advertised and will compensate for our low temps here.  Good enough for me.  Thanks for the clarification.
https://www.BismarckWeather.net
Davis VP2, Cumulus, WeatherDisplay, Blitzortung, Saratoga Scripts, NOAA Stream via PI

 

anything