A new wxsim 3in1 display script version 2013-05-21
This folder is for the stand-alone version of this script
folders:
cache to store preprocessed arrays plaintex.txt, from latest.csv and or lastret.txt
img images as: sun-up sun-down
javascripts jquery.js jquery.qtip.js tabber.js highcharts.js
lang language translate files
otherScripts wsLangFunctions.php wsFunctions.php wsIconUrl.php
windicons
windiconsSmall
wsIcons icons for cloud/weather conditions
Stylesheets:
styleWsWxsim.css
scripts:
plaintext parser scripts from Saratoga with minor adaptions to be used in these 3 in 1 scripts
==============================================================================================
plaintext-parser-data.txt data file for plaintext-parser.php --
used to determine caption and base icon for forecast
all english text
needed language translation files
plaintext-parser-lang-de.txt
plaintext-parser-lang-fr.txt
plaintext-parser-lang-nl.txt
plaintext-parser-lang-en.txt
plaintext-parser.php parses plaintext.txt and outputs an array with all data (as modified by us)
and / or can be used to print the saratoga plaintext page
wsWxsim scripts
===============
wsWXsimPrintFull.php General processing and administration script
which loads/executes:
wsWxsimSettings.php All settings
wsWxsimParser.php Some housekeeping, executes plaintext-parser.php, caches output
wsWxsimGetFile.php Loads and converts either lastret.txt or latest.csv caches output
wsWxsimHtmlGen.php Converts cached data into "printable" tables and javascripts
and after that prints the page according to the settings and retrieved data.
wsWXsimPrintSmall.php Nearly identical to PrintFull but prints in a very compact area
wsWxsimPrintTop.php General processing for printing row of icons based on plaintext.txt data
following scripts are loaded
wsWxsimSettings.php All settings
wsWxsimParser.php Some housekeeping, executes plaintext-parser.php, caches output
wsWxsimHtmlGen.php Converts cached data into "printable" tables and javascripts
and after that prints icons
Startup scripts:
start3in1.php:
Sets the needed environment and displays a page by calling one of the wsWxsimPrint scripts from above.
By default it prints all enclosing html (head and body tags and so on.)
This can be switched of with a setting in this script.
startSaratoga.php
Startup scripts based on start3in1.php but with minor adjustments to be used in standard Saratoga template implementations.
A replacement for wxsimforecast.php need to be placed in the same folder (nearly always the root) where the other Saratoga scripts are
wxsimforecast.php
replaces existing wxsimforecast.php script in saratoga templates
How to install FIRST STEP:
===========================
1. Put the install folder (wsWxsimSA) in the ROOT of your website.
============== ======
You can change the name of the folder. No settings have to be changed for that.
But please:
First try to install in the root, check the location of the wxsim files (step 2) and test (step3).
If everything works as wanted you can move the whole folder to a new location.
If you change the location of the folder (so NOT in the root, some settings have to be changed)
2. The location of the plaintext.txt lastret.txt and latest.csv is assumed to be in the root of the website.
IF NOT: change setting in start3in1.php: an example if files are in root/weather folder
$SITE['wxsimData'] = '../weather/'; // root folder is the normal place
3. Execute the script with: www.yourwebsite.com/wsWxsimSA/start3in1.php
It should work OUT of the box!
How to install SECOND STEP if you are using a Saratoga template:
=================================================================
So after you made sure that the script works with your wxsim data you can now add the s3in1 script to your Saratoga website.
Copy the wxsimforecast.php from the wsWxsimSA folder on your website (or from your download area on your pc) to the saratoga script location.
In most cases the Saratoga template is installed in the root of your website/server.
This wxsimforecast.php script is the standard script name used in the menu system of Saratoga.
Edit the settingsfile of Saratoga to indicate that you want to use a wxsim script.
$SITE['WXSIM'] = true; // Set to false if you have not installed WXSIM
The choice for wxsim should appear in your menu and the startSaratoga.php script will be executed for that menu choice.
The scripts assume that the wxsim data files are in the same folder as the saratoga scripts.
In the wsWxsimSA/lang folder you find the language files as needed for the 3in1 script.
These files have the same format as the Saratoga language files, so you can simply add the contents of these files to your current Saratoga language files.
And the NEXT step:
==================
If you make even 1 change to the settings during testing
ALWAYS empty the cache folder (wsWxsimSA/cache or cache/ for Saratoga).
In this cache a pre-processed version of the plaintext and latest.csv or lastret.txt files are stored.
So strange results occur when changing settings and NOT emptying the cache.
1. The script reads plaintext.php and either latest.csv or plaintext.txt
Normally plaintext.txt is sufficient but it is limited to the number of fields which it can contain (max 31).
Also when you do not want to change the settings in WRET.exe you can test this script by using latest.csv
Latest.csv holds almost all fields available with WXSIM and is therefor more future-proof.
The file to be processed is set in the settings file wsWxsimSettings.php line 71:
$fileToUse = $latest;
2. Fonts to use
Either the KDE or Dotvoid fonts are contained in the download. Default the KDE fonts are used.
choice is made in wsWxsimSettings.php line 43-44
$icons = 'yrno'; // yrno translate to dotvoid icons made for yrno forecast
$icons = 'default'; // use default icons
If you want to use dotvoid fonts: Comment line 44.
3. Your weatherstation name and other things necessary for proper operation
Settings in start3in1.php (and some of them also in startSaratoga.php, but line numbers may differ)
line 18 the language to use 'en' default
line 30 The area for your forecast (name of a city for instance)
line 31 The name of your weather-station
line 35 Your Timezone for correctly displaying date/times
line 36 Your stations latitude
line 37 and logitude to calculate the sun up sun down times
line 38-41 to set different date/time formats to be used
line 45-50 the units of measurement to be used on your website page.
This is what you want to see on your screen. Not what you specified in wxsim
Normally you use the same units in wxsim.
But the script detects differences and recalculates.
4. Set lines 54-57 if you have soil/moisture sensors (mostly a Davis thing)and the corresponding depths they are placed.
These depths are displayed in the soil tab.
There is no checking if the settings in wxsim are the same as the depths are not contained in wxsims output files
5. Which parts to display
wsWxsimSettings.php line 102:
$graphsSeparate = true; // set to false if graphs should be separate tab in table area
$displayIcons = true; // display the plaintext derived icons on full page
$displayTimes = true; // display create time and next run times
A full 3in1 page contains from top to bottom
1. Two descriptive lines with area and which weatherstation (text set in point 3)
and create time of wxsim file and expected of new wxsim file
One can remove the times part by setting $displayTimes = false;
The two lines with area and weatherstation name fold back to one line then
The runtimes (expected new file available) is set in line 74 (hours when wxsim runs)
2. A block with icons and text for each day-part from plaintext.txt
To suppress the printing set $displayIcons = false;
The number of icons (dayparts)is set in line 160:
$topCount = 10; # How many forecasts shown in top-forecast (if used)
3. The graphs can now be shown: setting line 103
$graphsSeparate = true;
or shown in a tab later
$graphsSeparate = false;
4. The tabs are displayed containing
a. the "overview" tab with the contents of plaintext.txt
b. the "Forecast 3 hour intervals"
c. the "48 hour details"
d. the "Grass and soil forecast"
If you do not want this "Grass and soil forecast" tab to appear set line 175: $soilWanted = false;
e. the "Graphs" tab if you decided to display them here (point 5.3 above)
6. There are numerous other settings in the wsWxsimSettings.php script.
Most of them contain some sort of remark to explain the meaning of the setting.
You can change as you like.
BUT please no changes in the $fields table after line 178.
This table is used to decide later on which fields are in which file.
Changes in this area of the settings will certainly bring the scripts to a halt.
Wim van der Kuil
You can always contact me if you want some changes to be made here.
I am living in Wilsele/Leuven/Belgium/Europe so please consider the time difference with your area
wvdkuil (at) gmail.com
www.weerstation-leuven.be for demos and downloads
www.weerstation-wilsele.be my "real life" weather website.