External scripts which use WeatherUnderground .CSV data

I have no idea, when I go to your website, KORCANNO14 reports. Script startReports.php , it shows metric values such as C and hPa.

Where can I find the page you refer to which show english units?

PLEASE be so kind to always include a working link to the page on your website.
Test yourself after posting if the correct page opens.

Wim

Indeed, the scripts were adapted to run in a div, but it is easier to use them in an iframe.
But then we have to add the time-zone also to the settings.

Please test attached version,

Wim


startWUhistory.php.zip (6.2 KB)

Sorry for not being specific. Here’s the procedure to reproduce this:

The Pressure columns are displayed with no decimal.

You see now why it is impossible to give support if you do not supply the link.
In your first post I quoted above, you refer to “weReports1part.php”
Now you say it is the history script.

I will check tomorrow.

Wim

Adapted version attached.
Demo https://pws.sluispark.be/index.php?frame=History_at_WU

The decimals are re-added for all periods. xxxx,1 hPa and xx,12 for inHg.
Just check if it will fit in the width as the period display has a lot of columns.

No decimals:
During the first months of the new WU-database the retrieved data had no decimals.
Later on WU added an extra URL-param to get the original data as uploaded.
Some periods will therefor show xxxx.0 hPa

Wim


WU-History4.php.zip (12 KB)

Hi Wim,

This works and the display looks fine on my station using both Chrome and Edge browsers on Windows 10 and also with Safari 14.0 on my MacBook Pro. Thank you!

I wonder if this would be a good time to ask for a feature… Or should I ask this in the other thread? It would be nice for the wuhistory and wureports scripts to have the option of defaulting to English units for those of us on this other side of the Atlantic. As it is right now, the wureports doesn’t even offer unit conversion (unless I’m missing something).

Thanks again for all your work on these, Wim. Have a nice weekend!

Please check the start-scripts.
I think it is more then enough customising: 2 temps, 3 baros, 4 wind, 2 rain units to choose from.
You already changed lines 11-13, all other customising starts at line 17
Wim

#-----------------------------------------------
#             HERE YOU NEED TO MAKE SOME CHANGES 
#-----------------------------------------------
$wustart 	= '20-08-2016';	  // Important the format is:   dd-mm-YYYY  for your first day of uploading data to WU.      !
$wuid		= 'KORCANNO14';	// your WU station name
$WUdatastr      = 'https://armon.com/pwsWD/PWS_DailyHistory.php';
#
if ($wustart == '31-05-2029') { die( '<h3 style="color: red;">You should adapt lines 11, 12 and 13 before this script can run</h3>');}
#
$latitude	= '50';		// for the seasons: a positive number for north of the equator, or a negative number for south
#				temp values: ='&deg;C', ='&deg;F'
$uomTemp 	= '&deg;C';		
#$uomTemp 	= '&deg;F';
#				baro values: =' hPa'   ' mb'   ' inHg'
$uomBaro 	= ' hPa';
#$uomBaro 	= ' mb';
#$uomBaro 	= ' inHg';
#				windspeed values: ' km/h'  ' kts'  ' m/s'  ' mph'
$uomWind 	= ' km/h';
#$uomWind 	= ' kts';
#$uomWind 	= ' m/s';
#$uomWind 	= ' mph';
#				rain values:  ' mm'  ' in'
$uomRain	= ' mm';
#$uomRain	= ' in';
#				wind run values: ' km'  ' mi'
$uomWrun	= ' km';
#$uomWrun	= ' mi';
#
$dateLongFormat = 'l d F Y';
#
#		Be carefull changing the following  settings
#
$pagewidth     = '100%';
#
$includeHTML	= true; 		// <head><body><css><scripts> are loaded, if set to false include the CSS also
#
$lang		= 'en';			// your language. If no language file is found 'en' is used
$wsreportsDir	= './';			// folder where the report scripts are located, leave as is if you are running this script from the same folder
$charset	= 'UTF-8';		// 'ISO-8859-1'  'UTF-8'

Aha, I did miss something. Thanks for pointing this out… I’ll go customize!

Thanks again.

Hi Wim,

