From b766299efd892d6b65bb4682d0c5a56c6537a8ca Mon Sep 17 00:00:00 2001 From: Mark Crossley <1196094+mcrossley@users.noreply.github.com> Date: Fri, 26 Feb 2021 12:29:05 +0000 Subject: [PATCH 1/4] Improve NOAA error handling Improve AWEKAS upload interval fallback --- CumulusMX/Cumulus.cs | 141 +++++++++++++++------------ CumulusMX/NOAAReports.cs | 61 +++++++----- CumulusMX/Properties/AssemblyInfo.cs | 6 +- Updates.txt | 6 ++ 4 files changed, 125 insertions(+), 89 deletions(-) diff --git a/CumulusMX/Cumulus.cs b/CumulusMX/Cumulus.cs index 7eeef3cd..1ae76684 100644 --- a/CumulusMX/Cumulus.cs +++ b/CumulusMX/Cumulus.cs @@ -2085,79 +2085,92 @@ internal async void UpdateAwekas(DateTime timestamp) try { - HttpResponseMessage response = await AwekashttpClient.GetAsync(url); - var responseBodyAsText = await response.Content.ReadAsStringAsync(); - LogDebugMessage("AWEKAS Response code = " + response.StatusCode); - LogDataMessage("AWEKAS: Response text = " + responseBodyAsText); - //var respJson = JsonConvert.DeserializeObject(responseBodyAsText); - var respJson = JsonSerializer.DeserializeFromString(responseBodyAsText); - - // Check the status response - if (respJson.status == 2) - LogMessage("AWEKAS: Data stored OK"); - else if (respJson.status == 1) - { - LogMessage("AWEKAS: Data PARIALLY stored"); - // TODO: Check errors and disabled - } - else if (respJson.status == 0) // Authenication error or rate limited + using (HttpResponseMessage response = await AwekashttpClient.GetAsync(url)) { - if (respJson.minuploadtime > 0 && respJson.authentication == 0) + var responseBodyAsText = await response.Content.ReadAsStringAsync(); + LogDebugMessage("AWEKAS Response code = " + response.StatusCode); + LogDataMessage("AWEKAS: Response text = " + responseBodyAsText); + //var respJson = JsonConvert.DeserializeObject(responseBodyAsText); + var respJson = JsonSerializer.DeserializeFromString(responseBodyAsText); + + // Check the status response + if (respJson.status == 2) + LogMessage("AWEKAS: Data stored OK"); + else if (respJson.status == 1) { - LogMessage("AWEKAS: Authentication error"); - if (AWEKAS.Interval < 60) - { - AWEKAS.RateLimited = true; - AWEKAS.OriginalInterval = AWEKAS.Interval; - AWEKAS.Interval = 60; - AwekasTimer.Enabled = false; - AWEKAS.SynchronisedUpdate = true; - LogMessage("AWEKAS: Temporarily increasing AWEKAS upload interval to 60 seconds due to authenication error"); - } + LogMessage("AWEKAS: Data PARIALLY stored"); + // TODO: Check errors and disabled } - else if (respJson.minuploadtime == 0) + else if (respJson.status == 0) // Authenication error or rate limited { - LogMessage("AWEKAS: Too many requests, rate limited"); - if (AWEKAS.Interval < 60) + if (respJson.minuploadtime > 0 && respJson.authentication == 0) + { + LogMessage("AWEKAS: Authentication error"); + if (AWEKAS.Interval < 300) + { + AWEKAS.RateLimited = true; + AWEKAS.OriginalInterval = AWEKAS.Interval; + AWEKAS.Interval = 300; + AwekasTimer.Enabled = false; + AWEKAS.SynchronisedUpdate = true; + LogMessage("AWEKAS: Temporarily increasing AWEKAS upload interval to 300 seconds due to authenication error"); + } + } + else if (respJson.minuploadtime == 0) + { + LogMessage("AWEKAS: Too many requests, rate limited"); + // AWEKAS PLus allows minimum of 60 second updates, try that first + if (!AWEKAS.RateLimited && AWEKAS.Interval < 60) + { + AWEKAS.OriginalInterval = AWEKAS.Interval; + AWEKAS.RateLimited = true; + AWEKAS.Interval = 60; + AwekasTimer.Enabled = false; + AWEKAS.SynchronisedUpdate = true; + LogMessage("AWEKAS: Temporarily increasing AWEKAS upload interval to 60 seconds due to rate limit"); + } + // AWEKAS normal allows minimum of 300 second updates, revert to that + else + { + AWEKAS.RateLimited = true; + AWEKAS.Interval = 300; + AwekasTimer.Interval = AWEKAS.Interval * 1000; + AwekasTimer.Enabled = !AWEKAS.SynchronisedUpdate; + AWEKAS.SynchronisedUpdate = AWEKAS.Interval % 60 == 0; + LogMessage("AWEKAS: Temporarily increasing AWEKAS upload interval to 300 seconds due to rate limit"); + } + } + else { - AWEKAS.RateLimited = true; - AWEKAS.OriginalInterval = AWEKAS.Interval; - AWEKAS.Interval = 60; - AwekasTimer.Enabled = false; - AWEKAS.SynchronisedUpdate = true; - LogMessage("AWEKAS: Temporarily increasing AWEKAS upload interval to 60 seconds due to rate limit"); + LogMessage("AWEKAS: Unknown error"); } } - else + + // check the min upload time is greater than our upload time + if (respJson.status > 0 && respJson.minuploadtime > AWEKAS.OriginalInterval) { - LogMessage("AWEKAS: Unknown error"); + LogMessage($"AWEKAS: The minimum upload time to AWEKAS for your station is {respJson.minuploadtime} sec, Cumulus is configured for {AWEKAS.OriginalInterval} sec, increasing Cumulus interval to match AWEKAS"); + AWEKAS.Interval = respJson.minuploadtime; + WriteIniFile(); + AwekasTimer.Interval = AWEKAS.Interval * 1000; + AWEKAS.SynchronisedUpdate = AWEKAS.Interval % 60 == 0; + AwekasTimer.Enabled = !AWEKAS.SynchronisedUpdate; + // we got a successful upload, and reset the interval, so clear the rate limited values + AWEKAS.OriginalInterval = AWEKAS.Interval; + AWEKAS.RateLimited = false; + } + else if (AWEKAS.RateLimited && respJson.status > 0) + { + // We are currently rate limited, it could have been a transient thing because + // we just got a valid response, and our interval is >= the minimum allowed. + // So we just undo the limit, and resume as before + LogMessage($"AWEKAS: Removing temporary increase in upload interval to 60 secs, resuming uploads every {AWEKAS.OriginalInterval} secs"); + AWEKAS.Interval = AWEKAS.OriginalInterval; + AwekasTimer.Interval = AWEKAS.Interval * 1000; + AWEKAS.SynchronisedUpdate = AWEKAS.Interval % 60 == 0; + AwekasTimer.Enabled = !AWEKAS.SynchronisedUpdate; + AWEKAS.RateLimited = false; } - } - - // check the min upload time is greater than our upload time - if (respJson.status > 0 && respJson.minuploadtime > AWEKAS.OriginalInterval) - { - LogMessage($"AWEKAS: The minimum upload time to AWEKAS for your station is {respJson.minuploadtime} sec, Cumulus is configured for {AWEKAS.OriginalInterval} sec, increasing Cumulus interval to match AWEKAS"); - AWEKAS.Interval = respJson.minuploadtime; - WriteIniFile(); - AwekasTimer.Interval = AWEKAS.Interval * 1000; - AWEKAS.SynchronisedUpdate = AWEKAS.Interval % 60 == 0; - AwekasTimer.Enabled = !AWEKAS.SynchronisedUpdate; - // we got a successful upload, and reset the interval, so clear the rate limited values - AWEKAS.OriginalInterval = AWEKAS.Interval; - AWEKAS.RateLimited = false; - } - else if (AWEKAS.RateLimited && respJson.status > 0) - { - // We are currently rate limited, it could have been a transient thing because - // we just got a valid response, and our interval is >= the minimum allowed. - // So we just undo the limit, and resume as before - LogMessage($"AWEKAS: Removing temporary increase in upload interval to 60 secs, resuming uploads every {AWEKAS.OriginalInterval} secs"); - AWEKAS.Interval = AWEKAS.OriginalInterval; - AwekasTimer.Interval = AWEKAS.Interval * 1000; - AWEKAS.SynchronisedUpdate = AWEKAS.Interval % 60 == 0; - AwekasTimer.Enabled = !AWEKAS.SynchronisedUpdate; - AWEKAS.RateLimited = false; } } catch (Exception ex) diff --git a/CumulusMX/NOAAReports.cs b/CumulusMX/NOAAReports.cs index 2179e3ed..e0d57710 100644 --- a/CumulusMX/NOAAReports.cs +++ b/CumulusMX/NOAAReports.cs @@ -27,14 +27,21 @@ public List GenerateNoaaYearReport(int year) cumulus.LogMessage("Creating NOAA yearly report"); report = noaa.CreateYearlyReport(noaats); - // If not using UTF, then we have to convert the character set - var utf8WithoutBom = new System.Text.UTF8Encoding(false); - var encoding = cumulus.NOAAUseUTF8 ? utf8WithoutBom : System.Text.Encoding.GetEncoding("iso-8859-1"); - var reportName = noaats.ToString(cumulus.NOAAYearFileFormat); - noaafile = cumulus.ReportPath + reportName; - cumulus.LogMessage("Saving yearly NOAA report as " + noaafile); - File.WriteAllLines(noaafile, report, encoding); - + try + { + // If not using UTF, then we have to convert the character set + var utf8WithoutBom = new System.Text.UTF8Encoding(false); + var encoding = cumulus.NOAAUseUTF8 ? utf8WithoutBom : System.Text.Encoding.GetEncoding("iso-8859-1"); + var reportName = noaats.ToString(cumulus.NOAAYearFileFormat); + noaafile = cumulus.ReportPath + reportName; + cumulus.LogMessage("Saving yearly NOAA report as " + noaafile); + File.WriteAllLines(noaafile, report, encoding); + } + catch (Exception e) + { + cumulus.LogMessage($"Error creating NOAA yearly report: {e.Message}"); + throw; + } return report; } @@ -45,29 +52,38 @@ public List GenerateNoaaMonthReport(int year, int month) cumulus.LogMessage("Creating NOAA monthly report"); var report = noaa.CreateMonthlyReport(noaats); - // If not using UTF, then we have to convert the character set - var utf8WithoutBom = new System.Text.UTF8Encoding(false); - var encoding = cumulus.NOAAUseUTF8 ? utf8WithoutBom : System.Text.Encoding.GetEncoding("iso-8859-1"); - var reportName = noaats.ToString(cumulus.NOAAMonthFileFormat); - noaafile = cumulus.ReportPath + reportName; - cumulus.LogMessage("Saving monthly NOAA report as " + noaafile); - File.WriteAllLines(noaafile, report, encoding); - + var reportName = String.Empty; + try + { + // If not using UTF, then we have to convert the character set + var utf8WithoutBom = new System.Text.UTF8Encoding(false); + var encoding = cumulus.NOAAUseUTF8 ? utf8WithoutBom : System.Text.Encoding.GetEncoding("iso-8859-1"); + reportName = noaats.ToString(cumulus.NOAAMonthFileFormat); + noaafile = cumulus.ReportPath + reportName; + cumulus.LogMessage("Saving monthly NOAA report as " + noaafile); + File.WriteAllLines(noaafile, report, encoding); + } + catch (Exception e) + { + cumulus.LogMessage($"Error creating NOAA yearly report '{reportName}': {e.Message}"); + throw; + } return report; } public List GetNoaaYearReport(int year) { DateTime noaats = new DateTime(year, 1, 1); - + var reportName = String.Empty; try { - var reportName = noaats.ToString(cumulus.NOAAYearFileFormat); + reportName = noaats.ToString(cumulus.NOAAYearFileFormat); noaafile = cumulus.ReportPath + reportName; report = File.Exists(noaafile) ? new List(File.ReadAllLines(noaafile)) : new List { "That report does not exist" }; } - catch + catch (Exception e) { + cumulus.LogMessage($"Error getting NOAA yearly report '{reportName}': {e.Message}"); report = new List { "Something went wrong!" }; } return report; @@ -76,16 +92,17 @@ public List GetNoaaYearReport(int year) public List GetNoaaMonthReport(int year, int month) { DateTime noaats = new DateTime(year, month, 1); - + var reportName = String.Empty; try { - var reportName = noaats.ToString(cumulus.NOAAMonthFileFormat); + reportName = noaats.ToString(cumulus.NOAAMonthFileFormat); noaafile = cumulus.ReportPath + reportName; var encoding = cumulus.NOAAUseUTF8 ? Encoding.GetEncoding("utf-8") : Encoding.GetEncoding("iso-8859-1"); report = File.Exists(noaafile) ? new List (File.ReadAllLines(noaafile, encoding)) : new List { "That report does not exist" }; } - catch + catch (Exception e) { + cumulus.LogMessage($"Error getting NOAA monthly report '{reportName}': {e.Message}"); report = new List { "Something went wrong!" }; } return report; diff --git a/CumulusMX/Properties/AssemblyInfo.cs b/CumulusMX/Properties/AssemblyInfo.cs index 7dc91d11..12651415 100644 --- a/CumulusMX/Properties/AssemblyInfo.cs +++ b/CumulusMX/Properties/AssemblyInfo.cs @@ -6,7 +6,7 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Cumulus MX")] -[assembly: AssemblyDescription("Build 3116")] +[assembly: AssemblyDescription("Build 3117")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Cumulus MX")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.10.1.3116")] -[assembly: AssemblyFileVersion("3.10.1.3116")] +[assembly: AssemblyVersion("3.10.2.3117")] +[assembly: AssemblyFileVersion("3.10.2.3117")] diff --git a/Updates.txt b/Updates.txt index 1e075de7..e5bcac36 100644 --- a/Updates.txt +++ b/Updates.txt @@ -1,3 +1,9 @@ +3.10.2 - b3117 +—————————————— +- Fix: Improve the AWEKAS fall back for upload interval to go right back to 5 minutes in two stages +- Fix: Add additional error logging to NOAA report generation + + 3.10.1 - b3116 —————————————— - Fix: Bug in temperature conversions introduced in v3.10.0 From b7ec7a319315d0e5108f60dabdf1d0ba0b6e8b6d Mon Sep 17 00:00:00 2001 From: Mark Crossley <1196094+mcrossley@users.noreply.github.com> Date: Sun, 28 Feb 2021 17:15:56 +0000 Subject: [PATCH 2/4] uplift version --- CumulusMX/Properties/AssemblyInfo.cs | 4 ++-- Updates.txt | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CumulusMX/Properties/AssemblyInfo.cs b/CumulusMX/Properties/AssemblyInfo.cs index 7dc91d11..f8b80a1f 100644 --- a/CumulusMX/Properties/AssemblyInfo.cs +++ b/CumulusMX/Properties/AssemblyInfo.cs @@ -6,7 +6,7 @@ // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Cumulus MX")] -[assembly: AssemblyDescription("Build 3116")] +[assembly: AssemblyDescription("Build 3117")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Cumulus MX")] @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.10.1.3116")] +[assembly: AssemblyVersion("3.10.2.3117")] [assembly: AssemblyFileVersion("3.10.1.3116")] diff --git a/Updates.txt b/Updates.txt index 1e075de7..28f7d96c 100644 --- a/Updates.txt +++ b/Updates.txt @@ -3,7 +3,6 @@ - Fix: Bug in temperature conversions introduced in v3.10.0 - 3.10.0 - b3115 —————————————— - Fix: Catch error creating System Uptime counter on Windows From f492c0db5e6b4eb3135de69f29392d203c8aafa8 Mon Sep 17 00:00:00 2001 From: Mark Crossley <1196094+mcrossley@users.noreply.github.com> Date: Mon, 1 Mar 2021 15:40:15 +0000 Subject: [PATCH 3/4] Fix occasional corrupt processed web output files #2 --- CumulusMX/Cumulus.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CumulusMX/Cumulus.cs b/CumulusMX/Cumulus.cs index 35d6f2bc..b296bdc3 100644 --- a/CumulusMX/Cumulus.cs +++ b/CumulusMX/Cumulus.cs @@ -2574,11 +2574,6 @@ private void RealtimeFTPUpload(byte cycle) var remoteFile = remotePath + RealtimeFiles[i].RemoteFileName; var localFile = RealtimeFiles[i].LocalPath + RealtimeFiles[i].LocalFileName; - if (RealtimeFiles[i].Create && !string.IsNullOrWhiteSpace(RealtimeFiles[i].TemplateFileName)) - { - ProcessTemplateFile(RealtimeFiles[i].TemplateFileName, localFile, realtimeTokenParser); - } - LogFtpMessage($"Realtime[{cycle}]: Uploading - {RealtimeFiles[i].LocalFileName}"); if (Sslftp == FtpProtocols.SFTP) { From f317daa18ccaf3489de4321096a5548c398af714 Mon Sep 17 00:00:00 2001 From: Mark Crossley <1196094+mcrossley@users.noreply.github.com> Date: Tue, 2 Mar 2021 14:53:25 +0000 Subject: [PATCH 4/4] v3.10.2 final --- CumulusMX/InternetSettings.cs | 2 +- CumulusMX/NOAA.cs | 79 +++++++++++++++++++---------------- CumulusMX/StationSettings.cs | 6 +++ Updates.txt | 15 ++++++- 4 files changed, 65 insertions(+), 37 deletions(-) diff --git a/CumulusMX/InternetSettings.cs b/CumulusMX/InternetSettings.cs index 69161a42..96627424 100644 --- a/CumulusMX/InternetSettings.cs +++ b/CumulusMX/InternetSettings.cs @@ -887,7 +887,7 @@ public string GetInternetAlpacaFormSchema() public string GetExtraWebFilesData() { var json = new StringBuilder(10240); - json.Append("{\"metadata\":[{\"name\":\"local\",\"label\":\"Local Filename\",\"datatype\":\"string\",\"editable\":true},{\"name\":\"remote\",\"label\":\"Remote Filename\",\"datatype\":\"string\",\"editable\":true},{\"name\":\"process\",\"label\":\"Process\",\"datatype\":\"boolean\",\"editable\":true},{\"name\":\"realtime\",\"label\":\"Realtime\",\"datatype\":\"boolean\",\"editable\":true},{\"name\":\"ftp\",\"label\":\"FTP\",\"datatype\":\"boolean\",\"editable\":true},{\"name\":\"utf8\",\"label\":\"UTF-8\",\"datatype\":\"boolean\",\"editable\":true},{\"name\":\"binary\",\"label\":\"Binary\",\"datatype\":\"boolean\",\"editable\":true},{\"name\":\"endofday\",\"label\":\"End of day\",\"datatype\":\"boolean\",\"editable\":true}],\"data\":["); + json.Append("{\"metadata\":[{\"name\":\"local\",\"label\":\"Local Filename\",\"datatype\":\"string\",\"editable\":true},{\"name\":\"remote\",\"label\":\"Destination Filename\",\"datatype\":\"string\",\"editable\":true},{\"name\":\"process\",\"label\":\"Process\",\"datatype\":\"boolean\",\"editable\":true},{\"name\":\"realtime\",\"label\":\"Realtime\",\"datatype\":\"boolean\",\"editable\":true},{\"name\":\"ftp\",\"label\":\"FTP\",\"datatype\":\"boolean\",\"editable\":true},{\"name\":\"utf8\",\"label\":\"UTF-8\",\"datatype\":\"boolean\",\"editable\":true},{\"name\":\"binary\",\"label\":\"Binary\",\"datatype\":\"boolean\",\"editable\":true},{\"name\":\"endofday\",\"label\":\"End of day\",\"datatype\":\"boolean\",\"editable\":true}],\"data\":["); for (int i = 0; i < Cumulus.numextrafiles; i++) { diff --git a/CumulusMX/NOAA.cs b/CumulusMX/NOAA.cs index 4db94783..9dc7270a 100644 --- a/CumulusMX/NOAA.cs +++ b/CumulusMX/NOAA.cs @@ -1028,7 +1028,7 @@ public List CreateYearlyReport(DateTime thedate) repLine.Append(" 0.0"); else { - repLine.Append(string.Format(culture, "{0,6F1}", (meantemp - (totalnormtemp / normtempsamples)))); + repLine.Append(string.Format(culture, "{0,6:F1}", (meantemp - (totalnormtemp / normtempsamples)))); } repLine.Append(string.Format(culture, "{0,6:D}{1,6:D}", (int)(totalheating), (int)(totalcooling))); if (maxtempmonth == 0) @@ -1149,43 +1149,53 @@ public List CreateYearlyReport(DateTime thedate) // Wind section details for (m = 1; m < 13; m++) { - repLine.Clear(); - repLine.Append(string.Format("{0,3}{1,3:D}", twodigityear, m)); - - if (MonthList[m].valid) + try { - // calculate average wind speed - MonthList[m].avgwindspeed = GetAverageWindSpeed(m, year, out domdir); - MonthList[m].winddomdir = domdir; - if (MonthList[m].avgwindspeed < 0) - { - // no valid average - repLine.Append(" ----"); - } - else + repLine.Clear(); + repLine.Append(string.Format("{0,3}{1,3:D}", twodigityear, m)); + + if (MonthList[m].valid) { - // String.Format the average into the display line - repLine.Append(string.Format(culture, "{0,6:F1}", MonthList[m].avgwindspeed)); - totalavgwind += MonthList[m].avgwindspeed * MonthList[m].samples; - avgwindcount += MonthList[m].samples; - } + // calculate average wind speed + MonthList[m].avgwindspeed = GetAverageWindSpeed(m, year, out domdir); + MonthList[m].winddomdir = domdir; + if (MonthList[m].avgwindspeed < 0) + { + // no valid average + repLine.Append(" ----"); + } + else + { + // String.Format the average into the display line + repLine.Append(string.Format(culture, "{0,6:F1}", MonthList[m].avgwindspeed)); + totalavgwind += MonthList[m].avgwindspeed * MonthList[m].samples; + avgwindcount += MonthList[m].samples; + } - // String.Format the high wind speed and dominant direction into the display line - repLine.Append(string.Format(culture, "{0,6:F1}{1,5:D}", MonthList[m].highwindspeed, MonthList[m].highwindday)); - repLine.Append(string.Format("{0,6}", CompassPoint(MonthList[m].winddomdir))); + // String.Format the high wind speed and dominant direction into the display line + repLine.Append(string.Format(culture, "{0,6:F1}{1,5:D}", MonthList[m].highwindspeed, MonthList[m].highwindday)); + repLine.Append(string.Format("{0,6}", CompassPoint(MonthList[m].winddomdir))); - // check for highest annual wind speed - if (MonthList[m].highwindspeed > highwind) - { - highwind = MonthList[m].highwindspeed; - highwindmonth = m; - } + // check for highest annual wind speed + if (MonthList[m].highwindspeed > highwind) + { + highwind = MonthList[m].highwindspeed; + highwindmonth = m; + } - // increment the total wind vectors for the annual calculation - totalwinddirX += (MonthList[m].avgwindspeed * Math.Sin(Trig.DegToRad(domdir))) * MonthList[m].samples; - totalwinddirY += (MonthList[m].avgwindspeed * Math.Cos(Trig.DegToRad(domdir))) * MonthList[m].samples; + // increment the total wind vectors for the annual calculation + totalwinddirX += (MonthList[m].avgwindspeed * Math.Sin(Trig.DegToRad(domdir))) * MonthList[m].samples; + totalwinddirY += (MonthList[m].avgwindspeed * Math.Cos(Trig.DegToRad(domdir))) * MonthList[m].samples; + } + output.Add(repLine.ToString()); + } + catch (Exception e) + { + cumulus.LogMessage($"CreateYearlyReport: Error creating wind section: {e.Message}"); + cumulus.LogDebugMessage("CreateYearlyReport: Last line generated was..."); + cumulus.LogDebugMessage($"CreateYearlyReport: \"{repLine}\""); + throw; } - output.Add(repLine.ToString()); } output.Add("------------------------------"); @@ -1193,9 +1203,8 @@ public List CreateYearlyReport(DateTime thedate) catch (Exception e) { cumulus.LogMessage($"CreateYearlyReport: Error creating the report: {e.Message}"); - cumulus.LogDebugMessage("CreateYearlyReport: Last two lines generated were..."); - cumulus.LogDebugMessage($"CreateYearlyReport: \"{output[output.Count - 2]}\""); - cumulus.LogDebugMessage($"CreateYearlyReport: \"{output[output.Count - 1]}\""); + cumulus.LogDebugMessage("CreateYearlyReport: Output generated so far was..."); + cumulus.LogDebugMessage(string.Join("\n",output)); throw; } diff --git a/CumulusMX/StationSettings.cs b/CumulusMX/StationSettings.cs index 88503de6..0b457351 100644 --- a/CumulusMX/StationSettings.cs +++ b/CumulusMX/StationSettings.cs @@ -617,6 +617,12 @@ internal string UpdateStationConfig(IHttpContext context) // Display Options try { + // bug catch incase user has the old JSON config files that do not work. + if (settings.DisplayOptions.windrosepoints == 0) + settings.DisplayOptions.windrosepoints = 8; + else if (settings.DisplayOptions.windrosepoints == 1) + settings.DisplayOptions.windrosepoints = 16; + cumulus.NumWindRosePoints = settings.DisplayOptions.windrosepoints; cumulus.WindRoseAngle = 360.0 / cumulus.NumWindRosePoints; cumulus.DisplayOptions.UseApparent = settings.DisplayOptions.useapparent; diff --git a/Updates.txt b/Updates.txt index dc5f7afa..d2686f3b 100644 --- a/Updates.txt +++ b/Updates.txt @@ -2,7 +2,20 @@ —————————————— - Fix: Improve the AWEKAS fall back for upload interval to go right back to 5 minutes in two stages - Fix: Occasional corrupt files output that have processed web tags in them -- Fix: Add additional error logging to NOAA report generation +- Fix: Error creating the NOAA Year report for some people +- Fix: Missing station location on gauges.htm web site page + +- New: Default website now removes the "Current Conditions" element if the value is blank +- New: Default web site now auto updates the index.htm and today.htm pages every minute + +- Change: The current conditions is now HTML encoded in case it contains illegal characters + +- Updated default web site files + \web\websitedataT.json + \webfiles\index.htm + \webfiles\gauges.htm + \webfiles\js\setpagedata.js + 3.10.1 - b3116