Skip to content

Fix PASTCAST errors and small GUI cleanup#729

Merged
latwood merged 14 commits intomasterfrom
GUI-Redesign-fixPastCastErrs
Feb 25, 2026
Merged

Fix PASTCAST errors and small GUI cleanup#729
latwood merged 14 commits intomasterfrom
GUI-Redesign-fixPastCastErrs

Conversation

@latwood
Copy link
Collaborator

@latwood latwood commented Feb 24, 2026

Made it so that the ninja PASTCAST code more properly messages via CPLError() and throw() rather than CPLDebug(), so that the GUI more properly errors out. Also some DateTime message/textBox formatting improvements and some small amount of GUI cleanup.

Still could use some general cleanup to the raw ninja PASTCAST code, but that needs to be a separate pull request to avoid diluting the description of these changes any more.

Fixes #692.

…ing them into CPLError() and throw() statements where applicable. For issue #692
…r issue #692.

Note that I did NOT put the throws into the thread functions. They seem to be properly called in there, but apparently that requires putting an additional try/catch wrapper somewhere in the threading function logic or it seg faults. So I basically just pass error codes and warning messages, then have a final double check if any files are found to have been downloaded as the check.
My original plan was to just use these new time checks, drop them from the cli and no longer add them to the GUI (old qt4 gui had its checks there instead of state checking). But, then it is unclear whether the information is more helpful as UTC or local time, these new checks are currently setup to output the error messages in UTC time.

So I decided to leave the cli checks as is for now, the GUI will just need some more proper state checking. That way, the UTC or local time can be better controlled by whatever feeds them into the ninja code, but we still have a final check just in case.
…ationFetch. Updated QDateTime display format for both PASTCAST and stationFetch in the GUI. For issue #692.
…der, looks like the only one that was crazily messed up was the point initialization time case
…nting not just "Earliest PASTCAST DateTime:", but also "Latest PASTCAST DateTime:". However, not enough room in the GUI yet, so I left the "Latest" commented out.
…ers were dropping the leading zero in cases of 00 to 09. Wasn't hurting the code, but was not correct.
…box when swapping back and forth between a given weather model and PASTCAST.
…d some of the now excess cli PASTCAST error checks as they are now done within the raw ninja PASTCAST code. For issue #692.

even though I said before that I would keep the cli PASTCAST error checking, that was just the PASTCAST dateTime out of range errors, dropped the other ones, and improved the format of the dateTime range error messages.
…specially changing out "dem" for "local", and using "forRange" to differentiate specifying "QTimeZone::systemTimeZone()" in the constructor.
@latwood
Copy link
Collaborator Author

latwood commented Feb 25, 2026

Kay, been doing some digging, into whether I can simplify the variable names even further, to drop the forRange idea. Apparently swapping all instances of local vs forRange does NOT work, using the same dem timeZone as the system/machine timeZone looks good, but when changing the dem timeZone, it looks good at first, but then the edit range vs what is displayed gets off by the time difference. In my case, America/LosAngeles vs America/Denver, it gets off by one hour.

Anyhow, I stumbled onto a new concept, which seems to be the real issue: QDateTime and QDateTimeEdit each have their own timezone handling. So if we store the QDateTime variables as the local form, NOT the forRange form, and then use setTimeZone(timeZone) on the various QDateTime widgets, we should stop having these problems.
Example:

ui->pastcastStartDateTimeEdit->setTimeZone(timeZone);
ui->pastcastEndDateTimeEdit->setTimeZone(timeZone);

I suspect that our current setup, even though it looks good right now, if run on a PC in a different timeZone, would then also be off by the time difference. Probably can test this by manually changing the system timeZone of the PC? Depends on how that propagates to Qt.

Just a reminder of what the forRange form is vs the local form. The local form turns out to be the dem timeZone form. The forRange form turns out to be this quirky storing of local QDateTime objects in the machine local timeZone, it offsets the stored time by the time difference between the system/machine timeZone and the dem timeZone.

@masonwillman
Copy link
Contributor

I'm having trouble understanding your comment, so let me see if I have the main points.

  • Local vs for range. Local is the time in the timeZone specified on the surface input page. For range is the time used to set the range for the dateTimeEdits. These are variables that we defined and discussed have a specific purpose, so I don't understand the "forRange form turns out to be this quirky storing of local QDateTime objects in the machine local timeZone".
  • QDateTime and QDateTimeEdits do not share the timeZone information. This causes problems when trying to set the ranges in different timeZones.

If you have a fix, I would commit it to the PR and allow me to review. It would help to a reference to the code.

@masonwillman
Copy link
Contributor

We need to continue to address issues for the release. Let's not spend more time on this than necessary. If more clean up is needed with variable names, that can be completed later.

…just a hint more. Turns out that "QDateTime" and "QDateTimeEdit" "widgets" each have their own timezone handling.

so drop the "forRange" weird "system/machine local" converted times, and just use standard "local", by using "QDateTimeEdit->setTimeZone(timeZone)".

related to issue #692, related to the discussion of timezones in issue #637. Oh, looks like also for issues #705 and 704
@latwood
Copy link
Collaborator Author

latwood commented Feb 25, 2026

Just pushed the fix, and it appears to be working nicely. Turns out this relates to the time zone discussion in issue #637, and directly works to do a more proper fix to issues #705 and #704.

local vs forRange. For example, if your dem is MST, and your machine/system timezone is MST, then 12:00 MST is both the display and allowed range of values in the display. BUT, if your dem is MST, and your machine/system timezone is PST, then 11:00 PST shows up as the display, but the range of values in the display would let you only go to 12:00 PST. Stuff like this when using the forRange variable, it is literally converting local time to the machine/system timezone time.

So, if QDateTimeEdits does not have a timezone set, then it uses the default machine/system timezone, hence the need to convert our local QDateTime into machine/system timezone. Setting the dem timezone to both the QDateTime and the QDateTimeEdit widgets properly now displays without quirky in between machine/system timezones.

@latwood
Copy link
Collaborator Author

latwood commented Feb 25, 2026

Man, I wish I were better at describing this. Anyhow, to clarify, I didn't realize that forRange was simply just machineLocal when I made that variable name. I think the reason the old method worked, was because the QDateTimeEdit widgets were left as the default system/machine timeZone, and so the forRange/machineLocal QDateTime were used to make the times display and match properly. Now, it is a similar idea, just fewer steps, specify the QDateTime and the QDateTimeEdit widgets to use the dem local timeZone. Anything else would lead to a mismatch.

Talking to Mason, he mentioned that he had tried this method out before, and it didn't work. It is possible that using a later version of Qt6 might also have made this work where it wasn't before, not just a mismatch of local vs machineLocal between the QDateTime and the QDateTimeEdit widgets.

… times smaller than start times, by adjusting the time entries similar to pointInit. For issue #692
@latwood latwood requested a review from masonwillman February 25, 2026 22:23
@latwood latwood merged commit 778fde8 into master Feb 25, 2026
6 checks passed
@latwood latwood deleted the GUI-Redesign-fixPastCastErrs branch February 25, 2026 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PASTCAST wxModel needs more robust error checking, for GUI

2 participants