I see an error_log in the wuhistory folder. It contains several lines (all basically the same, different time) as below:

[06-Nov-2020 11:47:43 America/Chicago] PHP Warning:  Division by zero in /wuhistory/WU-History4.php on line 753

This seems to be related to the solar sensor, but I’ve double-checked the “startWUhistory.php” file and have set solar to false. I believe this is harmless, but thought I should report it. (Looking at the logs, this was also present with the previous version.)

Thanks.

New version to download in first message, removed this error and added setting to start the script in english or metric
http://discourse.weather-watch.com/p/540880
The two php-scripts are changed ! Both should be replaced.

Succes, Wim

@ALL If running a “production” website, one should not set error-reporting on in the php.ini.
Even the smallest PHP-update can flood your error-log with identical errors when f.i. large arrays are processed, such as WU-files.
And most data we process is in arrays with loops to process them.

If you run into problems and want to see the php-errors and save them in your log, you can switch the error-reporting on with

  • using _test.php instead of index.php to start the dashboard
  • or add the ?test or &test to the url
  • or use the debug dashboard PWS_module_test.php

I only downloaded history and reports for the first time today (they are on the Menu), and I am still running the old WXDailyHistory.php on my 1907 dashboard.

I have read through this topic and made alterations as necessary for decimal places, but I may have missed something important. If so, I apologise. I just want to ask:

But not UK english, with wind in mph and everything else metric?

Also, I chose $color = ‘blue’; but I still get green. . .??

I confirm that the issue is fixed with the new scripts.

Thank you very much!

"As defined by WU " => No
These “wu-dashboard” scripts (another one at GitHub - ktrue/WU-History: Display WeatherUnderground historical data for your PWS (uses WU/TWC API, requires API KEY) ) are written to mimic the previous WU-Station-Dashboard.
Which, in those times, also included year and custom periods and an easy switch between US, metric or both units.
There was also a download link with the old dashboard and a graphs-page.

The current script also include the link to download a copy of the “.csv” as used in excel for more analysis.
But no graphs, sadly.

These history scripts go a long way back, long before I learned about UK (Mph+metric) Nordic (m/s) and Russian(mmHg and metric) units

Also, I chose $color = 'blue'; but I still get green. . .??
[s]I will look into that later today.[/s]

Change line 101 (approx) from

echo '<div class="blockDiv green" '.$extra.'>'.PHP_EOL;  #### 2020-11-08

to

echo '<div class="blockDiv '.$color.'" '.$extra.'>'.PHP_EOL;  #### 2020-11-08

Wim

OK, thanks.

Change line 101 (approx)

That works :slight_smile:

I also found one typo in line 27 of History wulanguage-en.txt:

langlookup|Original script by|Original script b|

Change last “b” to “by”.

How about adding one more table as another weather parameter in reports with average temperature per day, month or year that are also included in WU data?
This could be an interesting extension to the script. There are some countries where meteorologists use a non-calendar based definition for the seasons based on the average daily temperatures, eg. spring begins when the daily averaged temperature permanently rises above 0 °C.

I use m/s as a unit for wind strength.

In “Reports at WU” almost all wind speeds are shown with the same color, because the numbers in m/s all become quite small.
See attached screenshot.

Would it be possible to make another differentiation for colors when m/s is selected?

Mogens


=D> Thanks, after so many years, this stupid typing error is found.
Please make a copy of wureports/wsReports1part.php first.
change line 350 and line 372 from

	$windInc	= 20;

to

	$windInc	= 2;

If that makes to much red colours set it at 4;

Have pleasant and quit NewYears eve, best wishes for 2021.

Wim

Thank you very much - it made the difference :D.
Now the colors are very illustrative.

Also happy new year to you and thank you for all the work you do.

Mogens

I have already noticed it, I don’t know why but in the last days of 2020 I have data gaps in table reports. However, from the beginning of 2021 the data updating from WU has again returned. Do I only have such a case or is there a bug somewhere to fix?
http://pogodaslesin.beep.pl/pogoda/index.php?frame=Reports_at_WU

Hello,

I had the same problem and to reload the full year I deleted the file:
XXXXXX-metric-2020.arr

Cordially