Amending dayfile: Difference between revisions

6,423 bytes added ,  18:39, 18 June 2021
m
Resequence so MX before legacy
m (Resequence so MX before legacy)
Line 1: Line 1:
{{Template:WorkInProgressBanner}}{{Template:Version badge Mx}}[[Category:Cumulus MX]][[Category:Cumulus Files]][[Category:MX txt Files]][[Category:Cumulus 1]]
Cumulus uses a daily summary log file, the fields in that file are listed at [[Dayfile.txt#List_of_Fields]].  The information about amending the file that was originally on the same page has been moved to this page.


<div style="background: LemonChiffon;padding:5px; margin:2px;">
This page was created with text for the (legacy) Cumulus 1 software, but it has been amended to cover MX as well.
[[File:Crystal Clear info.png|40px]] This text was written for the (legacy) Cumulus 1 software.  It has been updated to cover MX, but that was for a MX release that is no longer latest!
{{Version badge 1}}{{Template:Version badge Mx}}[[Category:Cumulus Files]][[Category:MX txt Files]]


<big>Mark Crossley has now written a utility (download at https://github.com/cumulusmx/CreateMissing) that can update dayfile.txt.</big>
=How Cumulus uses the daily summary log=
</div>


= Safely editing the daily summary log =
While Cumulus is reading your weather station, all daily extremes, counts, and totals, Cumulus needs are stored in [[today.ini]].


At the end of each meteorological day, Cumulus uses information held in [[today.ini]] to write a new line into [[dayfile.txt]], before it resets '''today.ini''' ready for the new day. As discussed in [[Correcting_Extremes]], it is possible for rogue values to be read from a weather station and propagate into various log files, so this article will help you make any necessary corrections.
==Reading the daily summary log file==


The fields contained in the daily summary log are listed in the [[Dayfile.txt#List_of_Fields]]. That page contains a lot of information, and to avoid confusion information about editing this log has been moved here. Both Cumulus 1 and 3 (2 did not) now provide editors where you can see what is in your dayfile.txt log, and if you click on a particular line you can edit the fields in that line, or indeed delete that line. The functionality available to you, depends on the flavour of Cumulus you are running (and which release of that flavour you have installed).
For MX release 3.9.2 - build 3097 onwards, when the software first starts, the whole of '''dayfile.txt''' is read, the contents are used to drive the [[Highcharts_-_Historic]] functionality.


The most common problems with dayfile.txt are:
The file is also read, if you are using the editor provided in Cumulus.
*(MX only) inconsistencies between lines i.e. one of following changes from one line to another
** either the date separator (character or characters between day of month, month, and year parts)
** or the decimal point or decimal comma (that separates the integer and decimal parts of real numbers)
*people see Cumulus giving error messages saying there is an error in a particular line (Cumulus only reports first error, there may be more)
*plots only show data for a subset of the lines in the file, because different lines have different formats for the dates
*a Cumulus user (or an electrical fault) stops or starts the software close to rollover time, a Cumulus user upgrades the software close to rollover time, or another process interferes with Cumulus causing it to twice copy information from '''today.ini''' to '''dayfile.txt''' resulting in a duplicate line with same date (but incorrect content in one of the lines)


All errors generally relate to  
==Writing a new line to the daily summary log file==
* Either using the same file, but moving between computers, without checking the locale settings
 
*Or a mistake in the way a Cumulus user has edited the file, perhaps because of editing the file using Microsoft Excel (and formatting the date column as a date not as text)!  
At the end of each meteorological day, Cumulus uses information held in '''today.ini''' to write a new line into [[dayfile.txt]], before it resets '''today.ini''' ready for the new day.
 
Chill Hours Daily Increment for storing in '''dayfile.txt''' is calculated by substracting the cumulative count in [[yesterday.ini]] from the cumulative count in '''today.ini'''.
 
If rollover, is not at midnight, sunshine hours (these run from midnight to midnight) for the '''dayfile.txt'' are read from '''yesterday.ini'''. For rollover at midnight, sunshine hours from '''today.ini'' (before reset) is read.
 
 
= Problems that occur in the daily summary log and how to safely rectify them =
 
As discussed in [[Correcting_Extremes]], it is possible for rogue values to be read from a weather station, and propagate into various log files. An error in many of those files, corrupts a particular extreme record (or more than one), but generally does not stop Cumulus working.
 
Since MX now reads the entire daily summary log when you start it up, an error in '''dayfile.txt''' can cause a more significant problem, most likely for historic charts, but it can affect other functionality!
 
 
==Summary for most common problems==
 
{| class="wikitable" border="1"
|-
!style="width:100px" | Problem
!style="width:100px" | Possible cause
!style="width:300px" | Rectification for MX releases
!style="width:300px" | Rectification for legacy versions
|-
|  One, or more, past line(s) accidentally deleted or corrupted
| A mistake during a manual view/edit to the file, or a mistake while using the built-in editor
| See [[#Missing or Corrupted past ''dayfile.txt'' lines in any Cumulus software]]
| See [[#Missing or Corrupted past ''dayfile.txt'' lines in any Cumulus software]]
|-
| Inconsistencies in date formats (what comes between day of month, month, and year)
| Examples:
# File was previously used with Cumulus 1 (that did not care what symbol came between parts of date)
# Moving from one device to another (and not ensuring same locale on both devices)
# Editing using an external app (like Excel) and treating date cells as date type, should be text type
| Cannot use editor in MX admin interface, for bulk line edits see [[#Correcting date separator errors]]
| Type over individual dates in built-in editor,  for bulk line edits see [[#Correcting date separator errors]]
|-
| Inconsistencies between decimal comma and decimal points
| Moving from one device to another (and not ensuring same locale on both devices)
| Correct "locale" and/or use an external editor that offers "Replace all" (see [[#Validation by in-built editors]])
| Use '''Control Panel''' to correct region. Correct "locale" and/or use an external editor that offers "Replace all"
|-
| Inconsistencies in list separator (what comes between fields)
| Moving from one device to another (and not ensuring same locale on both devices)
| Correct "locale" and/or use an external editor that offers "Replace all"
| Use '''Control Panel''' to correct region. See [[#Using the Cumulus 1 editing feature]] to check file is now consistent.
|-
| Duplication of dates between lines (either consecutive lines, or non-adjacient lines)
| Electrical fault (or manual restart) affecting Cumulus close to rollover time (should not restart within one "standard interval" plus one minute, before or after)
| Use [[MX_Administrative_Interface#The_Data_Log_Viewing_and_Editing_interface|editor in MX admin interface]], amend one line, and delete other
| See [[#Using the Cumulus 1 editing feature]]. Looking at the duplicate lines, correct one line, using information from it or from the duplicates, then click '''Delete''' to remove the uncorrected line(s)
|-
| Lines not in ascending date order
| Example possibilities:
# Bug in some Cumulus 1.9.2 builds sorted lines into wrong order if PC used USA date format (m-d-y), corrected from 1.9.3 onwards
# Restarting Cumulus after a crash, either manually using "Rewind" approach or Cumulus is confused by a corrupted file
| Manual editing outside MX in a text editor, if particular dates appear twice, see [[#Dates restart/repeat]]
| Manual editing outside Cumulus in a text editor, if particular dates appear twice, see [[#Dates restart/repeat]]
|-
| Some lines with fewer fields than others
| As explained at [[Dayfile.txt#List_of_Fields]], as Cumulus has developed, more fields have been added
| Use [[Calculate_Missing_Values#CreateMissing.exe|CreateMissing.exe]]
| Use workaround described at [[#Legacy Workaround]]
|-
| Some dates (lines) missing
| Examples:
* Inserting data before you start using Cumulus, see [[#Importing data not recorded by Cumulus]]
* Cumulus fails during rollover, so a line is not stored
| Use [[Calculate_Missing_Values#CreateMissing.exe|CreateMissing.exe]]
| Use [[#'''Create Missing''' on legacy dayfile editor]]
|}
 
 
==Missing or Corrupted past ''dayfile.txt'' lines in any Cumulus software==
 
If you accidentally corrupt a line in the [[dayfile.txt|daily summary log]], then view the resulting file:
* MX: Use [[MX_Administrative_Interface#The_Data_Log_Viewing_and_Editing_interface|MX's admin interface]]
* C1: Use [[Cumulus_Screenshots#File.2FEdit.2FHelp_Menu|original Cumulus software]]
 
Note that both flavours have editors that can be used to check the file contents, even if you don't need to edit any line.
 
If you have one, or more, dates missing in your dayfile.txt file, then the next question is, '''has the line been deleted by accident?'''
 
If a line for a particular date was present before, but is now corrupted or missing:
#See if you have a back-up of dayfile.txt with the line present and correct
#*If it is a recent date, then Cumulus makes a backup of dayfile.txt every time it is restarted and after every end-of-day rollover
#*If it is an older date, then maybe you took a back-up onto a separate drive or separate device
#If you have a suitable backup available, take a copy of that file
#Append onto the backup, any dates after when that copy ends, taking the extra lines from the current dayfile.txt
#Rename the current dayfile.txt to say dayfile.old
#Rename the copy you have edited to dayfile.txt and place into '''[[Data folder|data]]''' sub-folder
#Cumulus will now use the file with all days correct
 
 
''One lesson here, is to try to remember (once a week), to check your dayfile.txt log file is okay, because Cumulus retains back-ups for only the last 7 days''
 
'''Another lesson here, is to periodically take a backup, stored away from your Cumulus running environment in case you ever corrupt an old line'''
 
==Dates restart/repeat==
 
If you have a Cumulus crash (either because the connection between the weather station and Cumulus fails; or because there is a untrapped error in the Cumulus code; or because there is a power issue), then when it restarts it is possible that Cumulus will think it is doing catch-up from an earlier day, and the ''dayfile.txt'' may end up with consecutive lines being in date ascending order until the problem, then jumping back to an earlier date, before continuing in date asceneding order (but repeating one, or more, dates already in file).
 
If Cumulus was working correctly before the problem, then the lines stored before the problem should be okay, just delete the lines that repeat earlier dates, so the file ends up being date ascending order with no dupicates. Similarly, if Cumulus was working correctly after the problem, but there was an issue before the restart, then keep the lines that repeat the dates, but delete the earlier lines with same dates, so the file ends up being date ascending order with no dupicates.
 
If there are two lines with the date when the problem occured, then it is likely you will manually have to edit the two lines into one line.  Any field with a time-stamp before the problem will be kept unless it is obvious that extreme was correctly broken (i.e. not rogue restart value) after the problem.
 
If the dates restart in your daily summary log file, because you manually stopped Cumulus close to a rollover time, or you corrupted a file perhaps by regressing to an older release and back; then it is likely you will need to merge the two lines with same date, deciding for each value field which is more likely to be right, and matching it with correct time-stamp. A rainfall (or wind run) total might require summing totals in the two individual lines, or discarding a rouge value and accepting the other, your judgement!


==Validation by in-built editors==
==Validation by in-built editors==
Line 31: Line 129:
The legacy editor does also validate individual fields for appropriate content (integer, real number, time-stamp).  
The legacy editor does also validate individual fields for appropriate content (integer, real number, time-stamp).  


Unfortunately, the editor provided with MX does not validate any fields.  Thus you can use the wrong separator (between date elements, between hour and minute for time-stamps, between integer and decimal parts in any real number) in the MX editor and the incorrect line will be accepted.   
Unfortunately, '''the editor provided with MX does not validate any fields'''.  Thus you can use the wrong separator (between date elements, between hour and minute for time-stamps, between integer and decimal parts in any real number) in the MX editor and the incorrect line will be accepted.   


==Correcting date separator errors==
==Correcting date separator errors==


The legacy software accepts any character (except space) as the separator between the day of month, the month, and the year, elements of the date.  Therefore Cumulus 1 does not care if that separator is sometimes "/", sometimes "-", and/or sometimes ".".
=== Date Separator in MX===
 
MX is fussy, the same separator must be used in every date in the file. An error will be reported in diagnostics, and the historic graphs will stop working if the separator changes from one line to another.
MX is fussy, the same separator must be used in every date in the file. An error will be reported in diagnostics, and the historic graphs will stop working if the separator changes from one line to another.
# So look at the last line in the file, that is the character MX expects
# So look at the last line in the file, that is the character MX expects
Line 47: Line 144:
See [https://cumulus.hosiene.co.uk/viewtopic.php?f=40&t=18340 this forum thread] for a fuller discussion.
See [https://cumulus.hosiene.co.uk/viewtopic.php?f=40&t=18340 this forum thread] for a fuller discussion.


===Date Separator in Legacy Software===
The legacy software accepts any character (except space) as the separator between the day of month, the month, and the year, elements of the date.  Therefore Cumulus 1 does not care if that separator is sometimes "/", sometimes "-", and/or sometimes ".".


Historic note: In Cumulus 1 builds, any symbol (including ;, :, /, &, -, and .) character (excluding what is defined as list separator) within the first field of each line was treated as part of separator characters when parsing for date. For builds 3000 to build 3049, MX used fixed offsets to find day, month, year. From Build 3050 MX uses the separators defined by the OS to split the values (so allowing for multi-character separators), but it does mean it will be sensitive to the separator value changing.
Historic note: In Cumulus 1 builds, any symbol (including ;, :, /, &, -, and .) character (excluding what is defined as list separator) within the first field of each line was treated as part of separator characters when parsing for date. For builds 3000 to build 3049, MX used fixed offsets to find day, month, year. From Build 3050 MX uses the separators defined by the OS to split the values (so allowing for multi-character separators), but it does mean it will be sensitive to the separator value changing.
Line 52: Line 151:
= Importing data not recorded by Cumulus =
= Importing data not recorded by Cumulus =


You might have been using your weather station with some other weather software before you installed Cumulus.  If you can get weather data in the format of daily summaries (and the rollover times match), you can import that data into the Cumulus dayfile.txt file using a script or spreadsheet package.  All you have to ensure is that you can arrange the output to be in lines with fields in sequence shown in [[Dayfile.txt#List_of_Fields]].  There is more guidance later on this page about the rules you must obey for this file.
You might have been using your weather station with some other weather software before you installed Cumulus.  If you can get weather data in the format of daily summaries (and the rollover times match), you can import that data into the Cumulus '''dayfile.txt''' file using a script or spreadsheet package.  All you have to ensure is that you can arrange the output to be in lines with fields in sequence shown in [[Dayfile.txt#List_of_Fields]].  There is more guidance later on this page about the rules you must obey for this file.


If you have imported the data from the other weather software into the [[Standard_log_files]] format, then in the Cumulus 1 editor, ''Create missing'' can insert the new rows for those days previously missing in dayfile.txt, as explained below.  
If you have imported the data from the other weather software into the [[Standard_log_files]] format, then in the Cumulus 1 editor, ''Create missing'' can insert the new rows for those days previously missing in dayfile.txt, as explained below.  
= Using CumulusMX.exe editing functionality =
The editor in MX can be found in the administrative interface by selecting [[MX_Administrative_Interface#The_Data_Log_Viewing_and_Editing_interface|Data Logs menu and '''Dayfile''' page]]. The '''Dayfile viewer/editor'' will display some lines at a time (e.g. 10 at a time or more). When the page is first loaded, the oldest lines will be read from the file by the Cumulus MX engine, and via an '''application programming interface''' (api) transferred to the web page where the lines are displayed using some software called ''datatables''. That software generates a navigation section where you can navigate to First, Previous, Next, and Last, with (for a longer file) up to 6 page numbers (each containing up to the selected number of lines) that you can select directly.
Basically, this is a text editor, but you have to amend lines using a pop-up, a proposal to use in-line editing never made it into a formal release. Another pop-up is used to confirm dleting a line.  The editor does not let you edit the date field.  Each line is identified by a line number.
This editor does not provide any way of inserting new lines into dayfile.txt (so you cannot correct an error when MX end of day failed and a line was not created), nor is there any way of changing the dates used by lines in the file (a very common problem reported by Cumulus users is that MX is giving them problems because not all lines in this file use the same format for the date, but this editor cannot resolve that).
There is a '''Refresh''' button that sends a '''application programming interface''' instruction asking the MX engine to resend the lines on the currently selected page via the api.
When you select a line in the provided editor, both  '''Edit''' and '''Delete'''  buttons are enabled.
Pick '''Edit''', click that, and an editing dialog pops up (MX uses '''altEditor ''' software for this). The pop up window does not let you change the line number nor the date, but all other fields show their current contents and you can overtype as necessary. Scroll down to see 2 buttons (how they are labelled depends on which version you are using), the left hand button ignores any edits you have made (it is labelled 'Close' or "Cancel" and simply does same effect as clicking the "x" in the top right corner), it prevents the api sending any replace message back to the MX engine. The right hand button saves your changes (even if it is labelled 'Edit' rather than "Save" in the version you are using) by using the api to send the replacement array back to the MX engine where it will replace the relevant line number before writing back to the log file.
There is no validation in the MX editor that was set up relatively quickly in version 3.4.5 as the first of 3 log file editors to plug a gap in MX functionality in earlier versions:
*some fields can only accept integers, other expect decimals,
* and some fields can accept negatives, others don't accept signed numbers
*some fields have a minimum and/or maximum acceptable value
As all lines are passed back via an application programme interface to the MX engine, there is no validation there either, the new line replaces the old one when the whole file is recreated. It is likely that the next time MX attempts to read the dayfile.txt it will find any error.  There was a third-party proposal to add simple validation into a replacement editor, that would hav
Pick '''Delete''', click that, and a simple dialog pops up (MX uses '''altEditor ''' software for this) showing all the fields in the selected line and asking you to confirm that you want to delete it. Again, the labelling on the buttons varies depending on which version you are running, one confirms the deletion (which sends the array back to the MX engine with an instruction that line number is to be deleted.  Despite the MX engine getting a copy of the fields that are to be deleted, it does not validate the fields, just the line number. The button labelled 'Close' or 'Cancel' does the same effect as clicking the "x" in the top right corner, it prevents the api sending any deletion message back to the MX engine.
==Cautions if using an obsolete MX release==
* '''Cumulus MX beta version 3.0.0 (checked at build 3043) does not provide an editor'''
* '''Cumulus MX Version 3.4.5 - Build 3069 onwards provides an editor'''
* From MX release 3.9.2 - b3097 historic charts are added to admin interface
** If you use the in-built editor to update dayfile.txt, your change will be reflected in the historic graphs
** If you edit dayfile.txt outside Cumulus MX, historic graphs will not be updated until Cumulus MX is restarted
If lines in your [[dayfile.txt|daily summary log]] were created by  a variety of Cumulus 1 releases (so some have less than 46 fields), you need to use Cumulus MX version 3.7.0, or later, to be sure that the provided editor will cope. The code was actually amended to be able to read lines with fewer fields at version 3.6.0, when 4 fields were added for feels like, so the total number of fields became 50.
It is recommended that nobody uses any 3.6.x version (see [[Updating_MX_to_new_version#If_using_a_3.5.x_release]]. (For historical interest only, Emergency Version 3.6.12 changed the number of fields to 54 in error)
From formal release 3.7.0, MX's dayfile.txt reverted to 52 fields. The extras are Canadian Humidity Index (Humidex). At the time of typing this, it has been said this file structure will not be changed again.
Whatever MX release you use, any line that is edited (even if it originally had fewer or more fields) will be saved with the same number of fields that release uses when it creates a line from the contents of today.ini.
= Using CreateMissing.exe editing functionality=
'''You must be running MX in order to use this utility''', as some information is shared between CumulusMX.exe and CreateMissing.exe.
Please see [[Calculate_Missing_Values#CreateMissing.exe|CreateMissing.exe]] and/or https://github.com/cumulusmx/CreateMissing/blob/master/README.md.
Information there is not repeated here.
Basically, this utility will not replace any data that is already in the daily summary log file. It will create new lines if data for those missing lines can be derived from data already in [[Standard_log_files]]. If an individual line in '''dayfile.txt''' is shorter than the number of fields expected in the current MX release, then '''CreateMissing.exe''' will calculate daily values for the missing fields based on data already in [[Standard_log_files]].




Line 67: Line 218:
*you can use '''insert''' key to add one or more missing rows (complete days) manually typing in values for all fields,
*you can use '''insert''' key to add one or more missing rows (complete days) manually typing in values for all fields,
*use '''delete''' key to remove an entire day (e.g. if you get a 'duplicate' error message) after ensuring all fields are correct in the line that will remain,
*use '''delete''' key to remove an entire day (e.g. if you get a 'duplicate' error message) after ensuring all fields are correct in the line that will remain,
*use '''Create missing''' button to insert missing rows (complete days) by reading from [[Standard_log_files]] and automatically calculating the best approximations for each field for those missing days.
*use '''Create missing''' button to insert missing rows (complete days) by reading from [[Standard_log_files]] and automatically calculating the best approximations for each field for those missing days (see next section)


== Create Missing ==
== '''Create Missing''' on legacy dayfile editor ==


If a date is missing from dayfile.txt, and not available in a back-up, then it is possible to create a missing line (with approximations for the derived extreme values) in Cumulus 1.  That functionality is known as "Create Missing" and is found [[Cumulus_Screenshots#File.2FEdit.2FHelp_Menu|within the edit dayfile.txt screen]].
If a date is missing from dayfile.txt, and not available in a back-up, then it is possible to create a missing line (with approximations for the derived extreme values) in Cumulus 1.  That functionality is known as "Create Missing" and is found [[Cumulus_Screenshots#File.2FEdit.2FHelp_Menu|within the edit dayfile.txt screen]].
Line 87: Line 238:
If a particular day does not exist as a row on the daily summary log, then 'create missing' can search the observations in the relevant monthly log, and calculate approximate highs, lows and totals to insert as an extra row in the daily summary log. These are approximate because the actual highs and lows for that day are quite likely to have occurred at moments in-between those that were logged.  
If a particular day does not exist as a row on the daily summary log, then 'create missing' can search the observations in the relevant monthly log, and calculate approximate highs, lows and totals to insert as an extra row in the daily summary log. These are approximate because the actual highs and lows for that day are quite likely to have occurred at moments in-between those that were logged.  


For ''Create missing'' a list of inserted records is produced in [[dayfileeditlog.txt]].  
For the legacy ''Create missing'' a list of inserted records is produced in [[dayfileeditlog.txt]].  


If just some fields are wrong in a particular row (meteorological day) on day file, then there is a [[Standard_log_files#Using_Monthly_logs_to_deal_with_shorter_.28or_incomplete.29_dayfile.txt_records_for_particular_dates | work around]] as at all current versions (up to 1.9.4) you can only use 'Create missing' to read from the [[Standard_log_files]] if the whole day (a line starting with that date) is missing in ''dayfile.txt''.  Although Cumulus does not recognise the concept of a sensor not being available, it will write solar information even if you don't have a solar sensor; it does have to cope with reading a monthly log file that might have fewer derivatives than it wants (when using Create Missing) and therefore it may not know what to write into dayfile.txt as the calculated value. Cumulus 1 can't write a null value, so it writes zero for values, and "00:00" for time stamps. If you are using a 9am or 10am rollover time, be aware that create missing in Cumulus 1 always inserts 00:00 for null time-stamps, but in normal running Cumulus uses the rollover time for null time-stamps.
If just some fields are wrong in a particular row (meteorological day) on day file, then there is a [[Standard_log_files#Using_Monthly_logs_to_deal_with_shorter_.28or_incomplete.29_dayfile.txt_records_for_particular_dates | work around]] as at all current versions (up to 1.9.4) you can only use 'Create missing' to read from the [[Standard_log_files]] if the whole day (a line starting with that date) is missing in ''dayfile.txt''.  Although Cumulus does not recognise the concept of a sensor not being available, it will write solar information even if you don't have a solar sensor; it does have to cope with reading a monthly log file that might have fewer derivatives than it wants (when using Create Missing) and therefore it may not know what to write into dayfile.txt as the calculated value. Cumulus 1 can't write a null value, so it writes zero for values, and "00:00" for time stamps. If you are using a 9am or 10am rollover time, be aware that create missing in Cumulus 1 always inserts 00:00 for null time-stamps, but in normal running Cumulus uses the rollover time for null time-stamps.


== Dealing with errors identified by the software ==
== Dealing with errors identified by the legacy software ==


If there is an error in ''dayfile.txt'', then it is most likely to be found when you are viewing its data on one of the screens for editing the monthly, annual or all-time extremes.  Cumulus 1 will illuminate its ''Error'' light if it finds an error in such cases and tell you the line/row number of the first found error, together with some details of the error it found. For example, if a row is blank, a row is duplicated, a field is corrupted, a field does not have an acceptable value, or a field is missing so subsequent fields are to the left of where they should be.
If there is an error in ''dayfile.txt'', then it is most likely to be found when you are viewing its data on one of the screens for editing the monthly, annual or all-time extremes.  Cumulus 1 will illuminate its ''Error'' light if it finds an error in such cases and tell you the line/row number of the first found error, together with some details of the error it found. For example, if a row is blank, a row is duplicated, a field is corrupted, a field does not have an acceptable value, or a field is missing so subsequent fields are to the left of where they should be.
Line 98: Line 249:




==Missing or Corrupted dayfile.txt lines==
==Correcting individual fields in multiple dayfile.txt lines==


If you accidentally corrupt a line in the [[dayfile.txt|daily summary log]], then both the [[Cumulus_Screenshots#File.2FEdit.2FHelp_Menu|original Cumulus software]] and [[MX_Administrative_Interface#The_Data_Log_Viewing_and_Editing_interface|MX's admin interface]] have editors for viewing and modifying content.
Often people want to correct an individual field, in all lines within a particular period.


If you have one, or more, dates missing in your dayfile.txt file, then the next question is, '''has the line been deleted by accident?'''
The most common example is because you have suddenly discovered your daily pressure high (and low) are wrong by a certain offset, because you used the wrong setting for converting absolute pressure to the sea level equivalent you want to store in the file.  
 
If a line for a particular date was present before, but is now corrupted or missing:
#See if you have a back-up of dayfile.txt with the line present and correct
#*If it is a recent date, then Cumulus makes a backup of dayfile.txt every time it is restarted and after every end-of-day rollover
#*If it is an older date, then maybe you took a back-up onto a separate drive or separate device
#If you have a suitable backup available, take a copy of that file
#Append onto the copy, any dates after when that copy ends, taking the extra lines from the current dayfile.txt
#Rename the current dayfile.txt to say dayfile.old
#Rename the copy you have edited to dayfile.txt and place into '''[[Data folder|data]]''' sub-folder
#Cumulus will now use the file with all days correct
 
 
''One lesson here, is to try to remember (once a week), to check your dayfile.txt log file is okay, because Cumulus retains back-ups for only the last 7 days''
 
'''Another lesson here, is to periodically take a backup, stored away from your Cumulus running environment in case you ever corrupt an old line'''
 
 
==Correcting individual fields in existing dayfile.txt lines==
 
The "Create Missing" functionality, described in earlier sub-section, is designed for when an entire line is missing for a prior date.  Often people want to correct an individual field, in all lines within a particular period.  This might be because you have suddenly discovered your daily pressure high and low are wrong by a certain offset, because you used the wrong setting for converting absolute pressure to the sea level equivalent you want to store in the file.  


Neither Cumulus 1 nor MX provide any functionality to make such multi-line editing easy.  
Neither Cumulus 1 nor MX provide any functionality to make such multi-line editing easy.  


However, this can be resolved by opening dayfile.txt in a spreadsheet (carefully ensuring each column is treated as either text (date and time fields) or number (the value fields) and that your field separator is set in the filter conditions to be a column separator. Spreadsheets have a "Paste Special" function that allows you to add/subtract a constant to every cell in a column.  
However, this can be resolved by opening dayfile.txt in a spreadsheet (carefully ensuring each column is treated as either '''text''' (date and time fields) or number (the value fields) and that '''your field separator''' is set in the '''filter conditions''' to be a column separator for converting to spreadsheet. Spreadsheets have a "Paste Special" function that allows you to add/subtract a constant to every cell in a column.  


==Correcting individual fields in multiple lines of Daily summary Log in Cumulus 1==
===Correcting individual fields in multiple lines of Daily summary Log in Cumulus 1===


In the '''Edit''' menu, select '''Dayfile.txt''' screen, for a text editor where you can overwrite entries, delete entire lines, and insert new lines (and then manually type in values for every field). You can scroll left and right between fields, with a header row identifying which field is which, and you can scroll up and down through all the lines.  If you know what you want to change (such as replacing a rogue figure), this is a very easy to use editor.
In the '''Edit''' menu, select '''Dayfile.txt''' screen, for a text editor where you can overwrite entries, delete entire lines, and insert new lines (and then manually type in values for every field). You can scroll left and right between fields, with a header row identifying which field is which, and you can scroll up and down through all the lines.  If you know what you want to change (such as replacing a rogue figure), this is a very easy to use editor.


For the daily summary log, the original Cumulus software includes functionality to '''Create Missing''' in its daily summary log editor, see [[Amending_dayfile#Create_Missing]].  This functionality creates an entire missing log line and will insert highs and lows whether they are extremes of source values, or extremes of derived values.  
For the daily summary log, the original Cumulus software includes functionality to '''Create Missing''' in its daily summary log editor, see [[# '''Create Missing''' on legacy dayfile editor]].  This functionality creates '''an entire missing log line'' and will insert highs and lows whether they are extremes of source values, or extremes of derived values. It will only add those fields (to any new line) that are maximum or minimum (or sum, or equal to) a field that does exist in the [[Standard_log_files]] lines that belong to the same meteorological day.


== Workaround==
==Legacy Workaround==


This functionality is not designed to work out individual missing extreme figures, only to insert complete missing lines. However, we can workaround that constraint:
The legacy functionality is not designed to insert (or correct) individual missing extreme figures for daily summary lines that already have some fields in them, only to insert complete missing lines. However, we can workaround that constraint:


'''WORKAROUND FOR DAYFILE.TXT if required dates are present in both the standard log and dayfile.txt, but not all fields for that date exist in dayfile.txt'''
'''WORKAROUND FOR DAYFILE.TXT if required dates are present in both the standard log and dayfile.txt, but not all fields for that date exist in dayfile.txt'''
Line 169: Line 300:
*Cumulus 1 does not have the functionality to retrospectively calculate derived values when it is reading source values in the standard data log line.
*Cumulus 1 does not have the functionality to retrospectively calculate derived values when it is reading source values in the standard data log line.


= [[File:Badge vMx.png]]Using the Cumulus MX editing functionality=
*'''Cumulus MX beta version 3.0.0 (checked at build 3043) does not provide an editor'''
*'''Cumulus MX Version 3.4.5 - Build 3069 onwards provides an editor'''
*From MX release 3.9.2 - b3097 historic charts are added to admin interface
**If you use the in-built editor to update dayfile.txt, your change will be reflected in the historic graphs
**If you edit dayfile.txt outside Cumulus MX, historic graphs will not be updated until Cumulus MX is restarted
There is a dayfile.txt editor within the admin interface to edit this log file.  In the '''Edit''' menu, choose the '''Dayfile''' option.
If lines in your [[dayfile.txt|daily summary log]] were created by  a variety of Cumulus 1 releases (so some have less than 46 fields), you need to use Cumulus MX version 3.7.0, or later, to be sure that the provided editor will cope. The code was actually amended to be able to read lines with fewer fields at version 3.6.0, when 4 fields were added for feels like, so the total number of fields became 50.
It is recommended that nobody uses any 3.6.x version (see [[Updating_MX_to_new_version#If_using_a_3.5.x_release]]. (For historical interest only, Emergency Version 3.6.12 changed the number of fields to 54 in error)
From formal release 3.7.0, MX's dayfile.txt reverted to 52 fields. The extras are Canadian Humidity Index (Humidex). At the time of typing this, it has been said this file structure will not be changed again.
Whatever MX release you use, any line that is edited (even if it originally had fewer or more fields) will be saved with the same number of fields that release uses when it creates a line from the contents of today.ini.
=== Editing  inside MX ===
The editor in MX can be found in the administrative interface by selecting [[MX_Administrative_Interface#The_Data_Log_Viewing_and_Editing_interface|Data Logs menu and '''Dayfile''' page]]. The '''Dayfile viewer/editor'' will display up to 10 lines at a time. When the page is first loaded, the oldest lines will be read from the file by the Cumulus MX engine, and via an '''application programming interface''' (api) transferred to the web page where the lines are displayed using some software called ''datatables''. That software generates a navigation section where you can navigate to First, Previous, Next, and Last, with (for a longer file) up to 6 page numbers (each containing up to 10 lines) that you can select directly.
The editor does not provide any way of inserting new lines into dayfile.txt (so you cannot correct an error when MX end of day failed and a line was not created), nor is there any way of changing the dates used by lines in the file (a very common problem reported by Cumulus users is that MX is giving them problems because not all lines in this file use the same format for the date, but this editor cannot resolve that).
There is a '''Refresh''' button that sends a '''application programming interface''' instruction asking the MX engine to resend the lines on the currently selected page via the api.
When you select a line in the provided editor, both  '''Edit''' and '''Delete'''  buttons are enabled.
Pick '''Edit''', click that, and an editing dialog pops up (MX uses '''altEditor ''' software for this). The pop up window does not let you change the line number nor the date, but all other fields show their current contents and you can overtype as necessary. Scroll down to see 2 buttons (how they are labelled depends on which version you are using), the left hand button ignores any edits you have made (it is labelled 'Close' or "Cancel" and simply does same effect as clicking the "x" in the top right corner), it prevents the api sending any replace message back to the MX engine. The right hand button saves your changes (even if it is labelled 'Edit' rather than "Save" in the version you are using) by using the api to send the replacement array back to the MX engine where it will replace the relevant line number before writing back to the log file.
There is no validation in the MX editor that was set up relatively quickly in version 3.4.5 as the first of 3 log file editors to plug a gap in MX functionality in earlier versions:
*some fields can only accept integers, other expect decimals,
* and some fields can accept negatives, others don't accept signed numbers
*some fields have a minimum and/or maximum acceptable value
As all lines are passed back via an application programme interface to the MX engine, there is no validation there either, the new line replaces the old one when the whole file is recreated. It is likely that the next time MX attempts to read the dayfile.txt it will find any error.  There was a third-party proposal to add simple validation into a replacement editor, that would hav
Pick '''Delete''', click that, and a simple dialog pops up (MX uses '''altEditor ''' software for this) showing all the fields in the selected line and asking you to confirm that you want to delete it. Again, the labelling on the buttons varies depending on which version you are running, one confirms the deletion (which sends the array back to the MX engine with an instruction that line number is to be deleted.  Despite the MX engine getting a copy of the fields that are to be deleted, it does not validate the fields, just the line number. The button labelled 'Close' or 'Cancel' does the same effect as clicking the "x" in the top right corner, it prevents the api sending any deletion message back to the MX engine.


= Important Rules when editing dayfile.txt =
= Important Rules when editing dayfile.txt =
5,838

edits