Page 2 of 3

Re: PHP Script for Website Seasonal Snowfall Data for CMX 4.3+

Posted: Tue 21 Jan 2025 2:30 pm
by surban21
Dador wrote: Sun 19 Jan 2025 12:06 pm Steve,

I use the script and I admit that the translation option is great. I just have a small comment on the Polish translation. If You could include my corrections in the next version.

Code: Select all

'Events' => 'Zdarzenia',
'Most - year' => 'Najwięcej - rok', 
The original translation of 'Events' -> 'Imprezy' is incorrect. In Polish 'imprezy' is in English 'party' :D

I will be grateful because I won't have to manually correct this with each update.

HaHa - translators aren't always perfect are they? lol It will be on the next release.

Re: Script to display snow data on website for CMX 4.3+

Posted: Thu 20 Feb 2025 8:09 pm
by surban21
There's an updated version released: Feb. 20, 2025. It can be downloaded on the first page of this thread if interested.

snowDisplay version 2.0
  • ver 2.0 - Feb. 20, 2025 - Initial release of Seasonal Snowfall Data for CMX using an .exe/dll to pull data from diary.db
  • Created an exe/dll file to pull data from diary.db instead of using a php script, thus elliminating the need to install php on your local machine solely for that purpose.
  • Removed the PHP version of intlDateFormatter for localized month names. Now uses javascript's version which is independant of any PHP versions.
  • Calculations for the snowfall statistics section now uses the date when snowfall (snow24hr) was first recorded.

Re: Script to display snow data on website for CMX 4.3+

Posted: Thu 20 Feb 2025 9:49 pm
by PaulMy
Hi Steve,
This is exciting...
I think I have it running ok on my PC, just having a problem getting the getSnowDataT.txt uploaded to my website. I can't see any logging or errors in MXDiags on this upload. I've had to use 'realtime' in External programs because my "Interval' and 'Daily" ones are already being used for another process. But I will figure this out later.

Notwithstanding that upload issue, the script works as I manually uploaded the created getSnowDataT.txt and renamed as snowData.txt and you can see it here https://www.komokaweather.com/cumulusmx ... isplay.php

From MXDiags:

Code: Select all

2025-02-20 16:29:12.074 Realtime[217]: Processing extra web C:\KomokaWeather\CumulusMXwll\snowDisplay\getSnowDataT.txt
2025-02-20 16:29:13.821 Realtime[217]: Execute realtime program - C:\KomokaWeather\CumulusMXwll\snowDisplay\bin\snowQuery.exe, with parameters - 
2025-02-20 16:29:13.824 Realtime[217]: End cycle
From my Extra web files settings:

Code: Select all

C:\KomokaWeather\CumulusMXwll\snowDisplay\getSnowDataT.txt	public_html/cumulusmxwll/snowData.txt	
Enjoy,
Paul

Re: Script to display snow data on website for CMX 4.3+

Posted: Thu 20 Feb 2025 10:05 pm
by PaulMy
Hi Steve,
Just a quick comment now that I've had a look at the data.
Until the change in CMX 'diary' I had used "T" for 'Trace' as that is what is required for reporting to CoCoRaHS. With the change in CMX 'diary' to accept daily snow24h entry I changed my 'T' practice to instead enter 0.0 for no snow, and either 0.1 for visible snowing but not accumulating, or 0.2 for new snow but not measurable. I edited my diary to those 0.0 all the way back to 2017. I see that the script takes that 0.0 as a ''T' which I assume is a 'trace'.

Now with the further changes in the 'diary' and the use of 'null' I may have to go back and reverse all my '0.0' entries :bash:

Enjoy,
Paul

Re: Script to display snow data on website for CMX 4.3+

Posted: Thu 20 Feb 2025 10:20 pm
by surban21
@PaulMy - well you're certainly closer than you have been with this. :D As a curiosity do you have the realtime checkbox enabled in Extra Web Files since you said you are using the realtime interval? Also, I don't have a public site for testing but would your website need any permissions set to accept the upload? It's been a lot of years since I had a website and can't remember.

One other thing - in your destination textbox in the extra web files do you need to use the full path to the webserver location? something like http:// path/to/webserver

Steve

Re: Script to display snow data on website for CMX 4.3+

Posted: Fri 21 Feb 2025 12:14 am
by PaulMy
Hi Steve,
Not sure how, but it is now uploading. Possibly just a temporary FTP issue with the host (I am still using FTP rather than PHP uploads on this particular site).

