Readme Leuven v4.11/12 forecast scripts 2023-04-28 PHP 8.2


All general settings as contained in _metric _us and ca_settings.php files
 
Setting and default valueDescription When to change
 
$ws_errors = true; Normally you should not change this until you are finished testing.
Then change it to false.
It should be set to true Only when asked by support or when you change the php scripts yourself.
$ws_fct_skip = true; Some forecast are only refreshed once or twice during 24 hours.
This setting skips forecast-data which is already in the past when displayed.
You can change this setting during testing
$wsTempMultiClr = true; Important temperatures are displayed bigger and coloured from a wide range of values, example:
27° or 10°
Set to false if you want RED / BLUE values only, red for above freezing, blue for below
19°C or -5°C
$wsTempMultiUom = false; The C or F is not shown with the temps. 29° Set to true if you prefer: 19°C
$wsTempAppDiff = 2; Minimum difference with normal temperature before "feels like" temperatures will be shown--
$allTextsLower = falseAll (translated) texts are shown as in the language files. Set to true to convert all texts to lowercase
$ws_dec_point = '.';
$ws_dec_point = ',';
Metric setting default uses a comma Temp = 15,5°C
US setting uses a point before the decimals Temp = 70.5°F
--
$yourColors = 4; Select the color-scheme you want in the next settings
There are three parts and four sets of colors
Choose one of the available sets or you can modify one set if you want to use the colors match the rest of your site.
DECIMALSFor forecasts we normally do not want to "precise" amounts such as 14.56 C, in the following part of the settings you can modify the default wihich is set to "as few as possible decimals".
$wsTempDecimals = false;No decimals for temps Temp = 15°Cset to true to get one decimal Temp = 15,5°C
$wsRainDecimals = true;Rain will always have decimals, 1 for metric (mm) and 2 for US (in)Do not change
$wsSnowDecimals = true;Snow will always have decimals, 1 for metric (cm) and 2 for US (in)Do not change
$wsWindDecimals = false;Wind values do not need decimalsbut you can change this setting to true and 1 decimal will be used
$wsBaroDecimals = true;Baro/pressure can use 1 decimal for metric (hPa) , and 2 for US (in)--
$wsDistDecimals = false;No decimals are needed for distances such as KM or Miles xx
 
DATE / TIME formatting There are two groups of date/time settings, first one here.
Further below an other group is either copied from your Saratoga/Leuven settings or set by yourself.
$dayTimeFormat = 'd-m H:i';
$dayTimeFormat = 'M j g:i a';
Example metric: 13-08 11:54
Example US: Aug 13 11:54 am
Check the PHP manual before changing.
$hourOnlyFormat = 'H';
$hourOnlyFormat = 'ga';
Example metric: 23
Example US: 11pm
$dateLongFormat = 'l d F Y';
$dateLongFormat = 'l M j Y';
Example metric: Sunday 13 August 2017
Example US: Sunday Aug 13 2017
$dateShortFormat = 'd-m';
$dateShortFormat = 'm-d';
Example metric: 13-08
Example US: 08-13
 
Your station/website WARNING: Those settings will be replaced with the settings from your Saratoga/Leuven settings if you use that template.
$yourArea = 'Some area';example: Leuven country sideReplace with a not too long description
$yourStation = 'XYZ Weatherstation';example: Wilsele weatherReplace with a not too long description
$yourLatitude = '50.904';WEST of the UK, example the US, needs a minus sign, $yourLatitude = '-99.904';Use a site such as http://www.latlong.net/ to find your coordinates
$yourLongitude = '4.696';South of the equator needs a minus sign, $yourLongitude = '-4.696';
$yourCharset = 'UTF-8';Leave as is in most casesOnly change when you include the forecast inside your own html
$yourDisplayWidth = '99%';Use a % of the available widthor set to the exact width, such as $yourDisplayWidth= '1200px';
 
Units of measurement WARNING: Those settings will be replaced with the settings from your Saratoga/Leuven settings if you use that template.
Set them the same as used on your other webpages, but only choose the values used here, do no invent your own
Example:
$wsTempUOM = '°C';
$wsTempUOM = '°F';
C is default in the metric settings fileF is default set in the US settings file
All other UOM's are self-explanatory, set a # at the first position for the ones you do not need
 
Other date/time settings WARNING: Those settings will be replaced with the settings from your Saratoga/Leuven settings if you use that template.
$timeFormat = 'd-m-Y H:i';
$timeFormat = 'M j Y g:i a';
Example metric: 13-08-2017 11:54
Example US: Aug 13 2017 11:54 am
Check the PHP manual before changing.
$timeOnlyFormat = 'H:i';
$timeOnlyFormat = 'g:ia';
Example metric: 11:54
Example US: 11:54 am
$dateOnlyFormat = 'd-m-Y';
$dateOnlyFormat = 'M j Y';
Example metric: 13-08-2017
Example US: Aug 13 2017
$timezone = Europe/BrusselsThere are a few examples what type of specification you should use. Check the PHP manual and DO NOT invent your own
$lang = 'en'Supported languages for now are 'en, 'de', 'fr', 'nl' If you want to use your own, feel free to do it. If you sent me the language files, i can include them in the next release
 
