Just now I've learned that my old weewx.sdb database is still compatible
with my new weatherstation. I've setup that database many years (8) ago.
Using sqlitebrowser I have seen that e.g. appTemp is missing in that old
database. But using my old datbase works smooth, i.e weewx is more
intelligent in handling missing fields as expected. Thus I no longer need
to use my workaround to handle NOAA data.
Michael Waldor schrieb am Sonntag, 26. Juli 2026 um 10:56:05 UTC+2:
> In the meanwhile I've tweaked my script a little bit to make it more
> robust. Sadly, I have to hardcode the path /var/www/html/weewx set within
> weewx.conf as StdReport.HTML_ROOT. I (and gemini) couldn't find any
> mechanism to extract that parameter within Cheetah scripting.
>
> Regarding getting access - weewx and nginx run on the same raspberry pi 4,
> thus the files are accessible without any problem to all web instances.
>
> <div id="reports">
> #import os
> #import fnmatch
> #set $noaa_dir = os.path.join('/var/www/html/weewx', 'NOAA')
> #if os.path.isdir($noaa_dir)
> #set $files = os.listdir($noaa_dir)
> #set $monthYears = fnmatch.filter($files,
> 'NOAA-[0-9][0-9][0-9][0-9]-[0-9][0-9].txt')
>
> #set $years = fnmatch.filter($files, 'NOAA-[0-9][0-9][0-9][0-9].txt')
> $gettext("Monthly Reports"):
> <select name="reports" onchange="openTabularFile(value)">
> #for $entry in $monthYears
> #set $monthYear = $entry[5:-4]
>
> <option value="$monthYear">$monthYear</option>
> #end for
> <option selected>- $gettext("select month") -</option>
> </select>
> <br/>
> $gettext("Yearly Reports"):
> <select name="reports" onchange="openTabularFile(value)">
> #for $entry in $years
> #set $year = $entry[5:-4]
> <option value="$year">$year</option>
>
> #end for
> <option selected>- $gettext("select year") -</option>
> </select>
> <br/>
> #end if
> </div>
>
> Regards, Michael
>
> Vince Skahan schrieb am Samstag, 25. Juli 2026 um 19:18:43 UTC+2:
>
>> Is there a reasonable way to seed (so to speak) the new db with
>> placeholder info so the existing Seasons has whatever it needs to generate
>> the lists of months/years for the historical data ? Seems like a one-time
>> thing might be possible perhaps ?
>>
>> On Saturday, July 25, 2026 at 10:08:11 AM UTC-7 Tom Keffer wrote:
>>
>>> Good idea. It could be packaged as a search list extension.
>>>
>>> Of course, that will only get you what is on the computer that is
>>> hosting weewx, not what is on the web server.
>>>
>>> On Sat, Jul 25, 2026 at 9:55 AM 'Michael Waldor' via weewx-user <
>>> [email protected]> wrote:
>>>
>>>> With the help of gemini I could write a small Cheetah script to do what
>>>> I need - of course this is only a kind of workaround/proof of concept. But
>>>> it works:
>>>> <div id="reports">
>>>> #import os
>>>> #import fnmatch
>>>> #set $files = os.listdir('/var/www/html/weewx/NOAA')
>>>> #set $months = fnmatch.filter($files,
>>>> 'NOAA-[0-9][0-9][0-9][0-9]-[0-9][0-9].txt')
>>>> #set $years = fnmatch.filter($files,
>>>> 'NOAA-[0-9][0-9][0-9][0-9].txt')
>>>> $gettext("Monthly Reports"):
>>>> <select name="reports" onchange="openTabularFile(value)">
>>>> #for $month in $months
>>>> #set $monthYear = os.path.splitext($month)[0]
>>>> #set $monthYear = $monthYear[5:]
>>>> <option value="$monthYear">$monthYear</option>
>>>> #end for
>>>> <option selected>- $gettext("select month") -</option>
>>>> </select>
>>>> <br/>
>>>> $gettext("Yearly Reports"):
>>>> <select name="reports" onchange="openTabularFile(value)">
>>>> #for $year in $years
>>>> #set $yr = os.path.splitext($year)[0]
>>>> #set $yr = $yr[5:]
>>>> <option value="$yr">$yr</option>
>>>> #end for
>>>> <option selected>- $gettext("select year") -</option>
>>>> </select>
>>>> <br/>
>>>> </div>
>>>> Anyhow I'm really impressed of the power of Cheetah!
>>>>
>>>> Tom Keffer schrieb am Samstag, 25. Juli 2026 um 17:34:27 UTC+2:
>>>>
>>>>> Client-side Javascript cannot read the web server's file system due to
>>>>> security sandboxing. I can think of a few ways around that, but none
>>>>> is very satisfying.
>>>>>
>>>>> 1. Turn directory indexing on for the NOAA subdirectory. Then
>>>>> fetch the list of files, parse them, and display. This is probably the
>>>>> best
>>>>> of the alternative approaches. I didn't use this because it requires a
>>>>> user
>>>>> to modify his/her web server configuration.
>>>>> 2. Include some sort of manifest file, such as noaa.json. Retrieve
>>>>> that, parse, and display. Problem is that the manifest file has to be
>>>>> generated, so you're back to where you started.
>>>>> 3. Require a backend framework. You read the manifest from an
>>>>> endpoint. Again, this requires users to install infrastructure.
>>>>>
>>>>> The solution I came up with was the only one that required minimal
>>>>> user modifications. If I have missed an idea, I'd love to hear about it!
>>>>>
>>>>> -tk
>>>>>
>>>>>
>>>>> On Sat, Jul 25, 2026 at 8:20 AM 'Michael Waldor' via weewx-user <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Thanks for your quick reply. The NOAA files are stored within the
>>>>>> HTML area served by nginx, thus should be visible for a web browser.
>>>>>> Only
>>>>>> the selection is not possible because the variables are set by
>>>>>> CheetahGenerator - as to be expected.
>>>>>>
>>>>>> Thus my best solution will be data migration. The author of the new
>>>>>> ecowitt driver even provides an sql script for that purpose. I'll give
>>>>>> it a
>>>>>> try.
>>>>>>
>>>>>> Tom Keffer schrieb am Samstag, 25. Juli 2026 um 16:31:56 UTC+2:
>>>>>>
>>>>>>> Your question is not entirely clear to me, but what I think you're
>>>>>>> asking is how do you gain access to the file names from within the
>>>>>>> webpage.
>>>>>>>
>>>>>>> The answer is that you can't. Modern web browsers don't allow free
>>>>>>> access to the file system on the client, so you cannot search to see
>>>>>>> which
>>>>>>> files have been generated.
>>>>>>>
>>>>>>> Instead, the dropdown list that you see is created at file
>>>>>>> generation time. The Cheetah generator keeps track of all files that
>>>>>>> should
>>>>>>> be there and populates the list with that.
>>>>>>>
>>>>>>> If at all possible, you would be best off figuring out some way of
>>>>>>> migrating your old data to your new weewx.sdb file. Provided the data
>>>>>>> is
>>>>>>> still in the flat format used by the database, this should be possible.
>>>>>>> Have you tried using the "weectl database" utility for adding and
>>>>>>> removing
>>>>>>> columns?
>>>>>>>
>>>>>>> -tk
>>>>>>>
>>>>>>> On Sat, Jul 25, 2026 at 5:58 AM 'Michael Waldor' via weewx-user <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> Both variables are used within Seasons skin titlebar.inc to
>>>>>>>> populate the month resp. year dropdown. Works fine.
>>>>>>>>
>>>>>>>> But now I've setup a new weatherstation with incompatible weewx.sdb
>>>>>>>> DB structure (ecowitt_http_driver). Thus I'm forced to start with an
>>>>>>>> empty
>>>>>>>> weewx.sdb (because currently I want to avoid to migrate my old data).
>>>>>>>> The
>>>>>>>> folder /var/www/html/weewx/NOAA still contains all old summaries,
>>>>>>>> but I can't access them from Seasons gui, probabely because
>>>>>>>> $SummaryByYear
>>>>>>>> and $SummaryByMonth are initialized based on the current weewx.sdb.
>>>>>>>>
>>>>>>>> Is it possible to get access to the (existing) old NOAA files from
>>>>>>>> within Seasons titlebar.inc? As a final resort I might hardwire the
>>>>>>>> list of
>>>>>>>> years within "my" titlebar.inc, but maybe there is a better solution?
>>>>>>>>
>>>>>>>> Regards, Michael
>>>>>>>>
>>>>>>>> --
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "weewx-user" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>> send an email to [email protected].
>>>>>>>> To view this discussion visit
>>>>>>>> https://groups.google.com/d/msgid/weewx-user/37c7eed3-2bbd-4307-81af-ab61e6aca2efn%40googlegroups.com
>>>>>>>>
>>>>>>>> <https://groups.google.com/d/msgid/weewx-user/37c7eed3-2bbd-4307-81af-ab61e6aca2efn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>>
>>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "weewx-user" group.
>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>> send an email to [email protected].
>>>>>>
>>>>> To view this discussion visit
>>>>>> https://groups.google.com/d/msgid/weewx-user/925d0362-f899-4025-88b1-8fcdbb21fd65n%40googlegroups.com
>>>>>>
>>>>>> <https://groups.google.com/d/msgid/weewx-user/925d0362-f899-4025-88b1-8fcdbb21fd65n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "weewx-user" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>>
>>> To view this discussion visit
>>>> https://groups.google.com/d/msgid/weewx-user/bf43a78e-900e-476b-935d-ce1a5e6608e4n%40googlegroups.com
>>>>
>>>> <https://groups.google.com/d/msgid/weewx-user/bf43a78e-900e-476b-935d-ce1a5e6608e4n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>>
--
You received this message because you are subscribed to the Google Groups
"weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/weewx-user/8dd2a7ff-521e-40c6-941d-5bb33f46d1ebn%40googlegroups.com.