Very nice. Just have to decide what to do with my 0 entries as all those 'T's are throwing the number of events out of whack.

Enjoy,
Paul

Re: Script to display snow data on website for CMX 4.3+

Posted: Fri 21 Feb 2025 1:13 am
by weatherbee
Steve,
I have your new snow data program working on my windows version of CumulusMX. It can be seen at https://www.shermanctweather.org/cmv4/snowDisplay.php
I can't get it to produce the getSnowDataT.txt file in my raspberry pi CumulusMX.
I'm sure I followed your instructions. Not sure what is happening.
Thanks,
Tom

Re: Script to display snow data on website for CMX 4.3+

Posted: Fri 21 Feb 2025 4:38 am
by HansR
Hi Steve,

In your first post you say : Runs successfully in CUtils.
Do you have an online example of this? What exactly do you mean by this.
If you have a website somewhere, could you put that in your profile and/or signature?

Thanks,

Re: Script to display snow data on website for CMX 4.3+

Posted: Fri 21 Feb 2025 1:45 pm
by surban21
PaulMy wrote: Fri 21 Feb 2025 12:14 am
Not sure how, but it is now uploading. Possibly just a temporary FTP issue with the host (I am still using FTP rather than PHP uploads on this particular site).

Very nice. Just have to decide what to do with my 0 entries as all those 'T's are throwing the number of events out of whack.

Enjoy,
Paul
Well that's a bit of good news. :clap: Your pdf version was a very large factor in the new layout. Thank you!
weatherbee wrote: Fri 21 Feb 2025 1:13 am Steve,
I have your new snow data program working on my windows version of CumulusMX. It can be seen at https://www.shermanctweather.org/cmv4/snowDisplay.php
I can't get it to produce the getSnowDataT.txt file in my raspberry pi CumulusMX.
I'm sure I followed your instructions. Not sure what is happening.
Thanks,
Tom
I'm don't think it's you ... it's probably on my end. I made the executable using C# (which the language and making executables is entirely new to me) and thought I cross-compiled for different systems. I apparently did not. I will check further into this. :)

HansR wrote: Fri 21 Feb 2025 4:38 am Hi Steve,

In your first post you say : Runs successfully in CUtils.
Do you have an online example of this? What exactly do you mean by this.
If you have a website somewhere, could you put that in your profile and/or signature?

Thanks,
Hi Hans, I don't have a public website and haven't had one for many years now. I can only test on my local machine and not on public. What i meant by running on CUtils is that I just created my CUsermenu.txt to point to snowDisplay.php and it runs in the right side window. CMX processes my executable in the external programs and upload the resulting .txt file to the website via extra web files. I can't offer a public viewing of it, but i will add a pic.

inCUtils.png

Re: Script to display snow data on website for CMX 4.3+

Posted: Fri 21 Feb 2025 1:58 pm
by HansR
Thanks.

Re: Script to display snow data on website for CMX 4.3+

Posted: Fri 21 Feb 2025 3:43 pm
by PaulMy
HI Steve,
I like the stats that are provided. Just one issue, and I am the cause of the issue...
When creating the initial Excel template I left out any entry where there was no snow fall or depth so I could use the Excel sum(...) to show the number of events.

But when CMX diary allowed for daily entry of snow24h and snowdepth I decided to enter something for every day I do a reading and that would highlight days that there was no recording either by me being away or miss doing the manual entry. If there is snow then the value is entered, and if there is no snow then 0 is entered. To me this looked correct as an actual observation of no snow can, and should be, recorded and be different to a day that no observation was made. I see this '0' value different to a 'no observation' or 'null' value.

From looking at the output of your script I believe wherever I entered '0' in the diary the script is interpreting a value and as a 'trace' so a day that counts as a snow day. This adds to the number of 'snow days', as an example: in October this year there are 31 days with 'T's when there were no snowdays that month. And similar for all the other months, and for a year. Rather than me reversing my logging '0' whenever there was no snow since 2017, is there a way your script can be modified to not show the 'T' for those '0' reading days and not count the days as part of the snow amounts?

Enjoy,
Paul

Re: Script to display snow data on website for CMX 4.3+

