Skip to content

Commit 0fdf1b4

Browse files
committed
Fix daily rainfall calculation on raincounter reset at rollover
Increment build to v2.0.3
1 parent 09eec9b commit 0fdf1b4

3 files changed

Lines changed: 23 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Changelog
1+
# Changelog
22

33
All notable changes to this project will be documented in this file.
44

@@ -7,11 +7,19 @@ Alternatively view it [online on GitHub](https://github.com/cumulusmx/CreateMiss
77

88
---
99

10-
## 2.0.2 - 2024-10-18
10+
## [2.0.3][3] - 2025-06-27
11+
- Fix daily rainfall calculation on raincounter reset at rollover
12+
13+
## [2.0.2][2] - 2024-10-18
1114
- Fix locale issues reading solar data from the log files
1215

13-
## 2.0.1 - 2024-06-20
16+
## [2.0.1][1] - 2024-06-20
1417
- Fix locale issues reading the log files
1518

1619
## 2.0.0
1720
- Initial release for .net 8.0
21+
22+
23+
[1]: https://github.com/cumulusmx/CreateMissing/releases/tag/v2.0.1
24+
[2]: https://github.com/cumulusmx/CreateMissing/releases/tag/v2.0.2
25+
[3]: https://github.com/cumulusmx/CreateMissing/releases/tag/v2.0.3

CreateMissing.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<OutputType>Exe</OutputType>
44
<AssemblyVersion>$(PackageVersion)</AssemblyVersion>
55
<FileVersion>$(PackageVersion)</FileVersion>
6-
<Version>2.0.2.0004</Version>
6+
<Version>2.0.3.0005</Version>
77
<StartupObject>CreateMissing.Program</StartupObject>
88
<TargetFramework>net8.0</TargetFramework>
99
<Authors>Mark Crossley</Authors>

Program.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ private static Dayfilerec GetDayRecFromMonthly(DateTime date)
327327

328328
var startTime = date;
329329
var endTime = IncrementMeteoDate(date);
330-
var startTimeMinus1 = startTime.AddDays(-1);
330+
var startTimeMinus1 = DecrementMeteoDate(date);
331331

332332
// get the monthly log file name
333333
var fileName = GetLogFileName(startTimeMinus1);
@@ -431,7 +431,7 @@ private static Dayfilerec GetDayRecFromMonthly(DateTime date)
431431

432432
// are we within 24 hours of the start time?
433433
// if so initialise the 24 hour rain process
434-
if (entrydate >= startTimeMinus1 && entrydate <= startTime)
434+
if (entrydate >= startTimeMinus1 && entrydate >= startTime)
435435
{
436436

437437
// logging format changed on with C1 v1.9.3 b1055 in Dec 2012
@@ -834,7 +834,10 @@ private static Dayfilerec GetDayRecFromMonthly(DateTime date)
834834
//var rolloverRain = double.Parse(st[9]); // 9 - rain so far today
835835
var rolloverRaincounter = double.Parse(st[11], inv); // 11 - rain counter
836836

837-
rec.TotalRain += (rolloverRaincounter - lastentrycounter) * cumulus.CalibRainMult;
837+
if (rolloverRaincounter > lastentrycounter)
838+
{
839+
rec.TotalRain += (rolloverRaincounter - lastentrycounter) * cumulus.CalibRainMult;
840+
}
838841

839842

840843
//if (rolloverRain > 0)
@@ -1397,6 +1400,11 @@ private static DateTime IncrementMeteoDate(DateTime thedate)
13971400
return SetStartTime(thedate.AddDays(1));
13981401
}
13991402

1403+
private static DateTime DecrementMeteoDate(DateTime thedate)
1404+
{
1405+
return SetStartTime(thedate.AddDays(-1));
1406+
}
1407+
14001408
private static bool GetUserConfirmation(string msg)
14011409
{
14021410
do

0 commit comments

Comments
 (0)