Calculate Missing Values
Request for help from Wiki Readers
- Do you understand how MX works?
- Do you use hardware, or MX functionality, that is not yet documented? Can you begin that documenting?
- Can you contribute simple text for novice users, examples of what you have done, correction of typing or factual errors, or supply missing details?
- Will you make this page more useful by bringing content up-to-date as new releases change some information written for older releases?
- Does any page need a section for novices, so they don't need to read more technical information further down that page?
- Is there some information on this page, that should be on a separate page? Can you create the new page and move the less relevant information off this page, don't forget this page needs a link to the new page so people who expect to find it here know where it has moved to?
If you plan on CONTRIBUTING to the Wiki, then you will need a userid.
- Please use the Request Account form to apply for a userid (you may have to wait some time for a response)
- You will find help on how to contribute to this wiki at How to Edit.
- If you need to consult others, please use either the Cumulus Wiki suggestions forum or Cumulus board at WXForum.net.
When everyone used Cumulus 1, the Cumulus Wiki was highly rated as being comprehensive. But the legacy software was much simpler to document, and there were multiple contributors, one of whom was the Cumulus author who knew what the software was doing. (Unfortunately, it is not easy to convert pages originally written for the legacy software into pages that document MX, as it is often unclear if the two flavours work the same way, and MX is diverging rapidly from the old functionality).
Please be aware that any information on this page may be incorrect, unless the relevant contributor was the developer. This is because when new releases change functionality, the announcement is often unclear on what exactly changed. A lot of research is often needed before MX can be correctly documented here by any other contributor!
- Data that you want to add from another system for a period when you were not running Cumulus
- How Cumulus captures archive data if it is available for a period when Cumulus was stopped
- Derivatives that have been added since particular log files lines were stored
- Solving problems when a line was not successfully written to the daily summary log file
How Cumulus Works
The way that Cumulus works is that:
- It reads what we can call source values (defined below) from your weather station (based on measurements from sensors being transmitted in some way by the station)
- It calculates what we can call derived values which may be either the source re-expressed in different units, or calculated by combining two or three source values to get a new derivative
- It tracks various extremes, and cumulative totals, by comparing the derived values against existing extremes and sums stored in various period tracking files
- You can find out about how a rogue source value can affect extreme records derived from it, and how to correct such issues on the Correcting_Extremes page.
- It periodically stores the spot (current) derived values in a collection of Monthly_log_files, (and so when you move to a different device, or upgrade to a new release, then providing you copy these files to the new location you will not lose any data)
- At the end of each day, Cumulus logs the daily extremes or daily sums, from monitoring changes in each derived value into daily summary log
Reading archive data
If you are using a weather station type that has a internal memory storing weather data that Cumulus can read, then when Cumulus is restarted it can read historic data from that logging memory.
This means that if you discover that Cumulus has missed some data, soon after it misses that data, you can rewind, by stopping Cumulus, optionally replacing files in data folder with earlier copies of those files from backup folder or backup/daily folder, and restarting Cumulus. Typical reasons for missing some data would include power blips and problems with the interface between Cumulus and the weather station.
- For Cumulus 1, to stop Cumulus, you select Exit from the main menu.
- For MX, how you stop MX depends on your device, and whether running as a service, please see MX on Linux or MX on Windows OS pages as appropriate for advice.
Put simply, Cumulus stores the latest time it successfully read data from the weather station in today.ini. When Cumulus is restarted, if it is possible to read the historic data from the weather station, then any entries between the time stored and the current time will be read.
With Cumulus 1, there is some dependence on weather station type, but usually two passes are made through the external logging memory, the first pass investigates what records are available in the weather station, by reading backwards in time, and the second pass works forward in past time reading and processing those records.
With MX, again there will be some dependence on weather station type, and the process has not been documented by the developer; it appears just a single pass is made.
Importing data from other systems for periods when Cumulus was not running
This section needs more work on it
Essentially, what we need to do, is to compare the format of the data we have available against the format of the relevant Cumulus file.
CSV outputs from software like EasyWeather
You might want to read Transferring_past_observations_from_EasyWeather.dat_to_Cumulus, although that is now an obsolete article, Easy Weather has changed, and Cumulus MX is different from the original Cumulus described there.
The CSV output from such files has fields in the wrong order, may not match our Cumulus units, and does not have a match for each of the fields we need in our Cumulus - see importing into standard log file fields. The solution is to use a CSV file editor, or a spreadsheet, to move the fields into a better order, to apply a formula where necessary to change units, and create any missing fields.
Cumulus does not allow for "null", field not available, except in that it can allow shorter lines with just the fields applying to an earlier release. For MX, CreateMissing.exe can calculate some of the derivatives missing from earlier releases for the Standard_log_files, and that utility can generate the necessary dayfile.txt lines.
On the Support Forum - Dane - offered a translation service - see here, but the last post is May 2018, so I am unsure whether it is still available as I type this in July 2021.
Please see Software page - Weather_Display_Converter. When you run this routine, it brings up a screen where you select the units that you want the Cumulus Standard_log_files it produces to use, as the units that weather display uses for the export are fixed.
The routine was written for Cumulus 1, so will not produce all the fields that MX uses, but CreateMissing.exe can calculate some of the derivatives missing from earlier releases, as well as producing dayfile.txt.
Weather Link log file
There is a routine, see Software page - WeatherLink_Converter for this. When you run this routine, it brings up a screen where you select the units. Please note, this utility assumes the units you select on that screen apply both to the file (OR MULTIPLE FILES) being converted and to the (multiple) Cumulus Standard_log_files it produces.
It was written for Cumulus 1, so will not produce all the fields that MX uses, but CreateMissing.exe can calculate some of the derivatives missing from earlier releases, as well as producing dayfile.txt.
Weather Link Live
PLEASE CAN SOMEBODY FULLY DOCUMENT THIS.
My understanding is that while MX can read current data from the WLL, you need a "pro subscription" to export past data. I don't know the format of that past data export, but can only guess it can be easily imported into Cumulus.
PLEASE CAN SOMEBODY CONTRIBUTE WAYS OF IMPORTING FROM OTHER SOFTWARE HERE.
Meanwhile, people should ask for help in the support forum.
To make sense of explanations on this page, you need to understand the terminology used here.
A weather station sends values based on its sensors to Cumulus. If Cumulus reports that value without changing it (an offset and/or multiplier might be applied to convert it to the unit wanted by the Cumulus User), the value is described as a source value because Cumulus is reporting something that has its source elsewhere.
There is not a single list of what weather values are called "source values", because this varies depending on the weather station, and in some cases, a Cumulus User can ask Cumulus to recalculate a value instead of using what is sent by their weather station.
However, Cumulus does include code that expects a weather station to provide a defined minimum set of source values:
- Current air temperature
- Current Relative Humidity
- At least one wind speed
- Current air pressure (absolute or sea-level)
Cumulus will stop processing any information from a weather station unless the above 4 source values are being supplied and reveal they are being updated (failure is set is after a total of 6 unsuccessful consecutive attempts to read each of these).
This requirement is a default, but it can be changed:
- For recent releases of MX, this is classified as an advanced setting "No sensor check" (see Cumulus.ini)
- For earlier releases of MX, this is "No sensor check" (see here for how to change default)
- For legacy Cumulus 1, see here for how to change default
Cumulus also expects that your weather station can provide:
- A rainfall counter (this could be annual rainfall, or count of rocker bucket gauge tips)
Although the lack of that rainfall counter source value will affect functionality, Cumulus will continue to process other source values that are available.
Some weather stations may also provide one, or more, of these optional source values (not a complete definitive list):
- Dew-point Temperature
- Wind Chill Temperature
- Sunshine hours
- Solar radiation
- UV index
- Air pollution measurement
A dictionary will define derived as "obtained from a source", and that is the meaning adopted on this page. Steve Loft (in the Cumulus Support Forum) used the terminology "derived" for two purposes.
- One type of derived value takes a source value, applies any multiplier (may be both first order and second order multipliers) and/or constant that has been defined in calibration settings, and converts the output to the units selected by the Cumulus user.
- The other type of derived value takes more than one source value, applies a standard calculation, and ouputs a new derivative
- Because newer releases calculate more derivatives than older releases, extra fields have been added to the standard log file
This also has two meanings in a Cumulus context:
- If a particular standard log file line has fewer fields than the latest line;
- Calculate Missing is the process of looking at the derived values of first type above, and calculating any derivative (second type of derived value) that is missing in that particular line
- If a particular daily summary log file, either does not have a line for a particular meteorological date, or does not have all fields defined in a line for a particular meteorological date;
- Please see Amending dayfile page for full details.
- Calculate Missing is the process of scanning all the lines in the standard log file that relate to the meteorological date and recalulating approximate extremes, or sums, for the missing fields.
If you are using Cumulus MX, there is a download linked from here that does both of these. There are also editors within the admin interface for manually editing the files on a line by line basis. You can also use the PHP Hypertext Pre-processor (PHP) script specified for Cumulus 1 below, although be aware it was written for a very old PHP version.
If you are using the legacy Cumulus 1 software:
- For the standard log file meaning above, provided you have access to a web server that can run PHP Hypertext Pre-processor (PHP) scripts, then this post in support forum includes a script that produces a HTML form where you specify the log file name you wish to edit. The script will read that file, and output a replacement file with all possible spot derived fields populated. Please note that script was written to run on an old version of PHP that was current at the time the script was written, it will need some editing to work on latest PHP.
- For the daily summary log meaning above, go to the Edit menu, and select Dayfile.txt. This brings up an editor with a button labelled "Create Missing", that will not affect any existing line, but can insert missing lines, see Amending_dayfile#Create_Missing.
Accurate or Not?
This Wiki page describes some techniques for calculating and inserting values that are missing from standard log files and from daily summary log file.
Since the derived values this page is discussing are spot values, they have to be calculated from source values measured at the same time. This means that if one of your .ini files is missing some fields, these missing fields cannot be calculated from other fields. This applies to any missing extreme records for today, this month, this year, monthly-all-time, or all-time.
However, the techniques for correcting rogue values described on the Correcting_Extremes page, can be used for inserting missing values in the daily and longer period extreme records.
For the standard log files, all the fields in any one line relate to the same time, therefore for derived values calculated from other fields in the same line, you should have the same value whether it was calculated when that line was originally stored, or calculated afterwards. I say should because the calculation formula is not always the same for all releases, in particular there are differences between how Cumulus 1 and how MX calculate some derivatives.
For entries in today.ini, month.ini, year.ini, alltime.ini, and monthlyalltime.ini files, you don't have access to the source values used for the original calculation afterwards.
- The original values are calculated as Cumulus is running
- Depending on your weather station, Cumulus is able to read values every minute, and consequently update today.ini (and the other files listed) each minute if an extreme happens
- Obviously, dayfile.txt is updated from today.ini, so it is just as accurate
- Any "Calculate Missing" operation, done subsequently, does not have access to old data, it can only look in the spot values that have been logged.
- If Cumulus is set up to only log the readings every half an hour, create missing is only able to see 1/30th of the data,
- Due to this mismatch, the derived values (averages, highs, lows) this approach can store are much less accurate (hence getting missing lines from a backup is better)
Derived spot values
Cumulus software code as it reads source spot values, will detect if that source value is required for the calculation of an instant derived spot value.
Here are all the derived spot values that Cumulus can calculate (depending on Cumulus configuration settings, and what your weather station can output):
- Dew point, a weather station might output dew point temperatures, but Cumulus can calculate it from source values for outdoor temperature and outdoor humidity
- The original legacy Cumulus, and MX, use different formulae to calculate dew point, so there is a continuity break if some of your data logs were created by the original Cumulus software and some by MX.
- Wet Bulb, is only calculated by Cumulus 1, not MX
- Wind Chill, again this might be output by your weather station, but Cumulus can calculate it from outdoor temperature and average wind speed.
- Canadian Humidity Index (Humidex), USA Heat Index, and Apparent Temperature are not output by your weather station, but both the original Cumulus 1 and the newer Cumulus MX will derive these spot values for you (except if you are running a very old release)
- (The implementation of these by Cumulus software is briefly mentioned here).
- The calculation formulae used for these may not be consistent for all releases, so again there is a possibility a data log might have continuity breaks.
- Feels Like Temperature is calculated by the Cumulus MX flavour only, the actual calculation formula has varied in different releases, but use a variation on
- Heating Degree Days and Cooling Degree Days; these are further examples of derived values that most versions of Cumulus will calculate for you (from all processed outdoor temperatures in a day)
- A bug in some versions of the original Cumulus software could result in these derived values being swapped and therefore tracked wrongly when reporting extremes.
The links above will take you to where the derived values are explained in the Category:Terminology pages of this Wiki, however at the time of writing this page, many of those links have very little information, so you may wish to search online to find more information in for example Wikipedia.
There are some configuration settings where you can decide whether to use a weather station supplied dew point temperature and whether to use a weather station supplied wind chill temperature.
- For MX, please see MX_Administrative_Interface#Changing_Settings and Cumulus.ini pages for how to find the settings
- For legacy Cumulus 1, please see Configuration -->> Station menu and Cumulus.ini_(Cumulus_1) pages
Field Count Variations
When the standard data logging file was introduced it only had 16 (or fewer?) fields. As time has gone by, extra fields have been added to the file. At time of writing, 29 fields have been in the file since release 3.6.12 (build 3088), and currently the "To Do" database does not include any suggestions that would add more fields.
When the daily summary log file was introduced it had 15 fields. As time has gone by, extra fields have been added to the file. At release 3.6.12 there were 54 fields, but at earlier and later releases there are fewer fields. At the last update of this page (release 3.7.0) there were 52 fields. The number of fields in a line of the file might be changed in a future release.
When you use Cumulus to edit any of these files, it expects the file to have the number of fields defined in the release you are using. If an existing line in the file has fewer fields, Cumulus can still read it, but Cumulus will add trailing field separators if the file line is edited.
Consequently, those people who have used Cumulus for a while may have files that include some lines with fewer fields stored than their latest lines.
Why do "Calculate Missing"?
Most functionality in Cumulus is concerned with current data or extremes/sums that are derived for a hour, a day, or longer, periods. For these contexts, you might encounter an odd rogue value that needs to be corrected as described on the Correcting_Extremes page. You are unlikely to worry about missing past values.
However, if you want to be sure that your all-time extremes, or monthly-all-time extremes, are correct, then this table shows how the start date for these extremes varies. You might want to achieve better consistency by adding missing fields to earlier lines in the log files, if so you want to do a "create missing".
If you are using the Historic Charts feature introduced from release 3.9.2 - b3097 (7 December 2020), you may notice that these new charts have gaps in available data, and the dates with/without data vary depending on what is being plotted. You might want to achieve better consistency by adding missing fields to earlier lines in the log files, if so you want to do a "create missing".
How to do "Calculate Missing"
As mentioned earlier, there are a number of options, here are the detailed instructions for each option.
This is only available if you already have MX installed and have been using it.
These notes relate to "Create Missing Version 1.1.0" which is for "Cumulus MX release 3.12.0" and above. At the time of amending this section Create Missing version 1.0.2 had been tested and was found to have a bug.
Download link at Software#Create_Missing page, unzip, and install in same folder as CumulusMX.exe. The read me for this utility program is at https://github.com/cumulusmx/CreateMissing/blob/master/README.md.
Check you do not have a file called dayfile.txt.sav in your data sub-folder. If such a file exists, the utility program will not run.
Run the utility by changing directory to the folder where you installed it:
- On Linux operating systems, you need execute rights in that folder (prefix with sudo if you don't have rights) type
- On Microsoft Windows operating systems, type
CreateMissingin a command window, Powershell window, or Terminal window (whichever is available when you right click in the folder or on the "Start" icon.
The utility program, CreateMissing.exe, can be run while MX is left running (except at rollover time when MX writes to dayfile.txt, this includes any time while MX is doing "catch-up" and therefore can do rollovers for past days), but as MX only reads the dayfile.txt as MX starts up, any changes this utility makes will not be picked up by MX until MX is stopped and restarted.
This utility program, CreateMissing.exe, looks in Cumulus.ini for:
- The Cumulus start date in "StartDate=" parameter, which defaults to the date you first ran Cumulus (although it can be edited to another date, such as when you imported earlier data or moved to a new home after you first used Cumulus). That will be the earliest date the utility program processes.
- However, if a dayfile.txt file exists and has an earlier date, then a prompt will ask you if you want to use the earlier date or the "StartDate=" date. If you answer "Y" to use earlier date, the utility program will continue, starting at that earlier date. If you answer with anything else, the utility program will exit.
- The utility program will also check the start date against the current date, and will exit unless you have more than one day completed since you started using MX.
- The meteorological day start time in "RolloverHour=" and "Use10amInSummer=" parameters. This identifies which standard log lines belong to each day by checking against date and time of that line.
- Units and Number of decimal places associated with temperature, wind, wind average, rainfall, pressure, Ultra Violet, sunshine, evapotranspiration, wind run, and temperature trend.
- Thresholds for Heating Degree Days, Cooling Degree Days, and chill hours.
- station type (needed to determine which source values are available)
- month when Chill hours season starts
- options (use zero bearing, use 10 minute wind average, use speed or gust for wind average calculation, fix maximum humidity, read or calculate dew point, read or calculate wind chill, synchronisation time, , set clock option, read or calculate pressure trends, log extra sensors or not, ignore station clock or not, round wind speeds or not, air quality sensor or not, check that minimum number of sensors are updating or not, time for averaging wind bearings, time for averaging wind speed, and time for peak gust)
The utility program, CreateMissing.exe, uses the same module to calculate derived values (like dew point, wind chill, apparent temperature, feels like, and Humidity Index) from source values as CumulusMX.exe. This is how it is able to insert missing fields in the standard log files. As it processes each line in any standard log file, if a particular field is missing, it will calculate it from other fields in the line if it can. The utility program, CreateMissing.exe, can update the various Category:Ini Files with any new extremes found while it is calculating new fields for any standard log file.
The utility program,CreateMissing.exe, looks in the data sub-folder to see if dayfile.txt exists (if it does, its file name has a .sav suffix added after the .txt). If a file with .sav suffix already exists, the utility program will stop, as it cannot create a file if it already exists.
As the utility program, CreateMissing.exe, reads each line in any standard log file it is processing, it works out from the date and time in that line which meteorological date to assign that line to, using the rollover time and use 10am in summer settings. Any day with less than 5 standard log file lines is ignored for dayfile.txt, as is current day.
- At the start of each day, any maximum field in the output file (that is created as dayfile.txt) is set to an extreme negative, any minimum field in the same file is set to an extreme maximum, any daily total field is set to zero, and the cumulative chill hours field is set (either to the figure for the day before, or reset to zero for first day of new season).
- As each standard file line in that meteorological day is processed, any maximum field in the output file is updated if the read figure is higher than previous figure, any minimum field in the same file is updated if the read figure is lower than the previous figure, the total rainfall calculation changed between versions 1.0.0 and 1.0.1 (basically rain total is taken from the final line per day in the standard log file field 9)
- For fields like Heating Degree Days and Cooling Degree Days, CreateMissing.exe is tracking the temperature field 2 against the threshold it has read from Cumulus.ini, so if the degree day figure is missing, the utility is able to insert a figure based on the difference between temperature and threshold and the time since previous log (for heating degree days it is heating threshold minus temperature times minutes since last previous divided by 1440; for cooling it is temperature minus cooling threshold times minutes divided by 1440).
- For total sunshine, day starts just after midnight, and ends next midnight; even if that is not rollover time; the figure stored in dayfile.txt is stored against the meteorological day that applies at 1 minute past midnight. Basically if rollover time is not midnight, the sunshine on a particular calendar day is assigned to previous date in dayfile.txt.
- The average temperature added to dayfile if it is not already in existence, is based on the same approach as used in today.ini, i.e. the utility maintains a cumulative total of time passed for the meteorological day, and a cumulative total incremented as each standard log file line is processed which is an increment of "minutes_since_previous_line multiplied by (latest_temperature + last_temperature) divided by 2".
- Chill hours output is incremented from existing figure by number of minutes since last line divided by 60, if the temperature field is below the threshold.
- Tracking the maximum rainfall in last hour figure for a day is obviously a bit complicated, as the utility has to work on a running hourly rainfall total (total rainfall on line being processed minus total rainfall on line for one hour ago).
The utility program will output diagnostic messages both to any terminal session open, and to a file saved in MXdiags sub-folder.
Here is a short section of typical output (there will also be messages when each log file is opened or finished with):
2021-06-08 19:35:44.688 Date: 02/07/2020 : Adding missing data 2021-06-08 19:35:44.705 Date: 03/07/2020 : Adding missing data 2021-06-08 19:35:44.719 Date: 04/07/2020 : Entry is OK 2021-06-08 19:35:44.720 Date: 05/07/2020 : Entry is OK 2021-06-08 19:35:44.720 Date: 06/07/2020 : Entry is OK 2021-06-08 19:35:44.720 Date: 07/07/2020 : Entry is OK 2021-06-08 19:35:44.720 Date: 08/07/2020 : Entry is OK 2021-06-08 19:35:44.720 Date: 09/07/2020 : Entry is OK 2021-06-08 19:35:44.720 Date: 10/07/2020 : Entry is OK 2021-06-08 19:35:44.721 Date: 11/07/2020 : Adding missing data 2021-06-08 19:35:44.777 Date: 12/07/2020 : Adding missing data 2021-06-08 19:35:44.791 Date: 13/07/2020 : Adding missing data 2021-06-08 19:35:44.805 Date: 14/07/2020 : Adding missing data 2021-06-08 19:35:44.819 Date: 15/07/2020 : Adding missing data 2021-06-08 19:35:44.834 Date: 16/07/2020 : Adding missing data 2021-06-08 19:35:44.848 Date: 17/07/2020 : Adding missing data 2021-06-08 19:35:44.863 Date: 18/07/2020 : Adding missing data 2021-06-08 19:35:44.877 Date: 19/07/2020 : Adding missing data 2021-06-08 19:35:44.892 Date: 20/07/2020 : Adding missing data 2021-06-08 19:35:44.905 Date: 21/07/2020 : Adding missing data 2021-06-08 19:35:44.919 Date: 22/07/2020 : Adding missing data 2021-06-08 19:35:44.933 Date: 23/07/2020 : Adding missing data 2021-06-08 19:35:44.948 Date: 24/07/2020 : Adding missing data 2021-06-08 19:35:44.962 Date: 25/07/2020 : Adding missing data 2021-06-08 19:35:44.977 Date: 26/07/2020 : Adding missing data 2021-06-08 19:35:44.992 Date: 27/07/2020 : Adding missing data 2021-06-08 19:35:45.006 Date: 28/07/2020 : Entry is OK 2021-06-08 19:35:45.006 Date: 29/07/2020 : Entry is OK 2021-06-08 19:35:45.007 Date: 30/07/2020 : Entry is OK
Using a PHP script on your web server
If you have access to a web server that can run PHP Hypertext Pre-processor (PHP) scripts, then this post in support forum includes a script that produces a HTML form where you specify the log file name you wish to edit. The script will read that file, and output a replacement file with all possible spot derived fields populated.
That might sound a bit technical, so here are some step by step instructions:
- Download the processStandardLog.php script from here.
- File transfer (or copy for local web server) that script to your web server
- File transfer (or copy for local web server) all the standard log files from the data sub-folder in your Cumulus installation to a suitable holding folder (you may need to create it) on your web server
- Open in a browser PATH/processStandardLog.php by preceding the file name with the path as defined from the root on your web server
- This loads a web page where you have a field asking you to enter a path and file name for the data log you want to process
- Continue to follow the instructions on the web page
- When it has created a replacement file, you can enter details for another data log, and continue until all your data logs have been processed
- Take a backup of your existing Cumulus installation (you should be doing that on a regular basis anyway, so I will not give instructions here)
- Carefully delete any non-current data log in your data sub-folder that you have a replacement for, and file transfer (or copy back) the replacement data logs from your web server into the local data sub-folder, noting that the file extension will need to be renamed from .csv to .txt.
Using the data log editor provided in MX
When this section was written, the number of lines shown was fixed at a maximum of 10; later releases have given the option to display different numbers of lines, and there may be other changes still to be documented here.
In the MX admin interface go to the Data Logs menu tab, and select the Data Logs page.
There is a box for selecting the data log you want to edit. Once you have loaded that, the first (up to) 10 lines are shown. Navigation links let you select 'First', 'Previous', 'Next', and 'Last' pages, also a small number of pages can be selected directly.
Once you select a line, an Edit button is enabled, click that and you can manually input the missing values for that line. Save that edit, and you can select another line. Once you have edited all the lines on that page, you can select another page, and repeat the process. Then you can select another log, and repeat the process.
It is a long-winded way to edit, and the MX editor does not even validate what you have entered. An alternative is to edit each log file externally, and you can read how to do that in the "Work around for standard log files" section below.
Some readers of the Cumulus support forum will know that a third-party replacement for the MX editor was worked on, but never got incorporated into MX. The idea was to replace the alt_editor software used by Mark Crossley, with a standard HTML form script. This allowed in-line editing, it allowed the derived values to be calculated and displayed (so you simply decided whether to accept the replacements as suggested for the various fields), and finally it applied some validation to each field to ensure any manual edit inserted a value that was within the allowed range. The main reason for its rejection from the public MX was the complex way in which different files included in the admin interface interact, and the consequent issue that changes made for this replacement had a knock on effect on other pages in the admin interface. The author could not afford the time to redesign the whole admin interface so the proposed replacement could be integrated.
Lack of editor in Cumulus 1
Cumulus 1 provides a viewer for the data logs, that does not permit editing of the file.
On the View menu, select 'Data Logs, then enter the file name you want to view and load it. You can scroll left to right through the fields, and you can scroll up and down through the lines. The viewer shows a header row so you know which field is which. You cannot do any editing.
If you find that this viewer cannot load a data log, it is probably because you ignored the read me that is part of the Cumulus 1 installation procedure, see FAQ: I can't find my data files. If the displayed headings do not match the data shown, you have not read the caution on the screen, which says the viewer is only for standard data logs, not extra sensor data logs , nor the daily summary log.
Cumulus 1 does not provide any functionality to edit the standard data logs, whether to correct a rogue value, or to add a missing derivative.
Work around for standard log files
An option is to edit the file outside Cumulus using a Comma Separated File editor, a plain text editor, or a spreadsheet program (like the free open source Libre Office Calc or the commercially charged for Microsoft Excel).
Note: Cumulus 1 applies an exclusive lock to current standard log file, and conflicts can happen if another process seeks to access this file. Consequently don't let your antivirus scans access this file, nor try to edit it outside Cumulus while the original Cumulus software is running. A full discussion of the problems with conflicts of access to the standard log file can be found in this support forum topic.
If you decide to edit the current log outside Cumulus, then remember that, if you leave Cumulus running it will continue to append new lines. Therefore, you either need to close Cumulus while you are doing the edit; or (if you are able to merge two files) close Cumulus while you replace its file with a merge of what you have edited and the extra lines added since you took away a copy to edit.
It is best practice, to take a back-up copy of all your Cumulus installation before starting any editing. It is also best practice to take a further copy of any file you want to amend, and to do your edit on that copy, so you do not edit any Cumulus file directly. The original full backup will preserve the existing file, so you can regress to it, should Cumulus find an error in your edit.
Also note these log files do not include a header line, and should not be edited to include it. All flavours of Cumulus provide, in the data sub-folder, a file called monthlyfileheader.txt which contains the headers appropriate to the release you are running, and you can add that temporarily to your spreadsheet if it helps you with editing, but don't forget to delete it before saving the file ready to make it available to Cumulus.
Here are some other rules to follow when editing the standard log files:
- You can't edit any log file with a word processor, as they add control characters, and other information, that Cumulus cannot understand.
- Editing is straight forward if you use a specialised comma separated value file editor, such editors will split the content by field so it is easy to ensure you only amend field content and do not accidentally change a field divider, plus these editors will not add additional content to any line as they can cope with the number of fields varying in different lines and don't change encoding.
- If you want to use a text editor, it is best if you choose one designed for computer programmers or developers. Such an editor will allow you to select the encoding (Cumulus will be confused by any Byte Order Mark, so select the encoding type without BOM).
- If you choose to use a spreadsheet, ensure that all columns are treated as normal text, do not let (don't accept Excel default) the spreadsheet recognise the first field contains a date as it will convert that column into a number (e.g. days since 1900 or days since 1970). For example in Libre Office make sure that "Detect special numbers" is not selected. Many spreadsheets will offer a CSV option for saving the file (in Libre Office tick "Edit Filter Settings" on "save as ...").
- If you amend a field, ensure that replacement is same format as original (same decimal separator if not integer).
- Ensure no blank lines are introduced by your editing.
- Ensure that all lines continue to have date and time information at the start of the line, and that the format of that identifier is not changed (same sequence, same character(s) separating each element of date, and a colon separating hours and minutes, and that the time does not have a seconds element added.
General External Editing Rules
- Take a copy of the file that can be reverted to if there is a subsequent problem, and you have messed up the file that Cumulus (1 or MX) is now trying to use.
- Take another copy and use that for your editing, don't edit the actual file being used by the software.
- This prevents any conflicts between access by the software and access by your script or tool being used to modify the file.
- It also means that you can go back to the last working copy, you can't upset your "revert" copy.
- The file must never be edited with a word processor, as they store many control and identification characters that prevent Cumulus correctly reading the values.
- Generally, it is easiest if you use either a specialised "Comma Separated Value" file editor or a text editor.
- These tools have the advantage that they can cope with different lines having a different number of fields depending on which version number of Cumulus created each line.
- You can use a spreadsheet application, but if you do, there may be a number of settings to change from their defaults to ensure the file remains in a readable format for Cumulus.
- You need to ensure that your spreadsheet treats every column as plain text, don't let it recognise dates or times and convert them into another format, don't let it convert any numeric field into another format
- If you do use a spreadsheet, extra field separators may be added at end of shorter lines as these make all lines end up with same number of fields.
- Don't remove any figures from fields where figures currently exist, simply overtype one entry with another entry in same format.
- If your file has previously been edited by the relevant editor in MX, a field that looks empty may actually contain one or two space characters.
- If you are editing a field which was empty previously, remember that Cumulus does not accept the concept of nulls (entering -999 or "Null"), there is nothing that can be placed as a place-holder when the correct figure is not known, and empty fields are not permitted in one field if any subsequent field in same line is not empty.
- Beware - if you do insert zero or an obviously wrong extreme value, Cumulus will display those in any editing screen where you wish to update the all-time, monthly-all-time, this month, or this year, extremes. This can make editing by picking values in logs harder.
- Cumulus itself will use zero for any parameters (e.g. solar) not provided by your station, and for up to 6 times it will repeat the last valid value if the station fails to send a value it should provide (normally six successive readings will happen between entries in the standard data log, so repeated values are less likely to affect log files).
- The character (or in a few locales, two characters) used for separating both the day of the month from the month, and for separating the month from the year, must be consistent throughout the whole file (and must not be a single space). Normally, the separator will be either "-" or "/". Whether Cumulus expects a hyphen or a slash is determined by the locale, you must keep to the same locale for the whole file, you cannot change the locale when you do an edit, nor when you update the device running Cumulus. Although, use of comma or point for separating parts of the date is in some locales, and therefore allowed by Cumulus, those locale settings are not recommended as these date separators can cause issues for subsequent edits.
- USA date format with month before day of month, and finally year, is not permitted for log files.
- All figures must be within the range of sensible figures for that field (no hour 24 or higher, no signed numbers when accepted values must be positive, don't put in 200 for a relative humidity)
- Make sure that any editing does not create any blank lines in the file. Cumulus assumes an empty line means end of processing.
- Don't add a header line to the file, Cumulus expects all lines to be data lines.
- Be aware that different devices use different line terminators, so ensure that after editing a file, the line terminator is correct for the device that is running Cumulus:
- The single character representing line feed (in most encodings, LF is binary equivalent of a decimal 10) is used for both UNIX and Linux devices (including Raspberry Pi Operating System)
- The single character representing carriage return (in most encodings, CR is binary equivalent of a decimal 13) is used for Apple operating systems (like Mac)
- The two character sequence first CR then LF is used to terminate lines in all Windows operating systems (part of Microsoft's determination to be different)
- Problems with terminating characters are normally intercepted by operating system, before the contents of a line reaches any software like Cumulus, but if partial editing or merging has produced a file with mixed line terminators, there is a high possibility this will stop any software understanding the resulting file, so be careful if you edit the file on a different device to that running Cumulus.