And no more changes are needed in _us_ or _metric_settings.php. #-----------------------W A R N I N G ----------------------------------#

if you want to change anything further down the settings script make sure you know what you are doing

#-----------------------W A R N I N G ----------------------------------#
All forecast scripts can be tailored in the same way.
This part describes in general term all settings to be found on the different forecast pages.
In the examples below we will use the settings for the met.no forecast.
Other forecasts use similar setting-names.
 
All forecast pages contain different parts. Those are all set to be displayed by default. You can select to not display one or more of them.
You select for every part either: 0=not used | 1=displayed separately | 2=used but in tabs

For every part you should set the value to 0 1 or 2 This example where the icon parts will be used, but it will be in a tab, not separate:

#-----------------------------------------------
# the row of icons / day part
$metno_icons = 2; # 0=not 1=separate 2=tabs


Setting and default valueDescription When to change
 
$metno_icons = 2;A row of icons with the most important weather-values.
Often used as a separate part on a startpage.
As the icons are displayed horizontally, do not set the number of icons to high, otherwise all texts will be cramped.
$metno_icons_tab_text = 'Icons';When the icons are displayed in a tab, this text used in the tab to identify the icons
No need to change this value, use the translation file.
$metno_icons_col = 10; Number of icons = number 6 hour day-parts to be displayed.
Morning - Afternoon - Eveninmg - Night
So the default setting of 10 icons displays 2½ days
 
$metno_chart = 1;Default the meteogram / chart is directly below the optional header/times at the top of the page
You can show the chart also in a tab with the other information / tables to get a very small area with a lot of information.

WXSIM forecast have multiple charts, they are displayed in a separate tab-set.
$metno_meteogram_count = 10;Number of 24 hour days in the chart. May seem busy when there are a lot of icons in a day
$metno_chart_height = '340px';Set the height for the meteogram/graph. 340 px is a minimum
$metno_chart_tab_text = 'Graph';javascript graph with most important weaher values.
 
$metno_tbl_mos = 2;Every colom contains the most important weather-values for a 12 hour day/night period.Normal tables are horizontal. This table is verticale. The tab it is in is also the default one to be displayed.
$metno_tbl_mos_col = 10;Number of 12 hour day-parts.
$metno_tbl_mos_tab_text = 'Forecast';The text to be used in the tab
 
$metno_tbl = 2;If provided by the forecast-agency, a table with 6 hour values
$metno_tbl_tab_text = 'some text';Based on the contents, often "'Forecast 6 hour interval';"
$metno_tbl_height = '500px';As tables can be very long, you can restrict the height here. Longer tables will get a vertical scrollbar.
 
$metno_tbl_dtl = 2;If provided by the forecast-agency, a table with one-hour or sometimes three hour data.
$metno_tbl_dtl_tab_text = 'some text';Based on the contents, often "'Forecast details';"
$metno_tbl_dtl_height = '500px';As tables can be very long, you can restrict the height here. Longer tables will get a vertical scrollbar.
 
Now some yes / no settings
 
$metno_times = false;Generation time of this and next forecastNot available for all forecasts
$metno_header = true;The header line with station name and timesNot available for all forecasts
$metno_show_uv = true;The UV values can be supplied by the forecasting agency.
Or can be loaded from another source.
If cloud coverage is available the UV values are displayed inside the forecast, with expected and theoretical values. Otherwise a separate tab is used to show a 6 day UV forecast.
 
Settings for display of precipitation, Rain. & Snow if available
 
$metno_rain_if_zero = true; When set to true individual rain amounts are shown and a '-' or 'n/a' when there is no rain forecasted. When the whole period has no rain, the complete line / colom is shown but contains no real data, only '-' or 'n/a' values When set to false, an empty ('-' or 'n/a') line will be replaced with one message, like 'no rain for this period', adaptable by the language translation files.
$metno_rain_skip_zero = false;Default set to false it shows the rain lines, even when there is no rain. True removes the lines with "no rain" values completely, including a header line if present.
 
Some remaining settings
 
$your_settings = '_metric_settings.php';
$your_settings = '_us_settings.php';
$your_settings = '_ca_settings.php';
Choose which settings file you want to useThey differ in the pre-selected UOM's: metric or USA
The _ca version is for Canada
$needs_html = true;The extra html head body tags are generated if used stand-alone.You can switch that oof by using "false;" and only the forecast data html is generated.
When used inside a template this setting is set to "false;" automatically.
And no more changes are needed any further in the pages. #-----------------------------------------------------------------------#

STOP making changes here

