New plugin – Snow statistics

A new plugin is now available, which is all about snow… it is unbelievable how time flies (especially when you are enjoying yourself like I am working on this template in my free time now :-), but for most of us, winter is approaching… It therefore seemed like an obvious choice for me to choose this topic for the next plugin.

So how does this work and what does it do….

This plugin is for logging and showing snow fall and snow depth at your station. It is divided into several parts and shows all sorts of data. I of course haven´t forgotten about our friends on the Southern hemisphere, this plugin will of course work for you too, the scripts automatically detect your location and based on that calculate “winter period” correctly (given you have your station coordinates specified correctly in your config.php).

When you run the plugin for the very first time, a new MySQL table will be automatically created, where you can then save the data, the table will be called simply “snow”, but that isn´t really important because you don´t need to know how this all works, you can easily add/delete stuff using one of the prepared scripts. However, make sure you read the instructions in this post carefully before you actually install it and try to run it, this time there is some important settings that need to be made in order for this to work.

Features:

  • detailed monthly reports with regards to snow (snow fall, snow depth)
  • detailed seasonal reports
  • overall comparison of all winters for which data are available
  • correlation with temperature

Install instructions:

  1. Make sure your stationLat is set properly in your config.php – the key thing to check is that if you are on the Southern hemisphere, this number must be negative!
  2. Download the ZIP file with the plugin and extract it
  3. Use notepad++ or similar to open snowSettings.php
  4. Now specify the units you want to use (cm, in etc.), the number of decimal places shown in the reports (this is because if you use cm, it will make sense to probably use 1, if inches you will more likely go for 2 or 3, in the database it will always use 3, but just ignore that, the reports will be shown correctly).
  5. Next, you must specify the months to display. This is because various places have variable winter lengths. This will depend on what data you will subsequently enter. So, if for example you input data for November-March, you would put winterStart=11, winterEnd=3. If you are on the Southern hemisphere, you could use 3 and 9 for example. These are the months that will then be shown in all the reports – but for the database you can enter data for any month so if for example in the future you have winter with snow even in October, you can easily enter data for October and just change this to winterEnd=10 and all the reports would show October as well.
  6. Now save the changes and close.

Now that you have done all the necessary set up you can start entering data. This plugin is basically divided into two sections – one for viewing the data (ie. the reports with graphs, tables etc.) and one for entering data. The first one is the major one, which is also public. The second one is “private”, in other words you can only access it with the template admin password. I will first explain the entering of data because before you do that you obviously wouldn’t see anything on the reports anyway.

Upload all the files in the snow folder (with the modified snowSettings.php) into the plugins folder and then open the following URL in your browser:

…. your template directory/plugins/snow/snow.php?password=12345    (replace 12345 with your adminPass specified in config.php)

If you want you can also put a link to this URL in your admin section of the template so that you can access it from there directly.

Now you should see a table and 3 buttons at the top. Meanwhile, since this was the very first time you ran the script, the snow table in your MySQL should just have been created and you can now enter data.

Entering data:

First you always choose a month and year. By default the current month is loaded, so simply change it to whatever you like and click the “change month” button. For each month you get a table, where each row represents one day. There are 3 things you can enter for each day and these are:

  • snow fall – the amount of snow that fell on that day
  • snow depth – the amount of snow on the ground
  • comments – any other thing you want to note for that day with regards to snow

One very important thing to note is that the script differentiates between a blank field and a field with 0. A blank field will simply be ignored and will not be displayed in the reports and taken into account in the statistics. Inseting the number 0 in one of the fields on the other hand, means that there was either 0 snow fall or 0 snow on the ground (or both of course). Also, the script will only save the data if both fields (snow fall and snow depth) are filled in. If you only enter one, it will be ignored, if you leave it blank, it will not automatically enter 0. Also comments can only be entered along with the numbers, you cannot have a row with just the comment and no numbers. But you can of course have just numbers and no comments.

The other two buttons at the top are there to speed things up. The first one  (Delete all) will simply erase everything in the form and leave you with blank fields. If you save such report, it will simply delete all rows (days) from the database. So if for example you want to delete one month entirely, you do this and then save it. If you want to delete just one day, you simply manually leave the fields for that day blank and save.

The other button (Zero all) will set all the fields to 0, if you saved such report, it will save it into the database and all days will have a value of 0 and be shown in the reports and taken into account in the statistics (once again, you have to differentiate between blank field – no data for that day, such day is not present in the database, and 0 as a value).

So this way you enter the data, of course you can also modify previously entered data, simply load the particular month and the fields will automatically be filled in with the values saved in the database and you can change them. But remember to always click the “Save” button at the bottom, otherwise no changes will be saved.

Viewing data:

The other part of the plugin is the public section, which can be normally accessed from your website menu. The landing page for the plugin is the index.php. This is the page you want to put a link to in your menu, most likely in the Weather Station section. When you load this page, you will see two links. The first one is a link to the list of the available reports, the other one is a link that will take you directly to the comparison of all the available data.

Reports:

  • monthly reports – statistics, graphs and tables for one particular user selected month
  • seasonal reports – same as above, but this time for the entire one winter
  • overall report – this is the one accessible directly from index.php and this one makes a comparison between all the available winters in the database

And that is it for now, but I will probably be adding more functions to this plugin in the future, for now it should do and if you have any problems/questions of course I am here to help and offer you support. Please also note one thing, there is a demo available at meteotemplate.com, but I myself do not track this – there is very little snow in the last years and it would also be difficult do to the specific location of where I live. So the demo you see uses dummy data and it is also static, which means I do not add new records to it. It was only made for illustration purposes.

DEMO
DOWNLOAD

2 thoughts on “New plugin – Snow statistics

    • Hi,
      no, none of the plugins and blocks work stand-alone, only inside Meteotemplate.

      And for this one it would not even be possible to modify it, because it uses the MySQL and that is unique to Meteotemplate. Some of the blocks and plugins could theoretically be rewritten to work stand-alone, but definitely not this one.

      The only option for you would be installing the template 😀

Leave a Comment