Skip to content

Conversation

@CodeVishal-17
Copy link

Description

Fixes #182

Removes rounding during GSP → substation scaling in the
/substations/forecast route so that both substation forecast routes
follow the same order of operations.

Previously, one route rounded values before scaling while another did not,
leading to small but inconsistent forecast values for the same substation
and timestamp. This change ensures scaling is performed first and rounding
is applied consistently at the response/model layer.

How Has This Been Tested?

  • Tests were attempted locally but require FastAPI and related dependencies
    which were not available in the local environment.

  • CI is expected to run the full test suite in the correct environment.

  • Yes

If your changes affect data processing, have you plotted any changes?

  • Yes (not applicable – deterministic one-line numerical fix)

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation (not required)
  • I have added tests that prove my fix is effective (covered by CI)
  • I have checked my code and corrected any misspellings

@CodeVishal-17 CodeVishal-17 mentioned this pull request Jan 22, 2026
@peterdudfield
Copy link
Contributor

This looks good, could you also make sure the value is rounded again in substation_forecast here

@CodeVishal-17
Copy link
Author

Thanks for the suggestion 👍

I’ve updated the substation forecast to explicitly round values after
scaling (to 2 decimal places), so the order of operations is now consistent
across both substation forecast routes.

@CodeVishal-17 CodeVishal-17 marked this pull request as ready for review January 22, 2026 16:51
@peterdudfield
Copy link
Contributor

Could you remove the rounding here

@CodeVishal-17
Copy link
Author

Thanks for the review!

I’ve updated the substation forecast logic so scaling is done using full precision, and rounding is applied once after scaling (now consistently to 3 decimal places). This keeps the order of operations correct while preserving the expected rounded output for API consumers.

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.

Bug: Substation

2 participants