Page 1 of 1

Date format in CumulusMX data causes errors in Cumulus 1

Posted: Fri 22 Apr 2016 9:56 am
by EdE
I have been running Cumulus MX on a RPi but now want to run in Cumulus 1 on my Windows PC. Cumulus 1 complains about the date format in the Cumulus MX files.

The Cumulus MX files seem to have the format yyyy-mm-ddThh:mm:ss whereas Cumulus 1 wants dd/mm/yyyy hh:mm:ss

I am running Cumulus V1.9.4 build 1099 and Cumulus MX v3.0.0.0 build 3038

Is there anyway to make the files compatible between the two versions or a filter I can put them through to convert the date format?

Thanks,

Ed

Re: Date format in CumulusMX data causes errors in Cumulus 1

Posted: Fri 22 Apr 2016 10:16 am
by steve
I switched to using ISO format in the ini files in MX (I assume it's the ini files you're referring to?) specifically to avoid incompatible format problems. I'm surprised that the system routines in Cumulus 1 don't recognise the ISO format dates. Having said that, it is not my intention to keep MX backwards compatible with Cumulus 1. You will either need to edit the files manually, or perhaps someone can come up with a script to do the conversion.

Re: Date format in CumulusMX data causes errors in Cumulus 1

Posted: Fri 22 Apr 2016 2:11 pm
by mcrossley
You could convert all ISO strings to dd/mm/yy hh:mm:ss with a bit of PowerShell script...

Code: Select all

#prompt for input file
$file = Read-Host -Prompt 'Input file name to convert';

#get file content
$content = Get-Content $file;

#change all ISO dates to dd/mm/yyyy hh:mm:ss
$content = $content -replace '([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}:[0-9]{2}:[0-9]{2})', '$3/$2/$1 $4';

#backup the original file
Rename-Item -path $file -NewName ($file -replace 'ini','bak ');

#write the revised content back to original filename
Set-Content -Path $file -Value $Content;
Or even (run the script from the same folder as the ini files)...

Code: Select all


$files = ('alltime.ini', 'month.ini', 'today.ini', 'year.ini', 'yesterday.ini');

foreach ($file in $files) {
	Write-Host "Processing file: $file ..."
	
	#get file content
	$content = Get-Content $file;

	#change all ISO dates to dd/mm/yyyy hh:mm:ss
	$content = $content -replace '([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}:[0-9]{2}:[0-9]{2})', '$3/$2/$1 $4';

	#backup the original file
	Rename-Item -path $file -NewName ($file -replace 'ini','bak ');

	#write the revised content back to original filename
	Set-Content -Path $file -Value $Content;
}

Re: Date format in CumulusMX data causes errors in Cumulus 1

Posted: Fri 22 Apr 2016 4:38 pm
by mcrossley
Steve, I did notice when I was testing that script that the [Rain] HTime field in yesterday.ini has the date prefixed when none of the others do, nor does it in today.ini

Re: Date format in CumulusMX data causes errors in Cumulus 1

Posted: Fri 22 Apr 2016 4:54 pm
by steve
Thanks, Mark, I'll change it so it's the same as the others.

Re: Date format in CumulusMX data causes errors in Cumulus 1

Posted: Sat 03 Aug 2019 12:16 pm
by mingjen
Hello. I read that it is possible to run a script to convert cumulusMX inifiles to be used in cumulus 1. can anyone explain exactly how it is done. in what language is the script written? I will use it on a windows 10 PC :)

Re: Date format in CumulusMX data causes errors in Cumulus 1

Posted: Sat 03 Aug 2019 1:20 pm
by water01
Why don't you move the files and just run Cumulus MX on Windows 10. Cumulus 1 is an older version and it seems a bit strange to go backwards.

Re: Date format in CumulusMX data causes errors in Cumulus 1

Posted: Sat 03 Aug 2019 3:07 pm
by mingjen
It is because I think the old wersion of Cumulus is perfect if I want to see historical data, but The MX version is better in uploading weather data to various sites.
I am not strong in programing, so I thought I could use the script mentioned in this thread to make a quick translation from MX to Cumulus 1.

Re: Date format in CumulusMX data causes errors in Cumulus 1

Posted: Sun 04 Aug 2019 9:08 am
by mcrossley
mingjen wrote: Sat 03 Aug 2019 12:16 pm Hello. I read that it is possible to run a script to convert cumulusMX inifiles to be used in cumulus 1. can anyone explain exactly how it is done. in what language is the script written? I will use it on a windows 10 PC :)
The script(s) are above, they are written in PowerShell. Save as a file with a .PS1 suffix, then they should run on Windows 10.

Re: Date format in CumulusMX data causes errors in Cumulus 1

Posted: Sun 11 Aug 2019 7:17 pm
by mingjen
Thank you very much. I've Got it to work.😊👍