#-----------------------------------------------------------------------#

  1. Move the folder "wsfct4" to the main folder of your Saratoga website. That is normally the root.
    DO NOT copy the contents of the folder, leave all scripts and subfolders as is.

  2. Inside your "wsfct4" folder there is a folder "Saratoga root".
    There you find the pages you can use in your Saratoga template and you can add them to your menu later.
    First copy (not move) them to the main Saratoga folder.
    There are at least 10 pages, so you should only copy the ones you need. The page-name contains the forecast-data used.
    • wx_lvn_ec.php  Gets the forecast data fromEnvironment Canada using the Canadian settings file
    • wx_lvn_hwa.php  Strictly for members of HWA as they have a personal API key
    • wx_lvn_metno.php  Gets the forecast data from Met.no using the stations latitude/longitude
    • wx_lvn_noaaD.php  Strictly US users, extensive detailed data from NOAA/NWS using stations latitude/longitude
    • wx_lvn_noaaPP.php  Strictly US users, 1 page "point-click" data from NOAA/NWS using stations latitude/longitude
    • wx_lvn_uv.php  UV forecast using stations latitude/longitude
    • wx_lvn_wxsimD.php  Needs WXSIM, a paid for forecasting program on a windows PC.
      This page displays a detailed forecast with the data from WXSIMS latest.csv or lastret.txt file
    • wx_lvn_wxsimPP.php  Also needs WXSIM. Displays a single page enhanced textual forecast from plaintext.txt

  3. When using the darksky.net pages you have to supply a setting for the developer API key.
    $SITE['DarkSkyAPI'] = 'the value of your Darksky API-key'; // <= replace that string with your own DarkSkyAPI key


  4. When using the yrno page you have to modify a setting in the wsYrnoPage.php to set the missing city information.
    $wsYrnoID = 'Belgium/Flanders/Herent/'; // replace with your own code using the yr.no site

    YR.no will end this API shortly, better use the met.no scripts

  5. When using one the WXSIM pages you have to modify a setting in the wsWxsim??page.php scripts to tell the location of the wxsim files to use. Default it is set to the main folder = 1 folder below the wsfct4 folder.
    $wxsim_files_dir = '../'; // normally the files are uploaded to the root
    $wxsim_plain_file = 'plaintext.txt';

    You also specify which file you want to use. Normally it is the plaintext.txt for the 1 page forecast and latest.csv for the detailed fortecast with all the grpahs.

  6. Test the pages you want to use and then add them to the menu

If you run into problems, use the Leuven support site at https://support.leuven-template.eu/



Before you can run the forecast scripts you have to modify the gnereal settings describing your station and environement.
Only continue here if you modified the settings as described in the first tab: "general settings".

  1. Move the folder "wsfct4" to the main folder of your website. That is normally the root.
    DO NOT copy the contents of the folder, leave all scripts and subfolders as is.

  2. There are at least 25 functional example pages from the 10 different forecast-companies. Not all forecast are available in all countries and for some forecasts you need to acquire an API-key. Most forecast are available in small and large versions. Use the demo-page to test them.

    You will find all those functional example pages in the wsfct4/ folder.
    The pagenames are all structured in a similar way as these example pagenames for Metno :
    wsFctMetnoPage4.php for the full page
    wsFctMetnoSmall4.php for a small (tabbed) page
    wsFctMetnoIcons4.php for icons only

    • wsFctEc  For Canadian users, forecast data loaded from Environment Canada using the settings from the Canadian settings file
    • wsFctHwa  Strictly for members of HWA as they have a personal API key
    • wsFctMetno  Gets the forecast data from Met.no using the stations latitude/longitude
    • wsFctNoaaD  For US users, extensive detailed data from NOAA/NWS using stations latitude/longitude
    • wsFctNoaaP  For US users, 1 page "point-click" data from NOAA/NWS using stations latitude/longitude
    • wsFctUv  UV forecast using stations latitude/longitude
    • wsFctWxsimD  Needs WXSIM, a paid for forecasting program on a windows PC.
      This page displays a detailed forecast with the data from WXSIMS latest.csv or lastret.txt file
    • wsFctWxsimP  Also needs WXSIM. Displays a enhanced textual forecast from plaintext.txt on a single page

  3. When using one of the darksky.net pages you have to modify a setting in the wsFctDarks... scripts to set the missing API key.
    $DarkSkyAPI = '_NOT_YET_SET_'; // <= replace that string with your own DarkSkyAPI key


  4. When using one of the yrno pages you have to modify a setting in the wsFctYrno... scripts to set the missing city infirmation.
    $wsYrnoID = 'Belgium/Flanders/Herent/'; // replace with your own code using the yr.no site

    YR.no will end this API shortly, better use the met.no scripts

  5. When using one of the WXSIM pages you have to modify a setting in the wsFctWxsim... scripts to set the location of the wxsim files to use. Default it is set to the main folder = 1 folder below the wsfct4 folder.
    $wxsim_files_dir = '../'; // normally the files are uploaded to the root
    $wxsim_plain_file = 'plaintext.txt';

    You also specify which file you want to use. Normally it is the plaintext.txt for the 1 page forecast and latest.csv for the detailed fortecast with all the grpahs.

  6. Test the pages you want to use.
    If you want to include them in your own pages, DO NOT forget the setting to NOT generate the enclosing html
    $?????_html = false; // if not in a template, do you want enclosing html?



If you run into problems, use the Leuven support site at https://support.leuven-template.eu/