Skip to content

Conversation

akshay-juneja
Copy link

@akshay-juneja akshay-juneja commented Sep 14, 2025

Screenshot 2025-09-14 162027

Fixes #67

This PR improves error readability for the PVNet model when Numerical Weather Prediction (NWP) data is missing or invalid.

Instead of showing confusing traceback errors like:

ValueError: Did not find any periods ...

This PR adds user-friendly error messages:

Could not run the forecast because there wasn’t enough NWP data. Please check your NWP input files and time range.

How tested

  • Tested by setting invalid NWP_ECMWF_ZARR_PATH to a fake path.
  • Confirmed the friendly error message appears, replacing the opaque tracebacks.
  • Screenshot(s) attached below showing example output and logs.

Notes

  • The NWP data paths in testing were intentionally invalid to demonstrate the error messaging.
  • This PR does not change actual forecasting logic or valid data paths.

normed_preds = []
with torch.no_grad():

# note this only running ones site
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you add these comment back in please

log.exception("Failed to prepare data sources or load model.")
log.exception(f"Error: {e}")

def _get_config(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you move these back to the same position there were. Otherwise its very hard to tell what has changed?

@akshay-juneja
Copy link
Author

Hi,
Thank you for the thorough review and helpful feedback. I have now applied the changes as requested, keeping all original comments.
Please let me know if anything else needs adjustment. Looking forward to your feedback!

dest_nwp_path=nwp_mo_global_path,
source="mo_global",
),
try:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soryr this wont do it. You need to actually look at the configuration and see if that data is available in the NWP data / timestamps

@akshay-juneja
Copy link
Author

@peterdudfield I hv changed tho If possible, could you please explain in a bit more detail what else needs to be changed or checked?

@peterdudfield
Copy link
Contributor

So as we load the NWP in, we can look at the time variable and see how far in the future the data goes.

Then in configruation, we need to make sure there is enough data. Look in config --> NWP --> interval_end_minutes

@peterdudfield
Copy link
Contributor

Note #67 is not marked at good-first-isse or contributors-welcome, so it maybe be easier for an internal OCF person to do it

@akshay-juneja
Copy link
Author

Sorry about that—my mistake. Thank you for your time and guidance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make errors more readable

2 participants