After recovering from our latest PC meltdown, we are systematically fixing our php scripts and pages. One that is generating an odd error is the cloudbase.php script. All that appears is the alternative text. If we navigate to the image is supposed to be, this is what is shown: “Moon age can only be determined before 2nd Jan 2022, 18:35” The odd part of this is the cloud base image is being generated and ftp’d to the correct directory on our web server. Any ideas how to troubleshoot and correct this would be greatly appreciated.
Is this any help?
@bitsostring
Absolutely helps, we ran Ken’s version checker and found that our Cloud base script is out of date, along with 60% of our remaining scripts.
Lots of work ahead!
Thank you and thanks to Ken for that version checker!
We will be updating that script as well as the rest.
Cheers and Merry Christmas!
Looking through these passed reply’s do not cover my issue with my cloudbase php script designed for Weather Display.
As you can see from the attached image there are strange text artifacts…namely that A symbol just before the degree sign,. This only shows on the temperature readings, and as far as I’m aware is do to the way the page is possibly scripted. Anybody got an answer as to how to remove these menaces ? They do not appear anywhere else on the website, not on any other pages, just on this cloudbase script, which is the "Cartelake/TNET/Saratoga PWS Website templates (WD and VWS) cloudbase.php, ver. 2.1.
Thanks in advance for any answers.
Nick. dw7240.com
That often appears when a script has been edited and the original encoding has not been retained: the standard Saratoga scripts are encoded in ANSI, but I am not sure about cloud-base.php, which is from the alt-dashboard . . . sorry.
I hope someone else can help.
Hi,
Thanks for that info, leads me to another answer to what could be the issue, yes i did make small changes like colors to text etc, but the script was saved in Notebook + as the original .php file, so not entirely sure that the original script coding would of been altered, unlike it was saved in say the original Notebook., but there’s an answer somewhere.
Hi,
So I’ve tested saving with various encoding, from Ansi to UTF8 etc, and have managed to add another A symbol lol, so went back to original script, back to the single A character before the degree symbol. Hmm???
Or you could try the latest version 2.5: download the alt-dashboard here.
Hi,
Than You everyone, funny thing is I thought I was up to date, especially with the version of the cloudbase script, but no, there was one later version sneaked in, lol. Only listed in the Alt-Dashboard zip folder and not available on its own. My version was from a Cumulus zip, just changed the parameter switches in the file to WD as stated you can do to allow the file to work…which it did, but those degree symbol issues were a nuisance. Seems it was the later file update from Ken True which was for errata update to do with php ver 8.2 which overcome the display errors. So all is good, a big thank you for all your help !!
Guess I’ll be checking out php compatibility on scripts next time, its the little things which can cause headaches sometimes, not always the obvious.
Thanks Again,
Nick. dw7240.com.
Thought I’d try the latest cloud-base.php script (in a separate page, for now) on my Saratoga template, but I can’t even get it to run. . . Probably a wrong path somewhere
Running cloud-base.php in a browser returns 504 Gateway Time-out
Hi Bitsostring,
I run my cloudbase from the menubar, as can be seen from my website…https://dw7240.com…To test I run the script directly from the mail site, so https://dw7240.com/Base-Canada/cloud-base.php, this will show if the page runs or not, also the error codes at top of cloud-base.php…
<?php //... you must not have any spaces in front of this
//... neither should the following files have either spaces before/after the opening/closing php tags
// 1) pws-settings.php
// 2) pws-translation.php
// 3) testtags.php
error_reporting(E_ALL ^ E_NOTICE);
error_reporting(E_ALL);
//ini_set('display_errors','1');
As you can see if the above error ---- ini_set('display_error,‘1’) ---- is switched on (// removed) the script won’t display, i’m not a great coder so don’t know why this is, but with that error code // out as above, the script works floorlessly.
Thanks again for your help in the past !
Nick. dw7240.com
Thanks. I tried commenting out the line, but still not running. . .
And I’ve never heard of two of the files mentioned above that, with the pws- prefix.
Hi bitsostring,
Agree with you on those 2 lines, but this is the exact Alt Dashboard script which you suggested I use, I only changed the text coloring to display clearer etc.
Wish I had an answer to your setup running, I can only tell you that my sartoga Base plate in mainly Base Canada, but also like others has a variety of Base USA, and Base world thrown in the mix.
What shows when you run the script… as I would run it in testing…https://dw7240.com/Base-Canada/cloud-base.php, i ask because with that so called error…ref, last message switched on I get a black screen with a tiny graphic picture in centre of screen.
I know then that the script works, just cant display the actual picture of the cloudbase, again not sure why.
Other then that, the script is as it stands, plus the above text color changes, also to mention…too many edits to the script will kill it, and you have to load in a fresh copy, so a couple of edits, then upload to check. It’s a bit finicky, but given how time I’ve spent on it. you will crack it.
$wxSoftware = 'WD'; // [ WD | VWS | WU ] ...set to 'VWS' to use VWS WeatherFlash files (overridden if specified in Settings.php)
// note: use 'WD' for WeeWX also as it generates the needed files
$DataLanguage= 'en'; // [ en | de ] ........language in the data file (i.e. clientraw.txt .. overridden by eg. ?data=en parameter)
$translateTo = 'en'; // [ en | de | es | fi | nn | sv ] ....language to be used on graphic (nn=Norwegian, sv=Swedish)
// ...... Leave language as "en" if you have the Saratoga World Multilingual templates that will do the translation for you.
$Settings = 'Settings.php'; // optional ...not required
$WXtags = 'testtags.php'; // for Weather-Display
#$WXtags = './WEEWXtags.php'; // for weewx-saratoga plugin to WeeWX
// optional ...not required (overridden if specified in Settings.php)
// Below are the tags used in testtags.php:
// ---------------------------------------------------------
// $marchequinox = '%marchequinox%'; // March equinox date (def 20Mar)
// $junesolstice = '%junesolstice%'; // June solstice date (def 21 Jun)
// $sepequinox = '%sepequinox%'; // September equinox date (def 22 Sep)
// $decsolstice = '%decsolstice%'; // December solstice date (def 21 Dec)
// $weatherreport = '%weatherreport%'; // METAR cloud report from WD
// ---------------------------------------------------------
// WD/WeeWX SETUP ONLY ... The below will be overridden by Settings.php if it's available
// WeeWX if used with weewx-saratoga plugin
$clientraw = 'clientraw.txt'; // relative file address for WD clientraw.txt
#$clientraw = 'https://saratoga-weather.org/weewx/clientraw.php';
$clientextra = 'clientrawextra.txt'; // relative file address for WD clientrawextra.txt
// VWS SETUP ONLY
// $wflashDir = './wflash/Data/'; // directory for the the VWS wflash.txt and wflash2.txt files (with trailing slash)
// WUHU SETUP ONLY (Heavy Weather)
// $WUHUdata = './currdat.lst'; // WUHU ini file
$tz = 'America/Toronto'; // Timezone for sunrise / sunset (list at http://www.php.net/manual/en/timezones.php)
################################################################################
# begin settings #
################################################################################
$uom = 'M'; // [ M | E ] ...set to 'M' for metric, 'E' for imperial (overridden by testtags.php or by ?uom=M or ?uom=E parameter)
$useWDuom = false; // override $uom and use the same UOM values as in WD Console (requires testtags.php without uom's stripped if available)
$switchSeasons = true; // switch background according to seasons
$showCloudTemp = true; // show cloud temperature inside cloud
$showCaption = true; // include cloud type or precipitation at bottom of graphic (overridden by ?cond=1 parameter)
$showMoon = true; // include moon phase
$showScale = true; // include cloud height scale and marker
$showWinsock = true; // include the windsock (always set to true by "wind" parameter eg. ?wind=mph)
$showWindDir = true; // include wind direction below windsock (always set to true by "wind" parameter eg. ?wind=mph)
$showWindSpd = true; // include wind speed above windsock (always set to true by "wind" parameter eg. ?wind=mph)
$showTemp = true; // include temperature (always set to true by "temp" parameter eg. ?temp=F)
$showHumidity = true; // include humidity (overridden by "humi" parameter eg. ?humi=1)
$showBaro = true; // include barometric pressure (always set to true by "baro" parameter eg. ?baro=inHg)
$cloudsAlwaysFT = true; // cloudheight always in FT (if true will always overrides all other settings except if set by "alti" parameter eg. ?alti=m)
$windAlwaysMPH = false; // wind speed always in MPH (if true will always overrides all other settings except if set by "wind" parameter eg. ?wind=kts)
$alwaysShowCloud= true; // always show cloud band when condition is sunny, clear or dry (overridden by "cloud" parameter eg. ?cloud=1)
$useWDHeight = false; // always use the cloud height reported by WD (if you can trust it)
$arrowColor = '#FF0000'; // color for cloud height marker (arrow) ...white #FFFFFF, red #FF0000, green #FF0000, blue #0000FF
$getMetar = true; // get the METAR from NOAA for substituting cloud conditions at night and/or day (not required)
$metarICAO = "CYOO";// specify 4 letter ICAO code for METAR - NB: "Y..." METAR's will be fetched from OZZ (overridden if specified in Settings.php)
// Find a METAR closest to you here: http://www.bashewa.com/icao-codes.php
// Decode the METAR here: http://www.bashewa.com/metar-taf-decoder.php
$metarRefresh = 30; // refresh rate of the METAR in minutes
$useMetarAtNight= true; // always use METAR at night time for determinig clouds
$onlyUseMetar = true; // always use METAR for determinig clouds i.e. if you don't have a solar sensor or you don't trust WD's conditions
$reportMistAt = 30; // meters AGL (30m = ±90ft) ... if cloud base is below this then always report mist/fog
$stationAltitude= 0; // your station altitude in meters if you want cloud height reported above-sea-level (ASL)
// else cloud height will be reported above-ground-level (AGL) ... meters = ft / 3.2808399;
################################################################################
# optional settings from here onwards #
################################################################################
$pathToImages = './ajax-images/cb/'; // path to the background, cloud, windsock and scale images (with trailing slash)
$pathToMoonImages = './ajax-images/cb/moon/'; // path to the moon phase images (with trailing slash)
$fileOpenTries = 3; // number of open retries for clientraw/wflash files
$retrySleepTime = 3; // seconds to wait before next open retry
Here’s the top part of my version, including the switches (true of false) if that helps, 1 switch which is very picky is the…$alwaysShowCloud= true;…I find this can stop the script running, again no clue why !!!
That’s all I’ve got for you.
Nick. dw7240.com
Thanks, Nick.
Like I said, “504 Gateway Time-out”
I’ll crack it, eventually. . . brute force and ignorance usually works
It sems to be working here, although i had to turn off errors to avoid a depricated conversion. https://altlaw.com/saratoga/cloud-base.php?uomE&html=1
Jim
Had to admit defeat and ask an expert, my web host: so I needed to take account of the proxy server to getMetar and change a directory permission or two. . . see
swanston.maui.co.uk/ajax/cloud-base.php?html=1
Only problems now are that it shows no METAR, night (with moon) at 12 noon, and rubbish sunrise/sunset. And it appears that you have to set $alwaysShowCloud = true;
to get the height pointer.
I see yours is showing the moon at noon, too.
EDIT: if you set $showMoon = false;
you don’t get a moon at all. I’ll see if the sun appears tomorrow. . .
LATER EDIT: I see my clientrawextra is corrupt: sunrise is 217 and sunset shown is actually sunrise. Watch this space. . .
My that’s strange. I don’t see the moon here. I wonder if that’s because its day here but night there. I’d like to change the lettering color at the bottom, white is too hard to see against the background, but black may not show up against the night background.
AH! If specify ?html=1 i see the moon and my data is all wrong. If i don’t, i have the sun and more right data.Hmmm.
Edit: I may be seeing the wrong cloud conditions because the solar sensor is still covered in snow.
I have finally gotten above freezing and wind is back, the snow in the rain cup is starting to melt.
I am having trouble getting one of the wxgraphs to work right. The year_rain_inc_avg.php is giving me an http 500 error and i can’t figure out why (yet). I may have to ask for help.
J
Sunrise/sunset now sorted
I see what you mean:
I have turned off the solar cloud conditions in WD because it’s always “overcast and gloomy”. And I don’t download a METAR in WD, either. I was hoping the cloud-base.php METAR would work. . .
EDIT:
I’m getting that now: Deprecated : Implicit conversion from float 46.5 to int loses precision in /var/www/weather/htdocs/ajax/cloud-base.php on line 987
For the Deprecated error at 987, try changing
imagestring ( $slate, $font, 36+($z), min(162,$y)-10, $txtC, $color);
to
imagestring ( $slate, $font, intval(36+$z), intval(min(162,$y)-10), $txtC, $color);