Posted: Fri 21 Feb 2025 4:34 pm
by weatherbee
Hi Steve,
I don't know much about Linux but did get this (maybe it will halp):
Unhandled exception. System.DllNotFoundException: Unable to load shared library 'SQLite.Interop.dll' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.2/SQLite.Interop.dll.so: cannot open shared object file: No such file or directory
/opt/CumulusMX/snowDisplay/bin/SQLite.Interop.dll.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.2/libSQLite.Interop.dll.so: cannot open shared object file: No such file or directory
/opt/CumulusMX/snowDisplay/bin/libSQLite.Interop.dll.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.2/SQLite.Interop.dll: cannot open shared object file: No such file or directory
/opt/CumulusMX/snowDisplay/bin/SQLite.Interop.dll: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.2/libSQLite.Interop.dll: cannot open shared object file: No such file or directory
/opt/CumulusMX/snowDisplay/bin/libSQLite.Interop.dll: cannot open shared object file: No such file or directory

at System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEnum op)
at System.Data.SQLite.SQLite3.StaticIsInitialized()
at System.Data.SQLite.SQLiteLog.PrivateInitialize(String className)
at System.Data.SQLite.SQLiteLog.Initialize(String className)
at System.Data.SQLite.SQLiteConnection..ctor(String connectionString, Boolean parseViaFramework)
at System.Data.SQLite.SQLiteConnection..ctor(String connectionString)
at SnowQuery.Main(String[] args) in C:\cumulusmx\webmx\csharp_snowQuery\snowQuery.cs:line 341
I do have it running on php on the raspberry.
Tom

Re: Script to display snow data on website for CMX 4.3+

Posted: Fri 21 Feb 2025 5:11 pm
by surban21
weatherbee wrote: Fri 21 Feb 2025 4:34 pm Hi Steve,
I don't know much about Linux but did get this (maybe it will halp):
Unhandled exception. System.DllNotFoundException: Unable to load shared library 'SQLite.Interop.dll' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable:
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.2/SQLite.Interop.dll.so: cannot open shared object file: No such file or directory
/opt/CumulusMX/snowDisplay/bin/SQLite.Interop.dll.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.2/libSQLite.Interop.dll.so: cannot open shared object file: No such file or directory
/opt/CumulusMX/snowDisplay/bin/libSQLite.Interop.dll.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.2/SQLite.Interop.dll: cannot open shared object file: No such file or directory
/opt/CumulusMX/snowDisplay/bin/SQLite.Interop.dll: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.2/libSQLite.Interop.dll: cannot open shared object file: No such file or directory
/opt/CumulusMX/snowDisplay/bin/libSQLite.Interop.dll: cannot open shared object file: No such file or directory

at System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEnum op)
at System.Data.SQLite.SQLite3.StaticIsInitialized()
at System.Data.SQLite.SQLiteLog.PrivateInitialize(String className)
at System.Data.SQLite.SQLiteLog.Initialize(String className)
at System.Data.SQLite.SQLiteConnection..ctor(String connectionString, Boolean parseViaFramework)
at System.Data.SQLite.SQLiteConnection..ctor(String connectionString)
at SnowQuery.Main(String[] args) in C:\cumulusmx\webmx\csharp_snowQuery\snowQuery.cs:line 341
I do have it running on php on the raspberry.
Tom
Tom - it's almost certain it has to do with my compiling. I'm rather a noob at c# and compiling, compounded that I don't have multiple os systems to test on nor have a public website for testing purposes. Just when i think i have things figured out .... i don't. So, I'm sorting this out as i continue to learn from my mistakes.

Steve

Re: Script to display snow data on website for CMX 4.3+

Posted: Fri 21 Feb 2025 5:31 pm
by PaulMy
Hi Steve,
nor have a public website for testing purposes. Just when i think i have things figured out .... i don't. So, I'm sorting this out as i continue to learn from my mistakes.
I know nothing about code/compiling, etc. but if I can help on doing test, just let me know.

Enjoy,
Paul

Re: Script to display snow data on website for CMX 4.3+

Posted: Sun 23 Feb 2025 4:14 pm
by PaulMy
Thanks Steve for the modification :clap:
The 'T's are now gone and the snowfall data and frequency stats now display correctly
https://www.komokaweather.com/cumulusmx ... isplay.php

https://www.komokaweather.com/weather/snowfall-log.pdf
https://www.komokaweather.com/cumulusmx ... iaryReport

Enjoy,
Paul